Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
WhatThisIS="""
This is a hacked together script to connect to all of your running EC2 instances, and to provide a single SSH prompt amongst all of them, and to assist in uploading, splitting, and downloading files. email me at winniningham at and email server called gmail.com :P
"""
import paramiko
from numpy import *
<!DOCTYPE html>
<html>
<head>
<title>JRuby IRB</title>
<meta charset="utf-8">
<style type="text/css">
.code {font-family: "Courier New", Courier, mono;}
</style>
</head>
<body>
estimatePi <- function(numDraws){
r <- .5 #radius... in case the unit circle is too boring
x <- runif(numDraws, min=-r, max=r)
y <- runif(numDraws, min=-r, max=r)
inCircle <- ifelse( (x^2 + y^2)^.5 < r , 1, 0)
return(sum(inCircle) / length(inCircle) * 4)
}
@atiw003
atiw003 / gist:731204
Created December 6, 2010 23:34 — forked from nahi/gist:730361
require 'java'
require 'twitter4j-core-2.1.8-SNAPSHOT.jar'
include_class 'twitter4j.TwitterFactory'
include_class 'twitter4j.http.AccessToken'
ck = "XXX"
cs = "XXX"
ak = "XXX"
as = "XXX"
0% jruby -rubygems trouble/twitter/twitter4j.rb
Rehearsal -----------------------------------------------
twitter gem 5.856000 0.000000 5.856000 ( 5.856000)
rubytter 5.844000 0.000000 5.844000 ( 5.845000)
twitter4j 1.730000 0.000000 1.730000 ( 1.730000)
------------------------------------- total: 13.430000sec
user system total real
twitter gem 4.850000 0.000000 4.850000 ( 4.850000)
rubytter 5.110000 0.000000 5.110000 ( 5.111000)
@atiw003
atiw003 / fastqc.sh
Created December 23, 2010 23:51 — forked from brentp/dnaa.sh
FASTQC_VERSION=0.4.3
SRCDIR=/usr/local/src/
cd $SRCDIR && mkdir -p fastqc && cd fastqc
wget http://www.bioinformatics.bbsrc.ac.uk/projects/fastqc/fastqc_v${FASTQC_VERSION}.zip
unzip fastqc_v${FASTQC_VERSION}.zip
cd FastQC && chmod a+x fastqc
#!/usr/bin/env python
# encoding: utf-8
"""
parse_delicious_xml.py
First download your bookmarks and restrict to specific tags if desired:
$ curl --user 'username':'password' -o delicious.xml 'https://api.del.icio.us/v1/posts/all'
Extract and count most common domains:
diff -Naur ../tmp/hadoop-0.20.1+169.68/src/contrib/cloud/src/py/hadoop/cloud/cli.py src/hadoop/src/contrib/cloud/src/py/hadoop/cloud/cli.py
--- ../tmp/hadoop-0.20.1+169.68/src/contrib/cloud/src/py/hadoop/cloud/cli.py 2010-03-18 17:29:55.000000000 -0700
+++ src/hadoop/src/contrib/cloud/src/py/hadoop/cloud/cli.py 2010-05-17 15:00:26.000000000 -0700
@@ -292,7 +292,7 @@
opt.get('public_key'), opt.get('user_data_file'),
opt.get('availability_zone'), opt.get('user_packages'),
opt.get('auto_shutdown'), opt.get('env'),
- opt.get('security_group'))
+ opt.get('security_group'), opt.get('spot_price'))
service.launch_master(template, config_dir, opt.get('client_cidr'))

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