Archive

Author Archive

LMAO big time

July 25th, 2011 No comments

my stomach hurts so bad – i just spent an hour in front of my laptop laughing my ass off. Jupp sent me a link – BIG THX – best site in ages: http://damnyouautocorrect.com

Categories: fun Tags: ,

OSX 10.7 Lion and eduroam

July 25th, 2011 No comments
Categories: software Tags:

TRIM revisited

July 25th, 2011 No comments

Apparently apple doesn’t like other vendors SSD’s, therefore only Apple SSD’s get TRIM support. I have a SSD ex factory but for all the hardware hackers out there, this is how its done:

http://digitaldj.net/2011/07/21/trim-enabler-for-lion/

Nasty side effect: you have to do this for each os update . . .

If you visit the link, do take the time to read the comments, they are “enlightening” . . .

Categories: Uncategorized Tags: , ,

leading zeros in bash scripts

July 18th, 2011 2 comments

I have a bash script that generates names for binaries, these names include parameters ranging from 2 to 64. I sort these then but due to the nature of alphanumeric sorting, 4 is sorted between 32 and 64 (4 is bigger than 3 but smaller than 6…). So what i need is leading zeros for the sorting to work the way i want it to work. The easiest solution i could come up with is padding zeros c-style using the command line version of printf:

PARAMLIST="2 4 8 16 24 32 40 48 56 64"
for PARAM in $PARAMLIST;
do 
  printf "%02d\n" $PARAM
done

[update by bert]

sort –numeric-sort

solves the sorting issue as well :)

Categories: bashism Tags: , ,

Command line tool of the day: paste

July 15th, 2011 No comments

ever wanted to merge two text files horizontally, line by line? I do have a list of files were I want to associate one entry in each file with its name for plotting in gnuplot:

find ${LOG} -iname "*.log" -path "*${FILTER}*" -exec cat {} \; >times.txt
find ${LOG} -iname "*.log" -path "*${FILTER}*" -exec echo {} \; >names.txt

Now i need one result file with:

name1 time1
name2 time2
...

The tool i was searching for is called paste and does exactly that:

paste names.txt times.txt

Sometimes I really do love my job (but only sometimes ;) )

Categories: bashism, nerdcore Tags: ,

Code snippet found on my disk . . .

July 11th, 2011 2 comments
int m=167772161,N=1,t[1< &lt;25]={2},a,*p,i,e=34893349,s,c,U=1;g(d,h){for(i=s;i&lt;1<<
24;i*=2)d=d*1LL*d%m;for(p=t;p<t+N;p+=s)for(i=s,c=1;i;i--)a=p[s]*(h?c:1LL)%m,p[s]
=(m+*p-a)*(h?1LL:c)%m,a+=*p,*p++=a%m,c=c*1LL*d%m;}main(){while(e/=2){N*=2;U=U*
1LL*(m+1)/2%m;for(s=N;s/=2;)g(17,0);for(p=t;p<t+N;p++)*p=*p*1LL**p%m*U%m;for(s=1
;s<N;s*=2)g(29606852,1);for(a=0,p=t;p<t+N;)a+=*p<<(e&1),*p++=a%10,a/=10;}while(!
*--p);for(t[0]--;p>=t;)putchar(48+*p--);}

It is definitely not my code ;) . . . any guesses??

[update1]
As there were some offline discussions, here the original file as a download: Download File

[update2]
This is were I most probably got the code from: http://bellard.org/mersenne.html

Categories: c/c++ Tags:

Pun intended

July 11th, 2011 No comments

Recently in a gnome-terminal somewhere 14:23h in Germany:

killall evolution

Life can be a bitch ;)

Categories: fun, nerdcore Tags:

Ubuntu Unity netspeed indicator

July 8th, 2011 No comments

One of my favorite applets in gnome is netspeed which of course wont work in unity (damn you, unity). But using the indicator version of sysmon, dstat (cool tool – check it out if you haven’t already) and some bash magic you can get something similar to work anyways.

http://www.pcurtis.com/ubuntu-unity.htm#netspeed_appindicator

The above link explains everything needed and you’ll end up with your netspeed being displayed in the panel . . .

Categories: bashism, linux Tags: , ,

Colorfull man pages

July 8th, 2011 6 comments

Ubuntu server installation provides colored man pages – nifty ;)
This is what has to be done to get it working in a X session terminal:

sudo aptitude install most
sudo update-alternatives --config pager

Choose “most” from the list and test it with a man pagge “man test”.

Have fun . . .

[update] As always, bert nows more ;) :
I have found a major and a minor flaw in using most as the man pager:

Major: I use the -X option for less (by putting them into the LESS env variable [1]). This does not clear the terminal on exit of less. Thus, you see the last viewed page of the manual. This is particular helpful when looking-up a command line option, so I can copy’n’paste the option to the command line after quitting less. I can’t find a similar option for most.

Minor: less shows the name of the manual page in the bottom prompt, while most just shows ‘*stdin*’.

Footnote [1]: For the curious reader, this is the content of my $LESS: -MSiRXF. Feel free to look them up in the manual.

Categories: bashism, fun, linux, Uncategorized Tags: ,

world domination in progress . . .

July 4th, 2011 1 comment

. . . still working on it one step at a time:

Kudos to Bert :-)

Categories: nerdcore Tags: