October 28, 2014

Bitcoin from source: syntax error near unexpected token ‘disable-shared’

Crypto | Comments (0) admin @ 6:33 am

If you’re getting this error when you’re trying to build bitcoind from source it usually means you didn’t have libtool when you ran autogen.sh
Install libtool for your distribution and re-run autogen.sh, this should fix it.

$ ./configure
checking build system type… x86_64-unknown-linux-gnu
checking host system type… x86_64-unknown-linux-gnu
./configure: line 2848: syntax error near unexpected token `disable-shared’
./configure: line 2848: `LT_INIT(disable-shared)’

January 30, 2014

BAMT mining problems

Crypto | Comments (0) admin @ 6:06 am

With default installations of BAMT you will often get an error after a messy reboot
and the miner wont start.
If you try to start it manually and you get this:
root@bamt-miner:/opt/bamt# /etc/init.d/mine restart
Stopping mining processes…: mine..cgminer api failed…
Starting mining processes…: minestart_mining: starting mining processes
Invalid MIT-MAGIC-COOKIE-1 key..munin..cgminer…

Edit /etc/init.d/mine and after the line with:
add this:
chown user:user /home/user/.Xauthority

coldreboot your system and mining should start if you dont have
other configuration problems.

Happy mining.

December 2, 2013

An inspiring talk about the power of open source systems

Open Source, Privacy | Comments (0) admin @ 10:56 am

I suggest you watch this entire playlist if privacy is important to you http://www.ted.com/playlists/130/the_dark_side_of_data.html

October 10, 2011

BOFH style

Fun Stuff | Comments (0) admin @ 5:36 am

Webmaster : hey dude  how can I prevent receicing to my webmaster account 5k spam emails every day?
Sysadmin: fixed that
Sysadmin: I removed your account
Sysamdin: 0 spam from now on
Webmaster: LOL!!!
Webmaster: removed my account?
Webmaster: what du mean
Webmaster: now I have no more email?
Sysadmin: well yea, but zero spam
Sysadmin: so its cool
Webmaster: SEND ME THE SPAM!
Sysadmin:  :))
Webmaster: I want to be spammed!
Webmaster: hahaha

June 14, 2011

PleskFatalException out of webspace in Webspace.php

Plesk | Comments (0) admin @ 1:33 pm

Spent a few hours debugging this error and it seems transvhosts.pl breaks some things when trying to change the vhosts directory.

Some things you need to check:

check /etc/psa/psa.conf  for HTTPD_VHOSTS_D and make sure the path doesn’t contain a trailing slash.

check the hosting,smb_apsProvisionEnvironments,subdomains, sys_users tables in the psa database and make sure the home field points to the right path.

You can use the mysql REPLACE function if not:

update sys_users set home=REPLACE(home,”OLD_PATH”,”NEW_PATH”);

Check that the domain has an entry in the hosting table.

Check that the home field in the sys_users table points to the same path as in the hosting table.
This ended up fixing it for me, in sys_users I had /www/vhosts/domain.com and in hosting /www/vhosts/ANOTHERdomain.com/something

September 4, 2010

How to delete spam comments from wordpress

wordpress | Comments (0) admin @ 12:34 pm

Once you put a blog up you will be the target of many link spammers looking for link juice. You can add a series of plugins to prevent them from clogging your database
but if you’re lazy like me you can delete them once in a while using a simple sql query:

DELETE FROM wp_comments WHERE comment_approved=0;

This deletes all unapproved comments, not necessarily all of them being spam.

February 28, 2010

maildrop whitelists and blacklists

Sysadmin | Comments (0) admin @ 7:50 am

SpamAssassin and greylisting are great tools for reducing the amount of spam thats cluttering our mailboxes, however theres always those false positives that in a business environment can become quite critical.
One of the ways to improve the delivery of important emails is to create whitelists, respectively blacklists, to make sure we are not missing anything vital.
Maildrop has some very nice filtering capabilities, but as with any complex software its easy to make mistakes.
It took me some time to play around, trying to create a whitelist, till I found the lookup function which seems the perfect fit for this.
Heres my new mailfilter config which now has a white/black - list.


getaddr($MATCH) =~ /^.*/;

if ( lookup($MATCH, "geek.ro-blacklist") )
         to "$SPAM"
if( lookup($MATCH, "geek.ro-whitelist") )
         to "$MAILBOX"
if (/^X-Spam-Status:  *Yes*/)
         to "$SPAM"

the geek.ro-whitelist, geek.ro-blacklist files are just regexes to match against the sender’ email address, (e.g. .*@domain\.com), one per line.

October 30, 2009

Learn how to count()

PHP, mysql | Comments (0) admin @ 7:40 am

PHP makes lazy programmers. I don’t want to turn this into a bashing post but as a sysadmin I’ve come across a lot of misbehaving scripts that are slowing my servers down to a halt. The general acceptance is that not the language makes bad code but the programmer, which is true, but the wide spread of php snippets turned everyone with a browser into a coder. Unfortunately, or not, programming takes a lot more than gluing together some pieces of code.
While the vast information present on the web can help you a lot in improving your coding skills theres something that no paper will teach you and that is common sense.
This are two recent cases of awful programming I encountered lately and which made by head twist at the lack of thought from the supposed coder.
Case 1:
$query = “SELECT * FROM table WHERE cond=true”;
$res   = mysql_fetch_array($query);
$num   = mysql_num_rows($res);

I just looked up the manual page for mysql_num_rows and I see where most got their bad habits from.
Why this is bad:
You might not notice the performance problems of this query if you have a small table or if you’re running the mysql server on localhost. What this query does is generate a lot of useless traffic/IO and when you have this query running several times per minute or on a huge table it will have your server crawl no matter the hardware you have behind it. What you are doing is fetching all the rows from the database and then counting them, just imagine selecting 1mil records every time a page loads just to see how many of them you have and you’ll get a sense of whats wrong with this type of approach.
$query = “SELECT count(*) FROM table WHERE cond=true”;
$num   = mysql_fetch_row($query);
Same result a lot less overhead.
Case 2:
$query = “SELECT * FROM table WHERE cont=true”;
while ($res = mysql_fetch_assoc($query)) {
Why this is bad:
Again you are selecting an entire dataset when you need only a fraction of it.
$query = “SELECT id FROM table WHERE cond=true”;
while ($res = mysql_fetch_assoc($query)) {

Keep in mind that all snippets you find on the net are just examples and are made so that they apply for a wide variety of cases, this doesn’t mean that it is the best approach for your scenario. Keep all things minimal and work only with the data you really need.

May 26, 2009

Amavis - MySQL server has gone away

Sysadmin | Comments (0) admin @ 8:01 am

I found this error cluttering my system logs:
May 26 06:39:16 zeus amavis[10981]: (10981-04) NOTICE: reconnecting in response to: err=2006, HY000, DBD::mysql::st execute failed: MySQL server has gone away at (eval 86) line 166, GEN54 line 5.

After a bit of debugging it turns out amavis keeps an open connection to mysql and depending on your wait_timeout setting it might lose the connection and need to reconnect.
In order to fix this you just need to increase your wait_timeout to a comfortable value.

mysql set global wait_timeout=28800;
Query OK, 0 rows affected (0.00 sec)

You also need to edit your my.cnf file to make sure the change is persistent across mysql restarts.