Skip to content

Instantly share code, notes, and snippets.

@jmoiron
jmoiron / crawler.py
Created May 27, 2011 20:37
Simple gevent/httplib2 web crawler.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Simple async crawler/callback queue based on gevent."""
import traceback
import logging
import httplib2
import gevent
@ncode
ncode / gsdproxy.py
Created July 10, 2011 16:01
gevent simple dynamic reverse proxy
#!/usr/bin/env python
from gevent import monkey
monkey.patch_all()
import sys
import redis
import urllib2
import traceback
from cgi import escape
# -- gsdproxy
@datagrok
datagrok / gist:2199506
Last active April 8, 2023 17:36
Virtualenv's `bin/activate` is Doing It Wrong
@ryin
ryin / tmux_local_install.sh
Last active April 23, 2024 01:06
bash script for installing tmux without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=1.8
@codelahoma
codelahoma / get-your-vim-on.md
Last active August 5, 2020 17:22
Get Your Vim On

Get Your Vim On

Rod Knowlton (@codelahoma)

Tulsa Web Devs - 8/20/2012

Last Updated: - 10/11/2013

First Things First

@dto
dto / rlx.el
Created November 19, 2012 18:48
RLX, early elisp prototype of Blocky
;;; rlx.el --- RLX development tools for GNU Emacs
;; Copyright (C) 2006, 2007, 2008 David O'Toole
;; Author: David O'Toole <dto@gnu.org>
;; Keywords: multimedia, games
;; Version: 0.81
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@MLnick
MLnick / sklearn-lr-spark.py
Created February 4, 2013 14:29
SGD in Spark using Scikit-learn
import sys
from pyspark.context import SparkContext
from numpy import array, random as np_random
from sklearn import linear_model as lm
from sklearn.base import copy
N = 10000 # Number of data points
D = 10 # Numer of dimensions
ITERATIONS = 5

TMUX - Single window group, multiple session.

So I have been using tmux for a while and have grown to like it and have since added many many customizations to it. Now once you start getting the hang of it, you'll naturally want to do more with the tool.

Now tmux has a concept of window-group and session and if you are like me you'll want multiple session that connects to the same window group instead of a new window group every time. Basically I just need different views into the same set of windows that I have already created, I don't want to create a new set of windows every time I fire up my terminal.

This is the default case if you simply use the tmux command as your login shell, effectively creating a new group of windows every time you start tmux.

This is less than ideal because, if you are like me, you fire up one-off terminals all the time and you don't want all those one-off jobs to stay running in the background. Plus sometimes you need information fro

// Usage : less2stylusDir('../src/css/');
var fs = require('fs');
// this less 2 stylus conversion script make a stylus easy to read syntax
// - let the braces
// - replace the @ for var as $
// - let semicolons
function less2stylus(less)
@andrewgleave
andrewgleave / gist:5362194
Created April 11, 2013 10:04
Mirror site to S3 using s3cmd and wget
#optionally create two buckets and serve from root, redirecting www
s3cmd mb --bucket-location=EU s3://example.com
s3cmd mb --bucket-location=EU s3://www.example.com
s3cmd ws-create --ws-index=index.html s3://example.com
s3cmd ws-create s3://www.example.com
#configure www redirect if necessary
wget --mirror -p --html-extension --convert-links -e robots=off -P . http://example.com
s3cmd put --recursive --exclude=".DS_Store" --acl-public example.com/ s3://example.com
#create hosted zones and redirect DNS