Skip to content

Instantly share code, notes, and snippets.

View gosuri's full-sized avatar

Greg Osuri gosuri

View GitHub Profile
@gosuri
gosuri / move_to_rds.rb
Created January 20, 2012 08:13 — forked from guenter/move_to_rds.rb
A quick and dirty script to move a database into Amazon RDS (or any other database). Can transfer part of the data beforehand.
require 'fileutils'
start_time = Time.now
SOURCE_DB = {
:name => 'db_name',
:user => 'db_user',
:password => 'db_pass',
:host => 'localhost'
@gosuri
gosuri / nginx-unicorn.md
Created February 3, 2012 22:36
nginx with unicorn

nginx with unicorn (On Ubunty Lenny)

Nginx Installation

sudo apt-get install nginx
$(document).ready(function(){
$("#new.btn").live("click",function(event){
event.preventDefault();
window.router.newNote();
});
$("#delete.btn").live("click",function(event){
event.preventDefault();
window.currentNote.destroy();
window.router.index();
@gosuri
gosuri / gist:2969634
Created June 22, 2012 01:06 — forked from dalibor/gist:1534053
Stop words
a
about
above
across
after
afterwards
again
against
all
almost
@gosuri
gosuri / setup.md
Last active December 13, 2015 19:39
Mountain Lion Setup with RVM + Homebrew

Instructions for setting up RVM on Mountain Lion

Homebrew and RVM

Install XCode

  • Update to the latest XCode 4.4 from the App Store
  • Install the Command Line Tools
@gosuri
gosuri / add.s
Last active December 13, 2015 22:08
SAL code to add real numbers FloatX and FloatY using only fixed point operations.
.data
# Inputs
FloatX: .float 134.0625
FloatY: .float 2.25
# Result
Float_X_plus_Y: .float
@gosuri
gosuri / wikiscraper.rb
Created March 7, 2013 22:19
The Wikipedia API blows, writing this was faster
require 'open-uri'
require 'nokogiri'
# Scrapes wikipedia content for stack
# The API blows, writing this was faster
class WikiImporter
# Words rejected will excluded from the results
REJECT_WORDS = [
"Comparison of web application frameworks",
@gosuri
gosuri / dfs.rb
Last active December 14, 2015 17:59
Recursive depth-first search (DFS) for traversing a graph in ruby.
# Depth-first search (DFS) is an algorithm for traversing or
# searching a tree, tree structure, or graph. One starts at
# the root (selecting some node as the root in the graph case)
# and explores as far as possible along each branch before backtracking.
#
# A graph can be represented by its adjacency matrix G,
# where G[i][j] == 1 if there is an edge between
# vertices i and j and 0 otherwise.
#
# Below Graph in diagram http://i.imgur.com/sV1UzUn.png
@gosuri
gosuri / dfs.asm
Last active September 21, 2016 22:27
Depth-first search (DFS) is an algorithm for traversing or searching a tree, tree structure, or graph. One starts at the root (selecting some node as the root in the graph case) and explores as far as possible along each branch before backtracking. A graph can be represented by its adjacency matrix G, where G[i][j] == 1 if there is an edge betwe…
.data
Graph: .word 0,1,1,0,0,1,1,0,0
.word 1,0,0,0,0,0,0,0,0
.word 1,0,0,0,0,0,0,0,0
.word 0,0,0,0,1,1,0,0,0
.word 0,0,0,1,0,1,1,0,0
.word 1,0,0,1,1,0,0,0,0
.word 1,0,0,0,1,0,0,0,0
.word 0,0,0,0,0,0,0,0,0
.word 0,0,0,0,0,0,0,0,0
# Converting Still Images to Video
# ================================
# depends on ImageMagick and ffmpeg
#
mkdir temp
cp *.jpg temp/.
mogrify -resize 800x800 temp/*.jpg
convert temp/*.jpg -delay 10 -morph 10 temp/%05d.jpg
ffmpeg -r 25 -qscale 2 -i temp/%05d.jpg output.mp4
# rm -R temp