This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
""" | |
A simple threaded caching HTTP proxy. | |
Hereward Cooper <[email protected]> | |
v0.1 | |
""" | |
LISTENPORT = 8000 | |
LISTENINT = '127.0.0.1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# based on the import script by icebreaker, which is based on mojombo's | |
# https://github.com/mojombo/jekyll/blob/master/lib/jekyll/migrators/wordpress.rb | |
# https://gist.github.com/303570 | |
# edited to rewrite image URLs to use my CloudFront URL | |
require 'rubygems' | |
require 'sequel' | |
require 'fileutils' | |
require 'yaml' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The Regex Game | |
Avi Bryant | |
This is a game for two programmers, although it's easy to imagine variations for more. | |
It can be played over email, twitter, or IM, but it's easy to imagine a custom web app for it, and I encourage someone to build one. | |
Each player starts by thinking of a regular expression. The players should decide beforehand on dialect and length restrictions (eg, has to be JavaScript-compatible and under 20 characters). | |
They don't reveal the Regex, but if playing over email etc, should send each other a difficult to brute force hash (eg bcrypt) of the Regex for later verification. | |
They do reveal two strings: one which the Regex will match, and one which it will not. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reconfigures ActionDispatch's TLD handling dynamically based on the request | |
# host, so you don't have to mess with config.action_dispatch.tld_length for | |
# cross-device testing using xip.io and friends | |
# | |
# Examples: | |
# use Rack::HostBasedTldLength, /xip\.io/, 5 | |
class Rack::HostBasedTldLength | |
def initialize(app, host_pattern, host_tld_length) | |
@app = app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mina/git' | |
# Basic settings: | |
# domain - The hostname to SSH to. | |
# deploy_to - Path to deploy into. | |
# repository - Git repo to clone from. (needed by mina/git) | |
# branch - Branch name to deploy. (needed by mina/git) | |
set :user, 'kurei' | |
set :domain, 'axcoto.com' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################################### | |
# | |
# This method takes a db connection url and returns rails | |
# config YAML | |
# | |
########################################################## | |
require "uri" | |
require "yaml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This configuration will set up a database (db) and a web server (web) VM. | |
# Assumes the use of VirtualBox 4.3.14-95030 as a provider. | |
# Uses vagrant-vbguest plugin (https://github.com/dotless-de/vagrant-vbguest) | |
# to keep VirtualBox Guest Addition wrangled. | |
# Configuration | |
# Machine-specific configuration | |
DB_INSTALL_SCRIPT = "vagrant_data/db/install.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1) Create your private key (any password will do, we remove it below) | |
$ cd ~/.ssh | |
$ openssl genrsa -des3 -out server.orig.key 2048 | |
# 2) Remove the password | |
$ openssl rsa -in server.orig.key -out server.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
httpClient.DefaultRequestHeaders.Authorization = | |
new AuthenticationHeaderValue( | |
"Basic", | |
Convert.ToBase64String( | |
System.Text.ASCIIEncoding.ASCII.GetBytes( | |
string.Format("{0}:{1}", username, password)))); |
OlderNewer