-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name := "DES and AES encryption in Scala" | |
version := "1.0" | |
scalaVersion := "2.9.1" | |
libraryDependencies += "commons-codec" % "commons-codec" % "1.6" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
puts "Please Enter Your MAC Address: " | |
mac = gets | |
mac = mac.strip | |
`sudo /bin/bash -lc "sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z && sudo ifconfig en0 ether #{mac}"` | |
puts "Congratulations you now have #{mac} as your MAC address" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
denominator = @xs.reduce(0) do |sum, x| | |
sum + ((x - x_mean) ** 2) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Days Online | Number of Views | |
---|---|---|
1 | 5500.0 | |
2 | 45000.0 | |
3 | 27500.0 | |
4 | 38000.0 | |
5 | 38500.0 | |
6 | 17000.0 | |
7 | 37500.0 | |
8 | 55000.0 | |
9 | 63500.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SimpleLinearRegression | |
def initialize(xs, ys) | |
@xs, @ys = xs, ys | |
if @xs.length != @ys.length | |
raise "Unbalanced data. xs need to be same length as ys" | |
end | |
end | |
def y_intercept | |
mean(@ys) - (slope * mean(@xs)) |