[insert gag reflex onomatopoeia here]
ssh tunnel to circumvent a firewall
My work place like many others has a pretty restrictive firewall that doesn’t let me ssh into my own machine. To get in the network, one has to use VPN which means that a furious battle will rage getting this to work in linux; but above all you won’t get to ssh from your phone.
So if you have a home server, run the following command on your work machine and it will create a tunnel from your work machine to your home server:
[bash]ssh -f -N -R 1337:localhost:22 root@home_server[/bash]
Now login to your home server and when you
[bash]ssh localhost -p 1337[/bash]
You will in fact be sshing to your work machine via magic fairies & such.
It adds a level of indirection which sucks major balls, so you can copy some keys and get all that automated but I don’t want to go into these details. Figure it out.
You can go away now.
Count how many file descriptors are being used by every process of a certain name
here’s a neat little command:
ps -ae | grep <process_name> | perl -lane ‘print $F[0]’ | while read filename; do ls /proc/$filename/fd; done | wc -w
just replace process_name by httpd for example and it’ll tell you how many file descriptions are in use by all the processes with http in them.
Shit I get in the mail #3
Une petite merveille est arrivee dernierement dans notre boite aux lettres. Il faut savoir que de nos jours, le phenomenes des Harleys n’a plus rien a voir avec Easy Rider. Plutot, ces joujoux sont reservees aux hommes aises en pleine crise de quarantaine.
Ils sortent leurs becanes le week end (quand il ne fait pas trop froid), vetus de cuir flambant neuf et se la jouent a outrance. Je suis sur qu’ils ont la trique quand ils apercoient leur propre image reflechie par la fenetre d’un batiment.
Le spectacle est bien evidement aussi pitoyable que bruyant, car pour attirer l’attention il faut faire le plus de vacarme possible avec sa petrolette.
Bref, cette offre s’addresse directement a ces gars.

Au dos de l’offre, voici le texte qui vise a vous vendre la gerbe (traduction ci dessous)

