Skip to content

Instantly share code, notes, and snippets.

View kennethreitz's full-sized avatar
🐍

Kenneth Reitz kennethreitz

🐍
View GitHub Profile
@kennethreitz
kennethreitz / numbers.py
Created January 13, 2013 11:16
Spoken numbers and roman numerals
# -*- coding: utf-8 -*-
import sys
def int_to_roman(input):
"""
Convert an integer to Roman numerals.
Examples:
>>> int_to_roman(0)
@kennethreitz
kennethreitz / phabricator_readme.md
Last active December 10, 2021 16:45 — forked from sparrc/phabricator_readme.md
Phabricator Ubuntu Installation Guide

Phabricator Ubuntu 16.04 Installation Guide (Updated)

This is a supplement to the official Phabricator Installation Guide, because their guide will leave you with all kinds of permission and config errors and ~15,000 setup issues on startup.

Install Apache and php7.1

$ apt install apache2

$ sudo apt-get install -y python-software-properties

@kennethreitz
kennethreitz / helpers.py
Created June 24, 2010 18:38
Various Python helper functions
# encoding: utf-8
""" Python General Helpers
Copyright (c) 2010 Kenneth Reitz. Creative Commons Attribution 3.0 License.
"""
import urllib, re, time, sys
import paramiko
@kennethreitz
kennethreitz / link_header.py
Created July 24, 2011 22:12 — forked from mnot/link_header.py
link_header.py: HTTP Link header parsing
@kennethreitz
kennethreitz / gist:1294570
Created October 18, 2011 03:54 — forked from Miserlou/gist:1294412
Posting JSON in Python without Requests Library
1 import urllib2
2 import json
221 def basic_authorization(user, password):
222 s = user + ":" + password
223 return "Basic " + s.encode("base64").rstrip()
224
225 def submit_pull_request(user, repo):
226 auth = (settings.username, settings.password)
227 url = 'https://api.github.com/repos/' + user + '/' + repo + '/pulls'
kern.ostype = Darwin
kern.osrelease = 10.6.0
kern.osrevision = 199506
kern.version = Darwin Kernel Version 10.6.0: Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386
kern.maxvnodes = 132096
kern.maxproc = 532
kern.maxfiles = 12288
kern.argmax = 262144
kern.securelevel = 0
kern.hostname = taquito.local
@kennethreitz
kennethreitz / scales.py
Created July 15, 2018 18:01
a work in progress
class Tone:
MAX = 12
TONE_DICT = {
0: ("C",),
1: ("C#", "Db"),
2: ("D",),
3: ("D#", "Eb"),
4: ("E",),
5: ("F",),
6: ("F#", "Gb"),
@kennethreitz
kennethreitz / sync.py
Created October 10, 2010 19:08
GitHub Syncer. Clones or Pulls all GitHub repos (including watched list).
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Kenneth Reitz's GitHub Syncer
This script uses the GitHub API to get a list of all forked, mirrored, public, and
private repos in your GitHub account. If the repo already exists locally, it will
update it via git-pull. Otherwise, it will properly clone the repo.
It will organize your repos into the following directory structure:
@kennethreitz
kennethreitz / colors.sh
Last active September 22, 2019 14:39
Bash foreground ANSI terminal colors script.
#!/usr/bin/env bash
function bake_fg_color {
BLACK="\033[0;30m"
BLACK_BOLD="\033[1;30m"
WHITE="\033[0;37m"
WHITE_BOLD="\033[1;37m"
RED="\033[0;31m"
RED_BOLD="\033[1;31m"
GREEN="\033[0;32m"
import io
import os
import json
from tempfile import mkstemp
# import exifread
import PIL
import PIL.Image
import PIL.ExifTags