Skip to content

Instantly share code, notes, and snippets.

@rweald
rweald / ruby-on-mountain-lion.md
Created August 13, 2012 02:28
Getting Ruby Up and Running on OSX Mountain Lion
  • Install the latest version of xcode from the App Store

  • Install the xcode command line tools. How To Guide

  • XCode no longer ships with gcc-4.2 as a separate executable as gcc is version 4.2. Therefore you need to symlink it so that ruby can find gcc-4.2.

    sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
    
@rweald
rweald / gist:3151173
Created July 20, 2012 14:59 — forked from igrigorik/gist:3148848
Convert any YouTube video into an audio file you can listen to on the go...
# Convert any YouTube video into an audio file you can listen to on the go, using:
# http://rg3.github.com/youtube-dl/
{ ~ } > brew install ffmpeg
{ ~ } > brew install ffprobe
{ ~ } > wget https://raw.github.com/rg3/youtube-dl/2012.02.27/youtube-dl
{ ~ } > chmod u+x youtube-dl
# Pick which video format you want to download.. (use any YT video link)
@rweald
rweald / build.sbt
Created March 24, 2012 18:22 — forked from mumoshu/build.sbt
DES and AES encryption in Scala
name := "DES and AES encryption in Scala"
version := "1.0"
scalaVersion := "2.9.1"
libraryDependencies += "commons-codec" % "commons-codec" % "1.6"
require 'aws-sdk'
require 'uuid'
require 'pry'
uuid = UUID.new
dynamo_db = AWS::DynamoDB.new(:access_key_id => "AKIAJLGFC545YHHWOD3A", :secret_access_key => "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")
dynamo_db.tables.each { |t| puts t.name }
tweets_db = dynamo_db.tables["tweets"]
@rweald
rweald / install_macvim.sh
Created January 11, 2012 05:46
A very basic shell script to install MacVim and setup a custom configuration
#!/bin/bash
echo "removing old versions installed by homebrew"
brew remove macvim
rm /usr/local/bin/mvim
echo "Downloading MacVim Application"
cd ~/Downloads
curl -L "https://github.com/downloads/b4winckler/macvim/MacVim-snapshot-64.tbz" -o macvim.tbz
@rweald
rweald / mongo_tweet_health_spike.rb
Created October 26, 2011 04:12
A simple script that grabs some health related tweets and stores them in mongodb
require 'mongo'
require 'tweetstream'
db = Mongo::Connection.new("dbh13.mongolab.com", "27137").db("ch-diabetes-demo")
auth = db.authenticate("surfandcode", "irNwHfB3udTEpk9z")
collection = db.collection("diabetic_tweets")
stream = TweetStream::Client.new("commithealth", "SDSF202e")
@rweald
rweald / gist:1301763
Created October 20, 2011 17:40
Way to get colored bash prompt based on git status
#configuration for my bash prompt
prompt_function() {
local BLACK='\[\033[0;30m\]'
local LIGHT_BLACK='\[\033[1;30m\]'
local RED='\[\033[0;31m\]'
local LIGHT_RED='\[\033[1;31m\]'
local GREEN='\[\033[0;32m\]'
local LIGHT_GREEN='\[\033[1;32m\]'
local YELLOW='\[\033[0;33m\]'
local LIGHT_YELLOW='\[\033[1;33m\]'
@rweald
rweald / gist:1274276
Created October 9, 2011 22:12
How Twitter configures a tweet button with only markup
<script src="//platform.twitter.com/widgets.js" type="text/javascript"></script>
<div>
<a href="https://twitter.com/share" class="twitter-share-button"
data-url="https://dev.twitter.com/pages/tweet_button"
data-via="your_screen_name"
data-text="Checking out this page about Tweet Buttons"
data-related="anywhere:The Javascript API"
data-count="vertical">Tweet</a>
</div>
@rweald
rweald / gist:1251481
Created September 29, 2011 18:16
Installing Git on UCSD cs lab accounts
  1. Download the latest version of the git source
curl -O http://git-core.googlecode.com/files/git-1.7.6.4.tar.gz
  1. unpack git source
tar -xzf git-1.7.6.4.tar.gz
@rweald
rweald / goliath_redis_server_sent_events.rb
Created September 25, 2011 22:47
A simple Goliath server that sends data to client using SSE after receiving a message on a redis pubsub channel
require 'goliath'
require 'em-hiredis'
class EventGenerator < Goliath::API
def response(env)
redis = EM::Hiredis.connect
redis.subscribe(:one)