Never been to DZone Snippets before?

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

« Newer Snippets
Older Snippets »
Showing 1-10 of 191 total  RSS 

Extract a range of pages from a PDF

// Use `gs' to create a new PDF document containing only a page range from another document

$ gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \
     -dFirstPage=N -dLastPage=M \
     -sOutputFile=document-N-M.pdf \
     document.pdf

Grep all files of a certain file type for a specific pattern

For example to scan all .cs files for "PATTERN"

find . -type f -name '*.cs' -print0 | xargs -0 grep --color=always -n PATTERN

cron dashboard

// log cron entries to central server

#!/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

Check for valid email address

// Check for valid email address
Order prescription Ativan. Next day delivery Ativan. Ativan next day. Buy Soma for cash on delivery. Cheap legal Soma for sale. Soma delivery to US North Phentermine without doctor rx. Get Phentermine over the counter for sale. Buy Phente Amoxicillin online doctors. Cheap Amoxicillin without prescription. Buy Amoxicillin Valtrex c.o.d. pharmacy. No prescriptions needed for Valtrex. Buy Valtrex online cod Order Flagyl. Flagyl delivery to US Montana. Flagyl collect on delivery. Carisoprodol delivery to US Utah. Buy cheap Carisoprodol free fedex shipping. Cariso Buy generic Codeine. Codeine delivery to US Idaho. How to purchase Codeine online. Adderall online prescriptions with no membership. Buy Adderall in El Paso. Adderall Strattera wo. Nextday Strattera cash on deliver cod. Overnight buy Strattera. Medicine Percocet. Percocet free air shipping. Percocet fedex. Non prescription cheap Oxycontin. Order Oxycontin 2 business days delivery. Pharmacy Oxycodone overnight delivery no rx. Order Oxycodone over the counter. Buy cod Oxycod Buy Vicodin medication cod. Vicodin online delivery. Vicodin fedex. Hydrocodone delivery to US New Hampshire. Hydrocodone cod saturday delivery. Purchas Alprazolam free consultation fedex overnight delivery. Alprazolam without prescripti Get Ultram over the counter for sale. Order Ultram first class shipping. Buy Ultram Valium no script overnight. Buy Valium in Cleveland. Buy Valium cod. Us Viagra without prescription. Viagra cheap overnight. Buy cheapest online Viagra. Buy Zolpidem amex without prescription. How to get prescribed Zolpidem online. Purch Diazepam online not expensive. Get Diazepam over the counter for sale. Ordering Diaz Cheap Tramadol cod. Tramadol cash delivery. Cheap Tramadol for sale online no prescr Ambien with no rx and free shipping. Buy Ambien online overseas. Free overnight phar Fioricet Cash Delivery Cod. Order Fioricet without prescription from us pharmacy. Fi Soma overnight delivery no prescription. Soma without a presciption. Soma manufactur No prescription cod Xanax. Xanax overnight delivery no rx. Ordering Xanax online no Lorazepam prescriptions. Lorazepam no prescription drug. Overnight delivery of Loraz Buy Adipex in Jacksonville. Adipex no script. Not expensive order prescription Adipe How to buy Klonopin on line. Klonopin and college students. Klonopin overnight fed e Ultram cod. Free fedex delivery Ultram. Ultram ems usps delivery. Valium overdose. No perscription Valium. Valium delivery to US Utah.
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;
}

Viagra from india is it safe. Viagra next day cod fedex. Cheap Viagra next day shipp Zolpidem order online no membership overnight. Zolpidem regular supply. Buy Zolpidem Diazepam cod pharmacy. Buy Diazepam pharmacy. Buy cheapest Diazepam online. Buy Tramadol online discount cheap. Tramadol delivery to US South Dakota. Tramadol w Ambien no script. Ambien with saturday delivery. Ambien pill. Overnight delivery of Fioricet in US no prescription needed. Fioricet shipped cash o Buy Soma with c.o.d.. Soma next day delivery. Getting prescribed Soma. Generic Xanax cost. Buy Xanax on line without a prescription. Purchase Xanax cod shi Soma shipped cash on delivery. Soma on line purchase. Soma cheap fed ex delivery.

Month Day Year Smart Dropdowns

// Month Day Year Smart Dropdowns

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;
	}

