Skip to content

Instantly share code, notes, and snippets.

View itguy51's full-sized avatar

Rebecca Pruim itguy51

  • San Diego, California
View GitHub Profile
@itguy51
itguy51 / filer.rb
Created December 17, 2011 20:32
Git-Based file management written in Ruby
#!/usr/bin/env ruby
require 'rubygems'
require 'grit'
include Grit
#Assume that the repo exists in some way or another, if not, create it.
if(FileTest.exists?('repo.git'))
repo = Repo.new('repo.git')
else
repo = Repo.init_bare('repo.git')
end
@itguy51
itguy51 / gist:1491937
Created December 18, 2011 00:37 — forked from cookbooks/gist:731502
Grit clone example
# Since Git is well structured, Grit uses a method missing (Grit::Git#method_missing) to 'systematically' execute Git commands:
require 'grit'
include Grit
gritty = Grit::Git.new('/tmp/filling-in')
gritty.clone({:quiet => false, :verbose => true, :progress => true, :branch => '37s'}, "git://github.com/cookbooks/cc-aws.git", "/tmp/cc-aws2")
# => "Initialized empty Git repository in /tmp/cc-aws2/.git/\n"
Dir.entries('/tmp/cc-aws2').size
#wellp.
@itguy51
itguy51 / server.js
Created December 20, 2011 07:04
Google Translate iOS App Proxy Breaker
var http = require('http');
var sys = require('util');
http.createServer(function (request, response) {
data = "";
useSecl = false;
url = request.url;
transURI = "http://translate.google.com";
if (url.indexOf(transURI) > -1) {
e = url.replace(transURI, "");
http.get({
@itguy51
itguy51 / put.php
Created October 16, 2012 02:57
Put a base-64 file somewhere.
<?php
$file = $_GET['file'];
$data = $_POST['data'];
$data = base64_decode($data);
$fh = fopen($file, 'w') or die("false");
fwrite($fh, $data);
fclose($fh);
echo "true";
?>
@itguy51
itguy51 / circos-install.sh
Created October 20, 2012 02:02
Install Circos Visualization in one step.
#!/bin/sh
#Okay, Do local stuff to get GD going...
echo "Beginning Ubunutu-Like only step. Any following command not found errors may not be of any concern."
sudo apt-get install libgd-gd2-perl
echo "Ubuntu-Like only step finished/passed."
wget http://circos.ca/distribution/circos-0.62.tgz
tar -xvf circos-0.62.tgz
cd circos-0.62
cd bin
#Quick install of dependencies...
@itguy51
itguy51 / definer.py
Created November 26, 2012 06:27
Python Stuff.
import urllib2
import io
import HTMLParser
defs = ["Genotype", "Phenotype", "epistasis", "Co-dominance", "incomplete dominance", "autosomal", "dominant", "recessive", "prokaryote", "pleiotropy", "genetic pre-determinism", "Punnet square", "Gregor Mendel", "sexual dimorphism", "heterozygous", "homozygous", "allele"]
unef = []
for i in defs:
try:
url = "http://www.google.com/dictionary/json?callback=dict_api.callbacks.id100&q=" + i + "&sl=en&tl=en&restrict=pr%2Cde&client=te"
json = urllib2.urlopen(url).read()
(true,false,null) = (True,False,None)
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_US]=/home/team4014/st2/Icon/256x256/sublime_text.png
Name[en_US]=Sublime Text 2
Exec="/home/team4014/st2/sublime_text"
Name=Sublime Text 2
@itguy51
itguy51 / mainGBcss.css
Created March 28, 2013 03:12
GarageBand-Style Time Bar in CSS
#mainBar{
background: rgb(203,203,203); /* Old browsers */
background: -moz-linear-gradient(top, rgba(203,203,203,1) 0%, rgba(154,155,154,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(203,203,203,1)), color-stop(100%,rgba(154,155,154,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(203,203,203,1) 0%,rgba(154,155,154,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(203,203,203,1) 0%,rgba(154,155,154,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(203,203,203,1) 0%,rgba(154,155,154,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(203,203,203,1) 0%,rgba(154,155,154,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cbcbcb', endColorstr='#9a9b9a',GradientType=0 ); /* IE6-9 */
}
@itguy51
itguy51 / todna.rb
Created April 20, 2013 00:01
Convert binary to Base Pairs (Experimental, for encoding files to DNA - Related to my Internship)
#There are 4 bases in DNA (ATGC)
#There are 4 combinations of 2 bits.
class String
def is_i?
!!(self =~ /^[-+]?[0-9]+$/)
end
end
puts "Autodetecting type of input..."
inp = ARGV[0]
if inp.is_i?
require 'matrix'
def parseMatrixCols(matrixInput)
columnCount = (0..matrixInput.column_count-1)
colsWithBraces = []
columnCount.each do |n|
proc = matrixInput.column(n)
if proc.include?(1)
colsWithBraces.push(n)