Ben's Blog

ben

1201 Articles

miscellaneous ben July 24, 2010

Trip of doom – that's all there was…


just need to keep busy, it was that or a full geological history of
Yellowstone.

miscellaneous ben July 24, 2010

Trip of doom – first night

miscellaneous ben July 24, 2010

Trip of doom – Jackson Wyoming


Le repos du guerrier

miscellaneous ben July 24, 2010

Trip of doom – Idaho

miscellaneous ben July 24, 2010

Trip of doom – Montpellier, Idaho

miscellaneous ben July 24, 2010

Trip of doom – bear lake

miscellaneous ben July 22, 2010

trip of doom – getting ready

mapHere’s an approximate map of the little loop we’re going for.

I.T., unix / linux ben July 22, 2010

process file descriptor count

I’ve recently had to deal with a process leaking file descriptors. The following command came in handy as a quick way to count how many file descriptors a process is using.

Let’s say that we want to count them for the process(es) called firefox:

[bash]ps -ae | grep firefox | perl -lane ‘print $F[0]’ | while read filename; do ls /proc/$filename/fd; done | wc -w[/bash]

TADAA!

life in the U.S. ben March 24, 2010

This just cracks me up

20100311062Found in a bargain bin…

life in the U.S. ben March 19, 2010

Chase is not even trying anymore

201003020531

What a bunch of morons.

life in the U.S. ben December 22, 2009

Shit I get in the mail #4

Des tares qui afligent la societe Americaine, la chretientee est la plus perverse. Croire l’absurde et l’imposer sont des sports nationaux qui influencent meme la vie non-chretiens. Ainsi beaucoup de lois proposees et trop souvent adoptees visent a imposer un agenda religieux dans un pays ou la separation de l’eglise et de l’Etat est constament aggressee. Ces freaks essayent d’imposer l’enseignement du “inteligent design” dans des classes de sciences payees par l’Etat. Beaucoup croient que la terre n’est vieille que de 3000 ans et que les premiers hommes vivaients avec des dinosaures, l’evolution est bien sur la cible de ces agressions sans regard pour la raison. Par contre quand il s’agit de pomper 50L d’essence dans leur SUV, ca viendrai pas a l’idee que le procede de decomposition de matiere organique en petrol prend bien plus que 3000 ans. Bref, l’hypocrisie religieuse reigne et freine le progres social et scientifique.

Voici un cool courier recu recement,

jesus01

note 1: the red markings weren’t added by us

note 2: these are real pennies

note 3: You’re reading this right, take these 2 pennies that jesus is giving you, shove them in your shoes and then I don’t know… fucking, walk with them and your ass will be blessed.

unix / linux ben October 28, 2009

VM stuck on a task

I’ve recently lost control of a VM that was stuck at 95% of a task. I waited and tried to regain control of the VM, nothing helped. This is how I got around it:

[code]
SSH into the ESX on which the VM is instantiated
cat /proc/vmware/vm/*/names | grep <vm_name>
note the vmid
/proc/vmware/vm/<vmid>/cpu/status
note the group vmid
/usr/lib/vmware/bin/vmkload_app -k 9 <group_vmid>
[/code]

That’s it!

life in the U.S. ben September 27, 2009

Sacrilegious food

2009-09-07-202043

[insert gag reflex onomatopoeia here]

I.T., unix / linux ben September 03, 2009

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.

I.T., unix / linux ben September 02, 2009

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.

life in the U.S. ben August 12, 2009

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.

what a piece of crap
what a piece of crap

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

bwahaha
bwahaha

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 😀

miscellaneous ben June 20, 2009

Cats & air dust removers

life in the U.S. ben June 17, 2009

Marketing that works with me

The marketing geniuses finally hit the sweet spot by realizing that every guy likes stuff that blows up.

price blaster

In the U.S. of A they don’t just reduce, decrease or even cut prices. They blast them! Fuck yeah! Give me 10 bags of that shit!

I.T., unix / linux ben June 06, 2009

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.

I.T., unix / linux ben June 04, 2009

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

life in the U.S. ben June 03, 2009

Balloons

Sad balloons are sad

2009-06-03-113804

Proud balloon reporting for duty!

2009-06-03-113859

A month after being saved from the corporate world, this is what’s left of the welcome balloons that were kindly positioned at my new desk.

This little guy’s been floating for 38 days. When it finally gives in I’m giving it a Viking funeral.

life in the U.S. ben June 02, 2009

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:

1241567923936

And 4 more:

1241568030092

life in the U.S. ben May 31, 2009

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:

Posts pagination

← Previous 1 … 51 52 53 Next →

This blog is solar powered

Interactive

Handwriting Capture
Mandalagaba
IPv6 link-local to MAC converter
IPv6 MAC to link-local converter
Markov Text Generation
Markov Word Generation
Markov Music Generation
Duplogrifier
Flood Fill Algorithms
Homestead Metrics
RGB Playground
Web Games

Categories

  • aesthetics112
    • plots54
    • specular holography6
  • Books4
  • I.T.207
    • 3D modeling / printing21
    • AI7
    • all out geekery38
    • electronics29
    • homestead automation7
    • maniacal paranoia27
    • plotters49
    • unix / linux29
    • video games4
    • web development30
    • web games3
  • Lego / Duplo67
  • life in the U.S.42
  • miscellaneous204
  • nature encounters116
  • old vinyls3
  • organs2
  • self sustainability565
    • agriculture109
    • apiculture38
    • apple20
    • building132
    • canning3
    • crochet6
    • foraging6
    • hunting10
    • maple syrup47
    • poultry39
    • preserving3
    • solar power28
    • water23
    • wood85
  • trip to a new life6
Theme by Bloompixel. Proudly Powered by WordPress