Chevauche avec la libertee:
La vie est une aventure sur deux roues. Quand la libertee appelle, quelques hommes attrapent leur blousons de cuir et le guidon de chrome d’un chopper americain, ils le pointent vers le vent, et amenent la libertee jusqu’a ses limites. Maintenant tu peux t’habiller pour le frisson de la route alors que tu glisses dans la chaleur de ce blouson en cuir dur, faisant savoir a tout le monde que tu appartiens a cette bande d’esprits libres. […]
bwahahaha 😀
Postfix & Spamassassin integration allowing for custom processing
This assumes that you have postfix installed and running as your SMTP server
First, make sure that you’re root
[bash]whoami[/bash]
I probably shouldn’t have to explain that if you’re reading this but just in case; if that last command returned something else than ‘root’ issue the following command
[bash]sudo su[/bash]
and enter your password
step 1: Let’s install the packages we’re gonna need
[bash]apt-get update
apt-get install spamassassin spamc[/bash]
step 2: Now we configure spamassasin
[bash]cat /etc/default/spamassassin | sed -e ‘s#ENABLED=0#ENABLED=1#g’ > /etc/default/spamassassin
cat /etc/default/spamassassin | sed -e ‘s#CRON=0#CRON=1#g’ > /etc/default/spamassassin
cat /etc/spamassassin/local.cf | set -e ‘s## rewrite_header Subject *****SPAM*****#rewrite_header Subject [*****SPAM*****] > /etc/spamassassin/local.cf[/bash]
and we start/restart it
[bash]/etc/init.d/spamassassin restart[/bash]
step 3: We create a little script that will take desired action upon spamassassin flagging
create a user called spamassassin (or whatever you want as long as you keep it consistent)
[bash]useradd -m spamassassin[/bash]
then edit the script file /home/spamassassin/spamcheck and throw the following in it
[bash]Â # variables
Â
SENDMAIL="/usr/sbin/sendmail -i"
Â
EGREP=/bin/egrep
Â
SPAMLIMIT=10
Â
# exit codes from <sysexits.h>
Â
EX_UNAVAILABLE=69
Â
# clean up when done or when aborting.
Â
trap "rm -f /tmp/out.$$" 0 1 2 3 15
Â
# pipe message to spamc
Â
cat | /usr/bin/spamc -u spamd > /tmp/out.$$
Â
# are there more than $SPAMLIMIT stars in X-Spam-Level header? :
Â
if $EGREP -q "^X-Spam-Level: *{$SPAMLIMIT,}" < /tmp/out.$$
Â
then
Â
# option 1: move spam messages to sideline dir so a human can look at them later:
Â
mv /tmp/out.$$ /home/spamassassin/`date +%Y-%m-%d_%R`-$$
Â
# option 2: divert spam message to an alternate e-mail address:
Â
#$SENDMAIL xyz@xxxx.xx < /tmp/out.$$
Â
# option 3: just delete the spam message
Â
# rm -f /tmp/out.$$
Â
# option 4: still relay the email to the recipient with the subject of the email now containing [*****SPAM*****]
Â
# $SENDMAIL "$@" < /tmp/out.$$
Â
else
Â
$SENDMAIL "$@" < /tmp/out.$$
Â
fi
Â
# Postfix returns the exit status of the Postfix sendmail command.
Â
exit $?[/bash]
make sure that you
[bash]chown spamassassin:spamassassin /home/spamassassin/spamcheck
chmod 750 /home/spamassassin/spamcheck[/bash]
step 4: Ok, so we got spamassassin going and a little script that will take an email and throw it in /home/spamassassin if it’s spam (if you chose option1) now we just need to tell postfix to pass all messages to that script
edit /etc/postfix/master.cf and replace
[code]smtp inet n – – – – smtpd[/code]
with
[code]smtp inet n – n – – smtpd -o content_filter=spamcheck:dummy[/code]
also add the following 2 lines at the bottom of the file (the indentation is important)
[code]spamcheck unix – n n – 10 pipe
flags=Rq user=spamassassin argv=/bin/spamcheck -f ${sender} — ${recipient}[/code]
We’re almost there, just restart postfix and you’re good to go!
[bash]/etc/init.d/postfix restart[/bash]
If you wanna test that out, watch the log while you send emails to your servers
[bash]tail -f /var/log/syslog[/bash]
send a clean mail, make sure that it reaches destination, then send something you know will get flagged as spam and make sure it ends up in /home/spamassasin instead of the intended recipient.
The reason we choose option 1 here is because there’s no point in still relaying a flagged email as it will still clog the recipient’s mailbox. On the other hand we don’t want to just delete it if spamassassin makes a mistake we want to play it safe and keep every emails should something arise, we quarantine the bad ones in /home/spamassassin
Lastly, as long as you have postfix just feeding the emails to a script like we just did, it’s easy to become fancier and do all kinds of processing to the email, on my server I actually call a php script that throws emails in a DB.
Silly Apache warning
If the following happens to you:
[code]apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName[/code]
just issue a:
[bash]echo Servername `cat /etc/hostname` >> /etc/apache2/apache2.conf[/bash]
Tested on: Ubuntu server 9.04 32b / Ubuntu 12.04 64b
When you see it, you probably won't shit bricks
It’s not rare to see a deer wandering around in Salt Lake City. The other day, I rode through a vast cemetary that’s tightly surrounded by a fence (I know how tight it is cause I was trying to find a shortcut through the cemetery and pretty much had to exit where I came in). In 2 minutes I saw 9 deers hanging around.
I’m not sure how they got there and if they’ll ever leave,
here’s 5 of them enjoying a quiet afternoon:
And 4 more:
Shit I get in the mail #2
Il n’est pas rare qu’au milieu du courrier, parmis les offres de cartes de credit, se cache une relance pour acheter des bibelots. Jusqu’ici pas de quoi en faire un plat. Seulement les objects en question sont d’un mauvais gout a en faire palir le cul d’un Anglais. Nicole et moi les avons garde religieusement au cours de ces derniers annees. Ont les regarde un peu comme un album photo de temps a autres pour se marrer un coup.
Sans plus tarder voici la collection:
Shit I get in the mail #1
We’re gonna start easy with the most discusting idea a marketing genius ever had, I give you:
Last time I bought a pizza from Domino’s, they threw free cinamon sticks with it. Rather than be filled with the smell of delicious pizza, my car stunk cinamon like it’s Christmas at the gay ass mall.
Domino’s, inventing puke inducing recipes since 1960
recursive name based delete
Here’s a neat little command that will let you delete specified files/directories recursively and based on their names.
Let’s do a dry run first to make sure that the command will go through the right files. Run:
[bash]<code class="plain plain">find <directory_to_start_the_recursion_in> -name <file_name</code>>[/bash]
Keep in mind that if you’re gonna have asterisks (*) in the <file_name> you need to escape them like so:
[bash]find /var/www -name *.jpg[/bash]
make sure that the result only lists the files/directories that you indeed want to obliterate. Then improve that last command by adding:
[bash]find <directory_to_start_the_recursion_in> -name <file_name> -exec rm -rf {} ;[/bash]
Since this is a pretty dangerous command even after a dry run, you can use -ok instead of -exec which will prompt you for approval everytime the command it executed.
[bash]find <directory_to_start_the_recursion_in> -name <file_name> -ok rm -rf {} ;[/bash]
This is of course not limited to rm 🙂
Killing Floor Review
Left4Dead is far from obsolete but lately I grew a little sick of playing the same maps over and over. The special zombies too are getting kinda old. This is when I came accross Killing Floor. Very little information is currently available about it on the web, a couple of videos on youtube and the official game site.
It’s currently one of the most sold game on Steam showing the strong liking that people are taking with coop massacring of zombies.

