Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View dylanfareed's full-sized avatar

Dylan Fareed dylanfareed

View GitHub Profile
"Simple mixer control 'PCM',0\n Capabilities: pvolume\n Playback channels: Front Left - Front Right\n Limits: Playback 0 - 127\n Mono:\n Front Left: Playback 127 [100%] [0.00dB]\n Front Right: Playback 127 [100%] [0.00dB]\nSimple mixer control 'Line',0\n Capabilities: pswitch\n Playback channels: Front Left - Front Right\n Mono:\n Front Left: Playback [on]\n Front Right: Playback [on]\nSimple mixer control 'Line DAC',0\n Capabilities: pvolume\n Playback channels: Front Left - Front Right\n Limits: Playback 0 - 118\n Mono:\n Front Left: Playback 71 [60%] [-23.50dB]\n Front Right: Playback 71 [60%] [-23.50dB]\nSimple mixer control 'Line Line2 Bypass',0\n Capabilities: volume\n Playback channels: Front Left - Front Right\n Capture channels: Front Left - Front Right\n Limits: 0 - 118\n Front Left: 71 [60%] [-23.50dB]\n Front Right: 71 [60%] [-23.50dB]\nSimple mixer control 'Line PGA Bypass',0\n Capabilities: volume\n Playback channels: Front Left - Front Right\n Capture channels: Front L

Keybase proof

I hereby claim:

  • I am dylanfareed on github.
  • I am dylanfareed (https://keybase.io/dylanfareed) on keybase.
  • I have a public key whose fingerprint is 6CFF 5039 7AE5 6D05 218D 57C2 A246 E4D0 BC77 E456

To claim this, I am signing this object:

Installing a Gem on Heroku from a Private GitHub Repo

Sometimes you want to use a gem on Heroku that is in a private repository on GitHub.

Using git over http you can authenticate to GitHub using basic authentication. However, we don't want to embed usernames and passwords in Gemfiles. Instead, we can use authentication tokens.

  1. Get an OAuth Token from GitHub

First you will need to get an OAuth Token from GitHub using your own username and "note"

@dylanfareed
dylanfareed / gist:3749650
Created September 19, 2012 13:20 — forked from iwasrobbed/gist:1032395
Amazon S3 Query String Authentication for Ruby on Rails
def generate_secure_s3_url(s3_key)
#
# s3_key would be a path (including filename) to the file like: "folder/subfolder/filename.jpg"
# but it should NOT contain the bucket name or a leading forward-slash
#
# this was built using these instructions:
# http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?S3_QSAuth.html
# http://aws.amazon.com/code/199?_encoding=UTF8&jiveRedirect=1
s3_base_url = MyApp::Application::S3_BASE_URL # i.e. https://mybucket.s3.amazonaws.com
# ----------------------------------------------------------------------
#
# Ruby adaptations of the Python code found in Toby Segaran's
# Programming Collective Intelligence book.
#
# http://www.romej.com/archives/590/programming-collective-intelligence-with-ruby
# steven.romej @ gmail (4 may 08)
# ----------------------------------------------------------------------
require 'rubygems'
require 'gsl'
users = { 1 => "Ben", 2 => "Tom", 3 => "John", 4 => "Fred" }
m = GSL::Matrix[
#Ben, Tom, John, Fred
[5,5,0,5], # season 1
[5,0,3,4], # season 2
[3,4,0,3], # season 3
[0,0,5,3], # season 4