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
# default vim on osx doesn't have python, ruby support or clipboard support. These configure options add all that | |
# I also ran into problems using rvm ruby, had to include those libs in the LDFLAGS for vim | |
# Steps: | |
$ rvm install 1.9.1 | |
$ rvm use 1.9.1 # vim doesn't support anything higher | |
$ curl ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2 | tar xj | |
$ cd vim73 | |
$ ./configure --with-features=huge --enable-perlinterp=yes --enable-rubyinterp=yes --enable-pythoninterp=yes --enable-multibyte |
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
// allows: | |
// 1235554567 | |
// (123) 555-4567 | |
// 123.555.4567 | |
// 123-555-4567 | |
/^\(?[0-9]{3}[.\-\)]?\s?[0-9]{3}[.-\s]?[0-9]{4}$/ |
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
# a quick shell command to kill all procs matching a grep pattern | |
for i in `ps aux | grep 'manage.py runserver' | grep -v grep | awk '{ printf "%s ", $2 }'` ; do sudo kill $i ; done |
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
# Just a note to myself on how to archive a website | |
mkdir tourbie_archive | |
cd tourbie_archive | |
wget --mirror -p -nH -e robots=off --convert-links http://tourbie.com | |
# --mirror mirrors the site (recurses all links) | |
# -p downloads all the links necessary to view the site | |
# --convert-links converts all links starting with http://tourbie.com to be relative | |
# -e robots=off optional, ignore robots.txt (on tourbie.com, I had disallowed the static files directory in robots.txt) |
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
class TestHandler(WebMessageHandler): | |
""" Testing out sending data to arbitrary websockets | |
""" | |
def get(self): | |
ws_message = "I like websockets" | |
to_user_id = self.get_argument('to_user_id') | |
if not to_user_id: | |
body = "enter arg ?to_user_id=X" | |
else: | |
conn_ids = WSSession.get_active_conn_ids(to_user_id) |
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/env python | |
""" Converts all the .xml files back to .als (i.e. gzips them) | |
""" | |
import os | |
import sys | |
import subprocess | |
import gzip |
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/env python | |
""" A pre-commit git hook that gunzips the .als file and adds the resulting xml file to the git staging index. | |
Caveat: | |
It doesn't work perfectly to do a `git add` in a pre-commit hook - if nothing else in the repo has changed, | |
the pre-commit won't even be fired so nothing happens. If something else has changed, the pre-commit hook | |
doesn't get fired in time for the files it creates to show up in the list of files to be committed but the | |
files it creates do actually go into the commit. So it works, but that's kind of weird. |
NewerOlder