Skip to content

Instantly share code, notes, and snippets.

# config/initializers/authlogic.rb
Authlogic::I18n.translator = FixedAuthlogicI18n::Translator.new
#!/usr/bin/env ruby
def format_method text, line
line.match /^(\s*)/
spaces = $1
text.match /^(\s*)([\w\d\s\_]+)\s*\((.*)\)/
formatted = "#{$2}(\n#{spaces}\t"
formatted += $3.
gsub(" ", "").
gsub(",", ",\n#{spaces}\t").
#
# Cookbook Name:: ruby
# Recipe:: default
#
DEFAULT_RUBY_VERSION = "1.8.7-p248"
script "installing rvm to ~/Developer" do
interpreter "bash"
code <<-EOS
HAI
BTW Cheater's quine
I HAS A quine
GIMMEH LINEZ quine OUTTA "quine.lol"
I HAS A loop_max ITZ ALL quine
I HAS A loop_index ITZ 0
IM IN YR loop
IZ loop_index LIEK loop_max O RLY?
YA RLY
@claylo
claylo / cf-invalidate.php
Created June 5, 2011 17:09
How to invalidate items in AWS CloudFront
<?php
/**
* Super-simple AWS CloudFront Invalidation Script
*
* Steps:
* 1. Set your AWS access_key
* 2. Set your AWS secret_key
* 3. Set your CloudFront Distribution ID
* 4. Define the batch of paths to invalidate
* 5. Run it on the command-line with: php cf-invalidate.php
anonymous
anonymous / auto-proxy
Created June 24, 2013 22:49
function FindProxyForURL(url, host)
{
//variabile
var proxy_US1 = "PROXY 173.234.241.98:81";
var proxy_UK1 = "PROXY 109.123.79.77:81";
var proxy_NL1 = "PROXY 95.211.138.75:81";
if (
host == "localhost" ||
shExpMatch(url, "*pixel.quantserve.com*") ||
shExpMatch(host, "localhost.*") ||
@maxim
maxim / rails_load_path_tips.md
Last active April 13, 2023 13:28
How to use rails load paths, app, and lib directories.

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

class Lazy < BasicObject
def initialize(&blk)
@blk = blk
end
def method_missing(name, *args, &blk)
_resolve.send(name, *args, &blk)
end
def respond_to?(name)
@emmaly
emmaly / gist:8267078
Created January 5, 2014 11:21
Bash script to automatically switch PulseAudio sink to Bluetooth headset on connect with A2DP profile and 50% volume.
#!/bin/bash
sink_name="bluez_sink.00_42_1B_AD_FA_CE"
if [ -z "$1" ]; then
dbus-monitor --system "path=/org/bluez/777/hci0/dev_00_42_1B_AD_FA_CE, interface=org.bluez.AudioSink, member=Connected" | while read line; do
echo $line
$0 1
done
else
@berg
berg / gist:9142463
Last active March 14, 2016 19:32
Comcast and Netflix now have a direct adjacency

Comcast and Netflix now have a direct adjacency

Looked at the host serving my Netflix streams today and noticed something new.

No clue if money is changing hands or not, and the return path is what actually matters, but it appears that Comcast and Netflix have reached some sort of agreement regarding direct interconnection.

$ traceroute -a 198.45.63.164
traceroute to 198.45.63.164 (198.45.63.164), 64 hops max, 52 byte packets
    (hops 1-2 redacted)