Skip to content

Instantly share code, notes, and snippets.

View jcsalterego's full-sized avatar

Jerry Chen jcsalterego

View GitHub Profile
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
#
# Blacklist
#
-A INPUT -s 1.1.1.1 -j DROP
#
# Base rules
#!/usr/bin/env python
import locale
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
RACKSPACE_USER = 'YOUR_USERNAME_HERE'
RACKSPACE_KEY = 'YOUR_API_KEY_HERE'
HOURS_PER_MONTH = 730.484 # according to magical google calculator
DELIMITER = '\t'
Main things
- Uncheck natural scroll in Trackpad
- `defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool NO`
- Mission Control > Uncheck "Show Dashboard as space"
Other stuff
- upgrade/install xcode from app store
- reinstall macports https://distfiles.macports.org/MacPorts/MacPorts-2.0.4-10.7-Lion.dmg
- alias emacs='TERM=xterm-256color /opt/local/bin/emacs'
- install sweet color theme https://gist.github.com/2041274
(global-hl-line-mode 1)
(set-face-background 'hl-line "#262626")
(defun awesome-color-theme ()
(interactive)
(color-theme-install
'(awesome-color-theme
((background-color . "#000000")
(background-mode . light)
(border-color . "#1a1a1a")
> use regex_test;
switched to db regex_test
> db.foo.insert({text:/B[au]d/})
> db.foo.find({text:'Bud'})
> db.foo.find({text:/B[au]d/})
{ "_id" : ObjectId("4f3bd212883c17ef0ece43ad"), "text" : /B[au]d/ }
> db.foo.find({text:/B[ua]d/})
>
module Tern
module Db
module Reach
class Migration
attr_accessor :instance, :error
# Constructor
# * +instance+ :: Valid tern instance
def initialize(instance)
#!/bin/bash
#
# Throw this in your crontab.
#
# https://twitter.com/#!/manton/status/111893189971017729
#
BOSS=boss@example.org
CPU_THRESHOLD=1500
/**
* Binary Counter with 4 LEDs
*
* pin 8 -> 220 ohm -> green LED -> GND
* pin 9 -> 220 ohm -> yellow LED -> GND
* pin 10 -> 220 ohm -> red LED -> GND
* pin 11 -> 220 ohm -> blue LED -> GND
* pin 2 <- button <- 10K ohm <- GND
* <- +5V
*/
how to turn a grayscale image into an alpha-transparent graphic
===============================================================
originally i tried applying a grayscale image as a layer mask for a
base color, but there's no way to do that. can't copy and paste into
an existing layer mask either. one can only take an existing layer
and turn it into a clipping mask, which doesn't help here.
1. create layer with base color, e.g. black
2. create layer with grayscale image
$ irb
>> VERSION
=> "1.8.7"
>> /\//
=> /\//
>> Regexp.new('/')
=> /\//
>> Regexp.new('\/')
=> /\//
>> Regexp.new('/') == Regexp.new('\/')