Skip to content

Instantly share code, notes, and snippets.

@CerebralMastication
CerebralMastication / start-logon-ec2.sh
Created May 6, 2011 21:03
shell script for starting and logging onto an ec2 instance
#!/bin/bash
secGroup="sg-50681d39"
ami="ami-1aad5273"
keyName="ec2ApiTools"
keyLocation="/home/jal/Documents/AWS/ec2ApiTools_rsa_id"
instance_id=$(ec2-run-instances -k $keyName -g $secGroup -t m1.large $ami | awk '/INSTANCE/{print $2}')
echo $instance_id
@abhiyerra
abhiyerra / .muttrc
Created January 2, 2011 05:05
Mutt for Gmail
# Change the following six lines to match your Gmail account details
set imap_user = "[email protected]"
# set imap_pass = "PASSWORD"
set smtp_url = "smtp://[email protected]@smtp.gmail.com:587/"
# set smtp_pass = "PASSWORD"
set realname = "Abhi Yerra"
set from = "[email protected]"
@mja
mja / do-call-example.R
Created November 16, 2010 15:47
Using the ... arguments programmatically with do.call
do.call('+', list(1, 2))
# {{{
OAuth.R.License <-
'Copyright (c) 2010 OZAKI Toru (twittoru)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
# example of how to use a Guassian Copula to create random draws from
# normally distributed data
require("reshape")
require("plyr")
require("QRMlib")
require("Matrix")
#make this reproducable
set.seed(2)
@unruthless
unruthless / CSS for <sup> and <sub>
Created May 26, 2010 01:31
CSS for <sub> and <sup>
sub, sup {
/* Specified in % so that the sup/sup is the
right size relative to the surrounding text */
font-size: 75%;
/* Zero out the line-height so that it doesn't
interfere with the positioning that follows */
line-height: 0;
/* Where the magic happens: makes all browsers position
@erikeldridge
erikeldridge / example.rb
Created April 29, 2010 04:50
A utility for signing an url using OAuth in a way that's convenient for debugging
require 'oauth_util.rb'
require 'net/http'
o = OauthUtil.new
o.consumer_key = 'examplek9SGJUTUpocjZ5QjBJmQ9WVdrOVVFNHdSR2x1TkhFbWNHbzlNQS0tJnM9Y29uc3VtkZXJzZWNyZXQmeD0yYg--';
o.consumer_secret = 'exampled88d4109c63e778dsadcdd5c1875814977';
url = 'http://query.yahooapis.com/v1/yql?q=select%20*%20from%20social.updates.search%20where%20query%3D%22search%20terms%22&diagnostics=true';
@hadley
hadley / reproducible.md
Created January 6, 2010 17:33
How to write a reproducible example

How to write a reproducible example.

You are most likely to get good help with your R problem if you provide a reproducible example. A reproducible example allows someone else to recreate your problem by just copying and pasting R code.

There are four things you need to include to make your example reproducible: required packages, data, code, and a description of your R environment.

  • Packages should be loaded at the top of the script, so it's easy to see which ones the example needs.

  • The easiest way to include data in an email is to use dput() to generate

require 'feedzirra'
# fetching a single feed
feed = Feedzirra::Feed.fetch_and_parse("http://feeds.feedburner.com/PaulDixExplainsNothing")
# feed and entries accessors
feed.title # => "Paul Dix Explains Nothing"
feed.url # => "http://www.pauldix.net"
feed.feed_url # => "http://feeds.feedburner.com/PaulDixExplainsNothing"
feed.etag # => "GunxqnEP4NeYhrqq9TyVKTuDnh0"