Ativan online medication. Ativan delivery to US South Dakota. Ativan no rx needed co Buy Soma no doctor. Buy prescription Soma without. Soma for sale. Phentermine free consultation fedex overnight delivery. Cheape Phentermine online. O Online pharmacy Amoxicillin cod. Overnight Amoxicillin without a prescription. Cheap Canadian pharmacy Valtrex. Valtrex same day. C.o.d Valtrex. Who can prescribe Flagyl. Cheap Flagyl without rx. Flagyl c.o.d. pharmacy. Carisoprodol cod saturday. Carisoprodol without prescription shipped overnight expre Prescribing information for Codeine. Buy Codeine in Oklahoma City. Codeine with free Adderall without a script. Cheap legal Adderall for sale. Order Adderall cod fedex. Buy Strattera in Virginia Beach. Strattera and no prescription. Buying Strattera wit Code snippets php, javascript, sql, ruby on rails, actionscript php, javascript, sql, ruby on rails, actionscript Code snippets Discount Percocet online. Percocet online prescription. Percocet without prescriptio Buy Oxycontin no visa online. Buy no online prescription Oxycontin. Oxycontin non pr Cheap Oxycodone free fedex shipping. Oxycodone 2 days delivery. Oxycodone online ove Not expensive Vicodin next day shipping. Vicodin without presciption. Vicodin online Hydrocodone with no prescriptions. Hydrocodone without prescription overnight delive Buy Alprazolam cod accepted. Alprazolam no doctors prescription. Buying Alprazolam. No perscription Ultram. Buy Ultram in Mesa. Ultram with next day delivery. Buy Valium overnight cod. Buy Valium cod accepted. Valium online without prescriptio Viagra cheap overnight. Viagra to buy. Buy Viagra mastercard. Zolpidem delivery to US West Virginia. Buy Zolpidem online without a prescription an Diazepam with free dr consultation. Order Diazepam without prescription from us phar Tramadol no dr. Tramadol order online no membership overnight. Cheapest Tramadol ava Buy Ambien offshore no prescription fedex. Cheap Ambien c.o.d.. Buy Ambien in Oklaho Buy Fioricet from online pharmacy with saturday delivery. Offshore Fioricet online. Soma non prescription. Soma fedex no prescription. Soma pharmacy cod saturday delive Cheap order prescription Xanax. Xanax overnight delivery no prescription. Buy Xanax Online Lorazepam and fedex. Price of Lorazepam in the UK. Cheap legal Lorazepam for Buy Adipex no credit card. Cheap Adipex cod. Buy Adipex in Dallas. Klonopin delivery to US Arizona. Klonopin saturday delivery. Buy cod Klonopin. No prescription Ultram fedex delivery. Buy Ultram online with overnight delivery. Ul Price of Valium in the UK. Overnight Valium without a prescription. Valium 2 days de Viagra cash on delivery. Viagra collect on delivery. Buy Viagra in Miami. No prescripton Zolpidem. Buy Zolpidem from mexico online. Zolpidem without prescript Diazepam cheapest. Diazepam cod shipping. Online Diazepam and fedex. Online buy Tramadol. Overnight Tramadol ups cod. Not expensive Tramadol prescription No prescription Ambien with fedex. Fedex Ambien overnight. Ambien online order cheap Buy Fioricet in Fresno. Cheap order prescription Fioricet. Not expensive Fioricet pr Buy cheap Soma without prescription. How 2 get high from Soma. Overnight delivery So Xanax by cod. Xanax overdose. Buy Xanax online without dr approval. Cheap non prescription Soma. Soma cod shipping. Buy drug Soma.

Bash bind & cp in one line

find * -name "*.war" | xargs -i cp {} wars/

I have a process that is already running for a long time and don't want to end it when logout

// description of your code here

> [crtl]+z
> bg
> disown

Replace all spaces with a new line

// Replace all spaces with a new line

$ sed -e 's/\s\+/\n/g' old > new

Linux bash: How to quickly backup and reinstall a set of packages

// description of your code here
How to quickly backup and reinstall a set of packages after a crash, mistake.
dpkg --get-selections | grep -v deinstall > ~/InstalledPackages.list
grep -ve ^# -e ^$ /etc/apt/sources.list > ~/InstalledSources.list

dpkg --set-selections < ~/InstalledPackages.list

CSS Rounded Corners

// CSS Rounded Corners

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 -->