Let’s go straight to the point: the games needs to be polished the fuck out. It’s very bulky, buggy & glitchy but it is built right. The game obviously got released too early and while it seems like the people in charge are proactive about fixing all of that, one can only hope that they’ll keep doing so until they have an acceptable product.
The gameplay is just weird, moving around doesn’t feel right.
The maps aren’t the best but they’re good enough.
The monsters you get to kill are pretty cool.
Graphics aren’t bad at all.
The AI’s not the best too and so repetitiveness becomes an issue early.
The music is really good.
Sound effects on the other hand are awkward.
but really this all needs to be patched like there’s no tomorrow.
I threw a quick video together since as I said earlier, only very little info can currently be found about this game:
It’s for sale for $20 on Steam, I’ve played for about 2 hours and don’t have much more in me. Not really worth it unless you don’t mind throwing money out the window. There used to be a time where games were released as finished products…
recursive type based chmod
Here’s a cool little script that will recursively chmod, giving a permission based on whether it’s dealing with a file or a directory. This is very convenient when you want to add that +x to directories but not files.
[bash]find $1 -type f -exec chmod $2 {} ;
find $1 -type d -exec chmod $3 {} ;[/bash]
Go ahead and edit /usr/bin/chmod_script, copy paste these 2 lines in there, then issue a chmod 755 /usr/bin/chmod_script as root, that’s it!
Usage syntax is as follows:
[bash]chmod_script <directory_to_start_the_recursion_in> <permissions_for_files> <permissions_for+directories>[/bash]
so if I want to use it on /var/www do:
[code]chmod_script /var/www 644 755[/code]
Enjoy!
first!
Ca fait un bail que je vois passer le phenomene des blogs sans m’y interesser. Avec le changement complet d’Akrin je crois qu’il est temps de se mouiller les pieds. A moi le social networking, le web 2.0, et tout le tralala! Je vais vous podcaster la blogosphere comme si il n’y avait pas de lendemain.
Ca risque d’etre assez geeky faudra pas s’inquieter.
De quoi on va parler?
- programming
- vie aux states
- video games
- cats
That’s all folks






