This file contains hidden or 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
def format_filename(s): | |
"""Take a string and return a valid filename constructed from the string. | |
Uses a whitelist approach: any characters not present in valid_chars are | |
removed. Also spaces are replaced with underscores. | |
Note: this method may produce invalid filenames such as ``, `.` or `..` | |
When I use this method I prepend a date string like '2009_01_15_19_46_32_' | |
and append a file extension like '.txt', so I avoid the potential of using | |
an invalid filename. | |
This file contains hidden or 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
## REF: http://blog.sbf5.com/?p=6 | |
# For requests starting with a tilde, break them into three components: | |
# 1. The username, everything after the tilde up to the first slash | |
# 2. The file location, everything after the username up to the last slash | |
# 3. The trailing slash(es) | |
# Then, rewrite to go to the f~/ branch. | |
location /~ { | |
if ($request_uri ~ ^/~([^/]*)(/.*[^/]|)(/*)$) { | |
set $homedir $1; | |
set $filedir $2; |
This file contains hidden or 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
import httplib | |
import urllib | |
import re | |
import os.path | |
def gist_write(name, content, ext=None, login=None, token=None): | |
if ext is None: | |
ext = os.path.splitext(name)[1] |
This file contains hidden or 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
// ==UserScript== | |
// @name Export Github Issues | |
// @namespace http://userscripts.org/users/tim | |
// @description Can export issues by state and label | |
// @include http://github.com/*/issues* | |
// ==/UserScript== | |
(function() { | |
var GITHUB_API_URL, GithubRequest, URL_EXPRESSION, formatOutput, menuCallback, repo, url, user; | |
URL_EXPRESSION = /^.*\/(.*?)\/(.*?)\/issues.*$/; | |
GITHUB_API_URL = 'http://github.com/api/v2/json'; |
This file contains hidden or 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
<?PHP | |
// Generates a strong password of N length containing at least one lower case letter, | |
// one uppercase letter, one digit, and one special character. The remaining characters | |
// in the password are chosen at random from those four sets. | |
// | |
// The available characters in each set are user friendly - there are no ambiguous | |
// characters such as i, l, 1, o, 0, etc. This, coupled with the $add_dashes option, | |
// makes it much easier for users to manually type or speak their passwords. | |
// | |
// Note: the $add_dashes option will increase the length of the password by |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>WebSocket Client</title> | |
<style> | |
#output { | |
border: solid 1px #000; | |
} | |
</style> | |
</head> |
This file contains hidden or 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
""" | |
Ubuntu update manager for Fabric | |
Checks for updates, installs them and reboots if needed across multiple servers | |
Create a "hosts" file alongside this fabfile and put your hosts in there one per line | |
Updating package list:: | |
fab update |
This file contains hidden or 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/env python | |
# | |
# Query the Steam master servers. | |
# | |
# See: http://developer.valvesoftware.com/wiki/Master_Server_Query_Protocol | |
# | |
# Koen Bollen <meneer koenbollen nl> | |
# 2010 GPL | |
# |
This file contains hidden or 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/env python | |
# | |
# Converts any integer into a base [BASE] number. I have chosen 62 | |
# as it is meant to represent the integers using all the alphanumeric | |
# characters, [no special characters] = {0..9}, {A..Z}, {a..z} | |
# | |
# I plan on using this to shorten the representation of possibly long ids, | |
# a la url shortenters | |
# |
This file contains hidden or 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
urxvt.perl-ext-common: default,tabbed,matcher,searchable-scrollback | |
urxvt*cutchars: "()*,<>[]{}|' | |
urxvt*termName: rxvt-unicode | |
urxvt*urlLauncher: iceweasel | |
urxvt*matcher.button: 1 | |
urxvt*keysym.S-Prior: ^[[5;2~ | |
urxvt*keysym.S-Next: ^[[6;2~ | |
urxvt*geometry: 100x30 | |
urxvt*highlightSelection: true |
OlderNewer