Skip to content

Instantly share code, notes, and snippets.

View willie's full-sized avatar

Willie Abrams willie

View GitHub Profile
@dougalcorn
dougalcorn / copy_key.sh
Created November 5, 2010 20:05
Copy and append your public ssh key to a new host/account's authorized_keys file
#!/bin/sh
# Shell script to install your public key on a remote machine
# Takes the remote machine name as an argument.
# Obviously, the remote machine must accept password authentication,
# or one of the other keys in your ssh-agent, for this to work.
ID_FILE="${HOME}/.ssh/id_rsa.pub"
if [ "-i" = "$1" ]; then
@mataki
mataki / heroku_autoscalling.rb
Created December 2, 2010 06:33
Auto scalling dynos on heroku using NewRelic
=begin
Need to install gems heroku, newrelic_rpm
$ gem install heroku newrelic_rpm
Set your apps setting
app_name : heroku's app_name of auto scaling
license_key : NewRelic api key. You can get heroku's NewRelic admin console. "App setting" and "Agent configuration"
execute with cron every minutes
$ ruby ./adjust_dynos_with_newrelic.rb
@javan
javan / gist:1168475
Created August 24, 2011 16:32
Fix iPhone home button
Found this tip in comment here: http://www.tipb.com/2011/01/04/tipb-bug-home-button-working-iphone/
1.) Open any application
2.) Press and hold the power button until the slide to shutdown swipe bar appears.
3.) Release Power button
4.) Press and hold Home button Lightly
until screen returns to icon screen
@gregworley
gregworley / gist:1198903
Created September 6, 2011 20:45
almost lost
//http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html#PrivateContent_AuthExamples
//Amazon CloudFront Developer's Guide (API Version 2010-11-01) Using Amazon Cloudfront>Serving Private Content > Creating a Signed URL
package main
import (
"os"
"strconv"
"fmt"
"io/ioutil"
#!/bin/bash
#
# Throw this in your crontab.
#
# https://twitter.com/#!/manton/status/111893189971017729
#
[email protected]
CPU_THRESHOLD=1500
@cpatni
cpatni / app.rb
Created November 21, 2011 22:39
unique calculation using redis
require 'sinatra'
require 'redis'
require 'json'
require 'date'
class String
def &(str)
result = ''
result.force_encoding("BINARY")
@mikewadhera
mikewadhera / master-worker.go
Created December 18, 2011 03:40
example of master/worker pattern in Go (http://go-lang.org)
~/code/go/master-worker % ./master-worker
Sat Dec 17 19:43:08 PST 2011
Sat Dec 17 19:43:08 PST 2011
Sat Dec 17 19:43:08 PST 2011
Sat Dec 17 19:43:08 PST 2011
Sat Dec 17 19:43:08 PST 2011
Sat Dec 17 19:43:08 PST 2011
Sat Dec 17 19:43:08 PST 2011
Sat Dec 17 19:43:08 PST 2011
Sat Dec 17 19:43:08 PST 2011
@ntalbott
ntalbott / .gitignore
Created February 16, 2012 19:06
Downloads all of your Basecamp files for archiving
exports
@jboner
jboner / latency.txt
Last active July 13, 2025 02:09
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@johntyree
johntyree / getBlockLists.sh
Last active June 4, 2025 15:24
Make one large blocklist from the bluetack lists on iblocklist.com
#!/usr/bin/env sh
# Download lists, unpack and filter, write to stdout
curl -s https://www.iblocklist.com/lists.php \
| sed -n "s/.*value='\(http:.*=bt_.*\)'.*/\1/p" \
| xargs wget -O - \
| gunzip \
| egrep -v '^#'