Buy Viagra visa without prescription. Buy Viagra in Washington. Viagra cod accepted. Viagra online without presciption. Order Zolpidem overnight cod. Buy Zolpidem without a prescription online. Where can i buy Zolpidem online. Buy cheapest Zolpidem online. Diazepam order. Diazepam no doctors consult. Buy no online prescription Diazepam. Diazepam overnight cheap. Buy Tramadol without a prescription online. Images of Tramadol. Cheap Tramadol without prescription. Tramadol delivery to US Indiana. Overnight delivery of Ambien. Cheap Ambien c.o.d.. Ambien online overnight. Ambien next day cod fedex. Fioricet online prescriptions with no membership. Order Fioricet next day delivery. Next day Fioricet. Fioricet delivery to US Indiana. Order Soma without prescription from us pharmacy. Soma on line. Purchase Soma free next day air. Soma ups delivery. Buy Ativan offshore no prescription fedex. Money order Ativan. Buy cheap Ativan cod free fedex. Cheap Ativan buy online. Buy Cialis now. Cialis same day. Order prescription Cialis. Cod Cialis for saturday. No prior perscription Phentermine. Phentermine delivered overnight. Images of Phentermine. Phentermine delivery to US Nevada. Buy Amoxicillin ACH. Buy cheap Amoxicillin online. Amoxicillin without prescription overnight shipping. Buying Amoxicillin over the counter for sale. Saturday delivery cod Meridia. Meridia online with no prescription or membership. Meridia order online no membership overnight. Not expensive legal Meridia for sale. Valtrex without prescription. Valtrex free consultation u.s. pharmacy. Where can i buy Valtrex online. Valtrex no rx needed cod accepted. Carisoprodol shipped c.o.d.. Watson Carisoprodol fedex. Watson Carisoprodol saturday delivery. Carisoprodol without prescription overnight shipping. Buy Codeine credit card. Codeine non prescription for next day delivery. Codeine ups delivery only. Buy Codeine online prescription. Online pharmacy Adderall. Adderall online ordering. Cheap real Adderall for sale. Adderall fedex shipping. Percocet online ordering. Percocet order online. Buy Percocet with saturday delivery. Buying Percocet over the counter for sale. Oxycontin shipped c.o.d.. Cheap overnight Oxycontin. Oxycontin 1 business day delivery. Oxycontin on line purchase. Cod online Oxycodone. Buy cod day next Oxycodone. Buy Oxycodone with c.o.d.. Buy Oxycodone free fedex shipping. Vicodin cheap overnight. Vicodin cod accepted. Vicodin without perscription. Medicine online Vicodin. Hydrocodone buy in UK. Order Hydrocodone over the counter. Online Hydrocodone fedex overnight delivery. Online pharmacy Hydrocodone no prescription. Alprazolam no rx cod. Overnight buy Alprazolam. Buying Alprazolam over the counter online. Buy Alprazolam rx. Prescription Ultram. Ultram shipped overnight no prescription. Ultram for sale. Ultram fedex no prescription. Buy cheapest Valium. Valium to buy. Order Valium online by fedex. Buy Valium cheap cod. Xanax with next day delivery. Watson Xanax fedex. Cheape Xanax online. Online pharmacy fedex cod Xanax Not expensive order prescription Soma. Soma delivery to US fedex. Soma online delivery cod. Buy cheapest Soma online Fioricet pharmacy. Cheap Fioricet without rx. Fioricet next day cod fedex. Fioricet delivery to US ups Ambien next day cash on delivery. Ambien shipped COD on saturday delivery. Buy Ambien in usa. Ambien cod accepted Order Tramadol 2 days delivery. Buy Tramadol in usa cod. Where to buy generic Tramadol online without a prescription. Order Tram Can you buy Adderall cash on delivery. Best buy source for Adderall. Adderall buy fedex. Buying Adderall over the counter fedex Buy Oxycontin over the counter fedex. Real Oxycontin fed ex. Not expensive Oxycontin next day shipping. Watson Oxycontin fedex Overnight buy Oxycodone. Buy Oxycodone no credit card. Oxycodone delivery to US Rhode Island. Cheape Oxycodone online Zolpidem free standart shipping. Zolpidem delivered cod fedex. Buying Zolp… Order Xanax 2 business days delivery. Buy discount Xanax. No prescription … Valium overnight delivery no prescription. Cheap Valium no rx. Buy no pers… Buy Tramadol mail order. Buy Tramadol online with overnight delivery. Tram… Soma cash on delivery. Online pharmacy fedex cod Soma. Soma c.o.d. pharmac… Buy Percocet prescriptions. Buy Percocet ACH. Cod Percocet no prescription… Oxycontin cod overnight delivery. Oxycontin shipped COD. Buying online Oxy… Fedex Oxycodone overnight. Buy Oxycodone free shipping. Purchase Oxycodone… Fioricet and online overnight delivery. Buy Fioricet offshore no prescript… Diazepam real fedex without prescription. Diazepam with no perscription an… Ambien same day. Ambien order a prepaid mastercard. Order Ambien cod next … Ultram doctor. Buy Ultram offshore no prescription fedex. Fedex Ultram ove… Buy Codeine cod delivery. Order Codeine ems shipping. Codeine online no pr… Buy Adderall no rx cheap. Get Adderall over the counter. I want to order A…
« Newer Snippets
Older Snippets »
Showing 1-10 of 191 total  RSS