Skip to content

Instantly share code, notes, and snippets.

@shazow
shazow / role-models.md
Last active October 13, 2023 16:55
List of my role models

List of my role models

People I want to be more like at this point in my life, in ambition, style, or personality.

  • gaben
  • @BillNye
  • @snowden
  • @jessfraz
  • @vitalikbuterin
@shazow
shazow / objects.py
Created May 5, 2012 20:09
Listopi snippets
# listopi/test/__init__.py
from unittest import TestCase
from pyramid import testing
from sqlalchemy import create_engine
from listopi.model import metadata, Session
class TestModel(TestCase):
def setUp(self):
@shazow
shazow / types-of-lists.md
Created April 22, 2012 22:28
Catalogue of the different kinds of lists we compose in our day-to-day lives.

Types of lists

Catalogue of the different kinds of lists we compose in our day-to-day lives

  • Bucket list

    Such as "Things to do before you die". Typically aspirational, completeable. Manual sorting (usually importance or desired completion order).

@shazow
shazow / build-latest.sh
Created March 4, 2012 20:45
Build my latest symlinked kernel and inject it into my bootloader.
#!/bin/sh
mount /boot
cd /usr/src/linux
make clean; make; make modules_install
NEW_KERNEL=$(readlink /usr/src/linux)
echo "Copying kernel: ${NEW_KERNEL}"
@shazow
shazow / create_project.sh
Created September 11, 2011 19:58
Setup deployment target for Nginx + Python/uWSGI + Supervisor + Git (for a Linode Stackscript)
#!/bin/bash
# Setup deployment target for Nginx + Python/uWSGI + Supervisor + Git
# From: https://gist.github.com/1210041
function usage() {
cat << EOF
Usage: $0 PROJECT_NAME [DOMAIN] [OPTIONS]
Options:
-y No prompts, assume yes to all.
@shazow
shazow / facebookapi.py
Created August 8, 2011 21:08
Make good HTTP API libraries really easily using urllib3.
from simpleapi import SimpleAPI
class FacebookError(Exception):
def __init__(self, type, message, response=None):
self.type = type
self.message = message
self.response = response
def __str__(self):
return "%s (%s)" % (self.type, self.message)
@shazow
shazow / twolever.py
Created March 20, 2011 18:22
Print all the people you're following on Twitter, for convenient grepping.
#!/usr/bin/env python
# Print all the people you're following on Twitter.
import webbrowser
import tweepy
import sys
def main():
# Twolever app
consumer_key, consumer_secret = 'd8BVP2w58kwnVxVT3BrrPQ', 'Wuelj9vieJgzpnfqGTxptYBqN9BT3SYHxQnRzeyBbxg'
@shazow
shazow / gist:847665
Created February 28, 2011 17:26
Pylons environment setup outside of paste. Useful for background tasks (like using turnip)
def setup(config_file='development.ini'):
from socialgrapple.config.environment import load_environment
from paste.deploy import loadapp
from routes.util import URLGenerator
from webtest import TestApp
from beaker.session import SessionObject
environ = {'HTTP_HOST': 'socialgrapple.com'}
wsgiapp = loadapp('config:' + config_file, relative_to='.')
config = load_environment(wsgiapp.config['global_conf'], wsgiapp.config['app_conf'])
@shazow
shazow / util.js
Created January 31, 2011 18:22
JavaScript utility functions I wrote and use often.
Function.prototype.bind = function(bind) {
var self = this;
return function () {
var args = Array.prototype.slice.call(arguments);
return self.apply(bind || null, args);
};
};
/** Geometry and vectors **/
@shazow
shazow / app_globals.py
Created January 23, 2011 22:50
My TurboMail integration with Pylons
"""The application's Globals object"""
from beaker.cache import CacheManager
from beaker.util import parse_cache_config_options
from myproject.lib.email import TurboMailer
class Globals(object):
"""Globals acts as a container for objects available throughout the
life of the application