Extract a range of pages from a PDF
$ gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \ -dFirstPage=N -dLastPage=M \ -sOutputFile=document-N-M.pdf \ document.pdf
5293 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
$ gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \ -dFirstPage=N -dLastPage=M \ -sOutputFile=document-N-M.pdf \ document.pdf
find . -type f -name '*.cs' -print0 | xargs -0 grep --color=always -n PATTERN
#!/bin/sh host='localhost' username='root' password='root@123' port='3306' myhost=`hostname` myip=`/sbin/ifconfig | grep -A2 'eth0 ' | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` for eachfile in `find /var/spool/cron/ -type f` do myfile=`basename $eachfile` grep -v '^#' $eachfile | grep -v '^MAILTO' | sed '/^$/d' | while read -r myline do first=`echo "$myline" | awk '{print $1}'` second=`echo "$myline" | awk '{print $2}'` third=`echo "$myline" | awk '{print $3}'` forth=`echo "$myline" | awk '{print $4}'` fifth=`echo "$myline" | awk '{print $5}'` sixth=`echo "$myline" | cut -d' ' --complement -f1-5 | sed 's/\(['"'"'\]\)/\\&/g'` seventh=`echo "$myline" | awk -F'>|>>' '{print $2}' | sed 's/2$//'` eighth=`echo "$myline" | awk -F'2>|2>>' '{print $2}' ` mysql -h$host -u$username -p$password -P$port -e" replace into test.mycron values ('$myhost', '$myip', '$myfile', '$first', '$second', '$third', '$forth', '$fifth', '$sixth', '$seventh', '$eighth', now())" done done
function is_valid_email($email) { if(preg_match("/[a-zA-Z0-9_-.+]+@[a-zA-Z0-9-]+.[a-zA-Z]+/", $email) > 0) return true; else return false; }
function mdy($mid = "month", $did = "day", $yid = "year", $mval, $dval, $yval) { if(empty($mval)) $mval = date("m"); if(empty($dval)) $dval = date("d"); if(empty($yval)) $yval = date("Y"); $months = array(1 => "January", 2 => "February", 3 => "March", 4 => "April", 5 => "May", 6 => "June", 7 => "July", 8 => "August", 9 => "September", 10 => "October", 11 => "November", 12 => "December"); $out = "<select name='$mid' id='$mid'>"; foreach($months as $val => $text) if($val == $mval) $out .= "<option value='$val' selected>$text</option>"; else $out .= "<option value='$val'>$text</option>"; $out .= "</select> "; $out .= "<select name='$did' id='$did'>"; for($i = 1; $i <= 31; $i++) if($i == $dval) $out .= "<option value='$i' selected>$i</option>"; else $out .= "<option value='$i'>$i</option>"; $out .= "</select> "; $out .= "<select name='$yid' id='$yid'>"; for($i = date("Y"); $i <= date("Y") + 2; $i++) if($i == $yval) $out.= "<option value='$i' selected>$i</option>"; else $out.= "<option value='$i'>$i</option>"; $out .= "</select>"; return $out; }
find * -name "*.war" | xargs -i cp {} wars/
> [crtl]+z > bg > disown
$ sed -e 's/\s\+/\n/g' old > new
dpkg --get-selections | grep -v deinstall > ~/InstalledPackages.list grep -ve ^# -e ^$ /etc/apt/sources.list > ~/InstalledSources.list dpkg --set-selections < ~/InstalledPackages.list
CSS /* set millions of background images */ .rbroundbox { background: url(nt.gif) repeat; } .rbtop div { background: url(tl.gif) no-repeat top left; } .rbtop { background: url(tr.gif) no-repeat top right; } .rbbot div { background: url(bl.gif) no-repeat bottom left; } .rbbot { background: url(br.gif) no-repeat bottom right; } /* height and width stuff, width not really nessisary. */ .rbtop div, .rbtop, .rbbot div, .rbbot { width: 100%; height: 7px; font-size: 1px; } .rbcontent { margin: 0 7px; } .rbroundbox { width: 50%; margin: 1em auto; } HTML <div class="rbroundbox"> <div class="rbtop"><div></div></div> <div class="rbcontent"> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis ornare ultricies libero. Donec fringilla, eros at dapibus fermentum, tellus tellus auctor erat, vitae porta magna libero sed libero. Mauris sed leo. Aliquam aliquam. Maecenas vestibulum.</p> </div><!-- /rbcontent --> <div class="rbbot"><div></div></div> </div><!-- /rbroundbox -->