Skip to content

Instantly share code, notes, and snippets.

View hrickards's full-sized avatar

Harry Rickards hrickards

View GitHub Profile
@hrickards
hrickards / himym.sh
Created July 22, 2011 12:32
Finds, moves, renames and lowercases downloaded How I Met Your Mother videos
cd /home/harry/Downloads/complete
mv \[180*\]-\[FULL\]-\[*.teevee\@EFNet\]-\[\ How.I.Met.Your.Mother*/*.avi /home/harry/Videos/How_I_Met_Your_Mother/
cd /home/harry/Videos/How_I_Met_Your_Mother
for file in *ow.*.*et.*our.*other* ; do mv $file `echo $file | cut -d. -f6`'.avi' ; done
for f in `find`; do mv -v $f `echo $f | tr '[A-Z]' '[a-z]'`; done
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
.image_box {
color: #696969;
}
.image_box .left {
text-align: left;
#!/bin/bash
cd
yum install -y git httpd bash curl libxslt gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 libcurl-devel apr-devel httpd-devel
rm -rf /var/www/*
rm -f /etc/httpd/conf.d/welcome.conf
rm -f /etc/httpd/conf/httpd.conf
touch /etc/httpd/conf/httpd.conf
curl https://raw.github.com/gist/1130403 >> /etc/httpd/conf/httpd.conf
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
/usr/local/rvm/bin/rvm install 1.9.2
#!/usr/bin/ruby
require 'humanize'
require 'open-uri'
(2..99).each do |number|
filename = "map_marker_#{number.humanize.gsub('-', '_')}.png"
url = URI.parse URI.encode("http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=#{number}|FF776B")
open(filename, 'wb') do |file|
file << open(url).read
end
@hrickards
hrickards / mandelbrot.html
Created January 30, 2012 16:54
Mandelbrot Canvas
<html>
<head>
<script type="text/javascript">
window.onload = function() {
var mandelbrotCanvas = document.getElementById('mandelbrotCanvas');
var context = mandelbrotCanvas.getContext('2d');
var width = mandelbrotCanvas.width;
var height = mandelbrotCanvas.height;
@hrickards
hrickards / mandelbrot.html
Created January 31, 2012 11:04 — forked from mchapman/mandelbrot.html
Mandelbrot Canvas
<html>
<head>
<script type="text/javascript">
window.onload = function() {
var mandelbrotCanvas = document.getElementById('mandelbrotCanvas');
var context = mandelbrotCanvas.getContext('2d');
var width = mandelbrotCanvas.width;
var height = mandelbrotCanvas.height;
@hrickards
hrickards / scrape.rb
Created September 30, 2012 12:29
Code for talk at #bcb7. Slides at https://speakerdeck.com/u/hrickards/p/bcb7
require 'rubygems'
require 'open-uri'
require 'pp'
require 'mechanize'
require 'mongo'
require 'progressbar'
require 'pry'
MONGO = Mongo::Connection.new.db('bcb7')
// Mostly copied from http://bost.ocks.org/mike/nations/
// Various accessors that specify the four dimensions of data to visualize.
function x(d) { return d.x; }
function y(d) { return d.y; }
function radius(d) { return d.radius; }
function color(d) { return d.color; }
function key(d) { return d.name; }
// Chart dimensions.
@hrickards
hrickards / crack.py
Created October 24, 2013 18:30
Files for cracking substitution ciphers.
#!/usr/bin/pypy
# Change the above #! if you want to use python (slower) rather than pypy
import random, re, sys, math
from segment import segment
# Usage: ./crack.py ciphertext
# where ciphertext is (you guessed it) a plaintext file containing the
# ciphertext
@hrickards
hrickards / removal1.rb
Created November 25, 2013 13:20
Code for TFIDF-based algorithm for obtaining relevant research topics for Rewired State GTR hackathong
filter = Stopwords::Snowball::Filter.new "en"
unique_words = filter.filter(unique_words).uniq