Skip to content

Instantly share code, notes, and snippets.

View whalesalad's full-sized avatar
🐟
i've seen more spine in jellyfish

Michael Whalen whalesalad

🐟
i've seen more spine in jellyfish
View GitHub Profile
@flaneur2020
flaneur2020 / Gemfile
Created February 8, 2012 02:27
less painful web prototyping with sinatra, slim, sass, and coffeescript
source 'http://ruby.taobao.org'
gem 'sinatra'
gem 'sinatra-reloader'
gem 'slim'
gem 'sass'
gem 'coffee-script'
gem 'compass'
gem 'pry'
@stephenlauck
stephenlauck / joyent-smartos-base64-1.8.1.erb
Created October 4, 2012 22:08
Joyent SmartOS Base64 1.8.1 Knife Bootstrap
# Joyent SmartOS Base64 1.8.1
# shove this in ~/.chef/bootstrap/joyent-smartos.erb
# run knife bootstrap <hostname> -d joyent-smartos
bash -c '
if [ ! -f /opt/local/bin/chef-client ]; then
pkgin -f update
pkgin -y install gcc47 gcc47-runtime scmgit-base scmgit-docs gmake ruby193-base ruby193-yajl ruby193-nokogiri ruby193-readline emacs-nox11 pkg-config
gem update --system
gem install --no-ri --no-rdoc ohai
@bontoJR
bontoJR / notify.rb
Created December 12, 2012 20:46
Basic APN server built on top of Sinatra
# notify.rb
require 'sinatra/base'
require 'sinatra/json'
require 'grocer'
class App
attr_accessor :bundleID, :pusher_dev, :pusher_prod
end
#!/bin/bash
sudo kextunload -b org.virtualbox.kext.VBoxUSB
sudo kextunload -b org.virtualbox.kext.VBoxNetFlt
sudo kextunload -b org.virtualbox.kext.VBoxNetAdp
sudo kextunload -b org.virtualbox.kext.VBoxDrv
sudo kextload /Library/Extensions/VBoxDrv.kext -r /Library/Extensions/
sudo kextload /Library/Extensions/VBoxNetFlt.kext -r /Library/Extensions/
sudo kextload /Library/Extensions/VBoxNetAdp.kext -r /Library/Extensions/
@sobrinho
sobrinho / track_habtm_changes.rb
Last active December 21, 2015 12:58
Track habtm changes on active record
# See https://groups.google.com/forum/#!topic/rubyonrails-core/Lb9rBkZnZSo
module TrackHabtmChanges
def self.included(model)
model.after_initialize :track_habtm_initial_state
model.after_save :track_habtm_initial_state
end
def changes
super.merge(habtm_changes)
end
@0x0dea
0x0dea / process_gsub.rb
Created April 26, 2015 23:08
Process.gsub lets you search and replace within your process's live memory!
def Process.gsub pat, sub
mem = File.open('/proc/self/mem', 'r+')
maps = File.open('/proc/self/maps')
maps.each do |map|
from, to, perms, offset = map.scan(/(\h+)-(\h+) (\S+) (\h+)/)[0]
if perms['rw']
from, to = [from, to].map { |addr| addr.hex + offset.hex }
data = mem.tap { |m| m.seek from }.read(to - from) rescue next
@andrewjmead
andrewjmead / app.js
Last active December 22, 2016 03:41
An AngularJs directive for smart inline editing.
/* demo app that uses the inline directive */
var myApp = angular.module('inlineDemo', ['inline']);
myApp.config(function ($routeProvider) {});
myApp.controller('names', function ($scope) {
console.log('controller');
$scope.masterName = $scope.name = '46';
@zefer
zefer / copy-s3-bucket.rb
Created April 4, 2011 11:24
Copy contents of an S3 bucket to a another bucket using an EC2 instance and a simple Ruby script. Useful for transferring large amounts of data and will work across geographic regions.
require 'rubygems'
require 'right_aws'
aws_access_key_id = 'your-access-key'
aws_secret_access_key = 'your-secret-key'
target_bucket = 'your-source-bucket'
destination_bucket = 'your-destination-bucket'
s3 = RightAws::S3Interface.new(aws_access_key_id, aws_secret_access_key)
#!/bin/bash
### BEGIN INIT INFO
# Provides: disable-transparent-hugepages
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Disable Linux transparent huge pages
# Description: Disable Linux transparent huge pages, to improve
# database performance.
### END INIT INFO
@idStar
idStar / UWFacebookService.m
Created August 30, 2012 16:47
Facebook Utility class to determine if logged in or not
#import "UWFacebookService.h"
@implementation UWFacebookService
// Static
static const int ddLogLevel = LOG_LEVEL_DEBUG;
// Strong
@synthesize facebookGraphUser = _facebookGraphUser;