Posts

Showing posts from 2010

Temel Fıkrası

"Sevgili oglum Temel... Senin hizli okuyamadigini bildigim için mektubu yavas yavas yaziyorum... Artik senin büyük sehre gittigin sirada yasadigimiz evde yasamiyoruz. Baban bir gazetede, "Insanlarin basina genellikle evlerinin iki kilometre civarindaki bölgelerde kaza geldigini" okumus; o yüzden tasindik...

Turn ping requests responses off (openSUSE)

YaST-> System -> etc/sysconfig editor -> search icmp you will see a rule called; Code: FW_ALLOW_PING_FW Set to no, save and restart the firewall.....

Change MAC address in linux

As root, do the following: # ifconfig eth0 down # ifconfig eth0 hw ether 00:44:55:55:55:55 # ifconfig eth0 up < http://tcr82.tynt.com/ads/7/0draKVRt1 >

Secure SSH - How To (openSUSE)

Securing SSH SSH is normally enabled by default on Linux installations, so it goes without saying that a few simple security measures are required to keep the box free from brute force attacks. These measures are part of the SSH configuration and no additional software is required. If the machine is to be public facing then as a minimum I always follow these steps: Change the port the daemon is running on Remove access to root Enable certificate public/private key authentication

Desktop Shortcut Removal in Gnome

For desktop shortcut changes goto Applications>System>Configuration>Gnome Configuration Editor Applications>Nautilus>Desktop, and uncheck what you want DONE!

wget and destination directory

If you want wget to download to a specific folder, use the following format: wget -P ~/dest/dir www.foo.com/myfile.png

grep and AND Operator!

This achieves what an AND operator should have done in grep! for i in $(grep -l string1 /path/to/files/*)   do     grep -l string2 $i   done

Remove the First N Characters From a Line

The following codes remove first 6 characters. Change the number accordingly... cut -c7- ' this works rr ^.{6} ' rr was not installed colrm 1 6 rr s/^.{6}// sed's/^.\{6\}//' perl -pe's/^.{6}//' ruby -pe'sub /^.{6}/,""' gawk'BEGIN{FIELDWIDTHS="6 999"}{print$2}'

Moving Pan's (the newsreader) profile folder to another location

Having decided to have separate drives/partitions for different tasks/files (duh! not a seperate partition for each and every file type!), I searched for a way to do that with my newsreader: Pan. Great little software (thanks Charles). Following is how I managed to achieve this quest!

101: iPhone+Stanza+Calibre (the almost-perfect solution)

Having purchased an iPod Touch, I am in constant search of new eBooks (one of the main, if not the only, reason I bought this awesome little gadget). Since I did not have any intentions of jailbreaking, I needed to find ways to transfer my ever growing library (Gutenberg is such a great source). I have come across several forums talking about eBooks and eBook readers. One of them is the source of the following how-to:

Javascript to alert PDF update after a certain date

Sometimes is necessary to create pdf documents with an expiration date or with a warning after a certain date. Adobe have a professional server solution called 'LiveCycle Rights Management ES', to respond to this requirement and many others. The follow javascript simply test, on the event 'page open', if the current system date is major or equal to a defined date and in this case popup an alert. //---------------------------------------------------------------------- // --- start edit expiration date --- var lastDay=28 var lastMonth=5 var lastYear=2009 // --- end edit expiration date --- var sessione var today=new Date(); var myDate=new Date(); lastMonth=lastMonth-1; myDate.setFullYear(lastYear,lastMonth,lastDay); if (myDate<=today && sessione!=1) { app.alert("The current document may be up to date\r\nverify a new version on http://www.root-path.net ", 1, 0, "ALERT"); sessione=1; } //------------------------...

Batch renaming (one-off job)

1. put the filenames in a file. find . -name '*.gif' -o -name '*.jpg' -o -name '*.png' -print >/tmp/f 2. get the file in a good editor, e.g. vi(m). vi /tmp/f 3. edit the file to get the commands you want (e.g :%s/pattern/replace/) 4. run the file sh /tmp/f

force all PDF files to download (APACHE)

You can put the following code in the htaccess:

Batch Renaming

If you need to rename a bunch of files from, for example,|add.png| to|add_32.png|, just do the following: for i in *; do j=`echo $i | cut -d . -f 1`; j=$j"_32.png"; mv $i $j; done

How to clear trailing spaces using VIM

:%s=\s\+$== And thats it! The % tells it to be global - not just the current line. s is a shortcut for substitute. The \s (whitespace) and \+ (at least once) are regular expression terms (the + needs to be escaped, it seems…). The $ (dollar) represents the end of a line. The = are being used as delimiters, the == at the end implies that the pattern is replaced with nothing.