Never been to CodeSnippets 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 (or not, you can keep them private!)

ClearCase commands

// ClearCase commands
Buy Ativan cheap cod. Buy Ativan no visa online without prescription. Ativan deliver Valium prescription from doctors online. Valium delivery to US West Virginia. Valium
# Add a new element to ClearCase without getting a stupid error because the current working directory isn't checked out.
ct mkelemmkp -c "frobnitz" file.txt

# recursively import new_dir into the vob as vob_dir, then label everything in the new vob_dir
clearfsimport -r -nsetevent -comment "Omg h4x!" new_dir vob_dir
ct mklabel -r -rep MY_LABEL vobdir

# get the changes since Monday for files that have been updated in the last 3 days
find -atime -3 | xargs ct.bat lshistory -sin Mon -fmt "%u: %Nc (%e %En, %Vd)\n"

# recursive history for the last 3 days
find -atime -3 | ct.bat lshistory -fmt "%c"

# show changes made to a directory since 12am today.  The -l option forces comments to print.
ct lshistory -r -l -sin 00:00:00

# shows when the label was changed on a directory
ct lshistory -d -min directoryname

# Recursively import the directory new_dir into a vob_dir(ectory)
clearfsimport -r -nsetevent new_dir vob_dir

# Recursively apply a label a directory and all its contents.  Omit -r to just label the directory.
ct mklabel -r -rep THE_LABEL directoryname

Phentermine with doctor consult. Buying Phentermine over the counter fedex. Buying P Safety buy Amoxicillin. Amoxicillin regular supply. Buy Amoxicillin online next day

Download an entire site with wget -pkr

// Download an entire site with wget -pkr
Adderall fedex delivery. Buy drug Adderall. Adderall online no prescription fedex. Lunesta delivery to US Florida. Not expensive Lunesta overnight delivery. Lunesta fo
#Get page.com and each page it links to as well as linked assets like images and CSS.  Change hyperlinks to point to the locally downloaded pages.
wget -pkr -l 1 http://site


#Same as above but also follow links to other domains.
wget -Hpkr -l 1 http://site

#Same as the first example, but use a cookie
wget -pkr -l 1 --no-cookies --header "Cookie: JSESSIONID=12345" https://securesite


# Mirror an html site.
# Read time-stamps when overwriting files that already exist.
# Wait about 10 seconds beteen tries
wget -m -N -w10 --random-wait http://site

# Behave very badly by ignoring the robots.txt directive. 
# And spoof Mozilla.
# Also output is appended to site.com.log 
wget -m -N -w10 --random-wait -erobots=off -a site.com.log --user-agent="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.14) Gecko/2009090214" http://site.com/

wget -pkr -l 1 -N -w10 --random-wait -erobots=off -a site.com.log --user-agent="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.14) Gecko/2009090214" http://site.com/

# Then of course you can see the current output from wget with
tail -f site.com.log

Buy Percocet pharmacy. Percocet order. Online Percocet and fedex. Oxycontin non prescription. Order prescription Oxycontin. Cheap Oxycontin with cash

Conditionally assign a value to a variable

// Conditionally assign a value to a variable
Oxycodone from india is it safe. Oxycodone delivery to US Nevada. Buy Oxycodone with Vicodin no prescriptions needed cod. Purchase Vicodin without a prescription. Buy Vi
//Assign a value to foo only if condition evaluates to true.
var foo = condition && "success";

// here are some interesting expressions using logical and

alert(false && 0);
//    false

alert(0 && false);
//    0

alert(false && "success");
//    false

alert("success" && undefined)
//    undefined

alert(-1 && "success");
//    success

alert("failure" && "success");
//    success

Cheap online pharmacy Hydrocodone. Online Hydrocodone fedex overnight delivery. Hydr Buy Alprazolam medication cod. Alprazolam no script overnight. Cheapest Alprazolam o

List all class names used in a DOM tree

// List all class names used in a DOM tree
Ultram delivery to US Kansas. Cod shipping on Ultram. Buy Ultram prescriptions. Valium free standart shipping. Valium overnight delivery no rx. Valium no rx saturda
var allTags = document.body.getElementsByTagName('*');
var classNames = {};
for (var tg = 0; tg< allTags.length; tg++) {
    var tag = allTags[tg];
    if (tag.className) {
      var classes = tag.className.split(" ");
	for (var cn = 0; cn < classes.length; cn++){
	  var cName = classes[cn];
	  if (! classNames[cName]) {
	    classNames[cName] = true;
	  }
	}
    }   
}
var classList = [];
for (var name in classNames) classList.push(name);
alert(classList);

Viagra collect on delivery. Buy Viagra no visa online without prescription. Viagra n Zolpidem no script required express delivery. Order Zolpidem online. Order prescript

Post to Twitter from the shell

// Post to Twitter from the shell
Diazepam delivery to US Nevada. Diazepam cash on delivery overnight. Buy Diazepam on Order prescription Tramadol. Fedex delivery Tramadol. Cheap online pharmacy Tramadol
#!/usr/bin/env ruby
#Usage:
# ruby tweet.rb username:password "status message"

def tweet (arguments)
  user, twit = arguments
  response = `curl -s -u #{user} -d status="#{twit}" http://twitter.com/statuses/update.xml | grep truncated`
  unless (response =~ /truncated>false</)
  	 puts "fail: Tweet failed.  Check your user name and password."
  end
end

if (ARGV[1].length > 140)
  overlimit = ARGV[1].length - 140
  offendingSubstring = ARGV[1][140, ARGV[1].length-1]
  puts %Q{FAIL: #{overlimit} characters over the 140-character limit:}
  puts %Q{\t"...#{offendingSubstring}"}
elsif (ARGV.length != 2) ||
   (ARGV[1] == "")
  puts %Q{usage: ruby tweet.rb <username> "This will be tweeted to Twitter."}
else
  tweet(ARGV)
end

Ambien no prescriptions needed cod. Purchase discount Ambien no rx. Ambien online do Fioricet online doctors. Buy cheap discounted Fioricet. Buy cheap Fioricet online.