Skip to content

Instantly share code, notes, and snippets.

View joar's full-sized avatar
:bowtie:
Not wearing a bowtie

Joar Wandborg joar

:bowtie:
Not wearing a bowtie
View GitHub Profile
@joar
joar / base_conversion.py
Last active August 29, 2015 14:14
Convert an integer to an arbitrary base, with examples
def to_base(integer, base_list=None):
"""
Convert an integer to an arbitrarily-represented arbitrary-base number
system.
The base representation must be defined in the `base list` parameter.
The base is taken from the length of the list.
:param integer: Base 10 int()
:type integer: int()
from pygments.formatter import Formatter
import json
class Formatter(Formatter):
name = 'JSON'
aliases = ['json']
filenames = []
def format(self, tokensource, outfile):
arr = []
@e000
e000 / pyimage.py
Created January 23, 2011 06:09
ascii -> png
"""
Python IRC ASCII to image script by e (e@tr0ll.in)
"""
import Image, ImageFont, ImageDraw
import time, re
_strip_colors_regex = re.compile('(\x03([0-9]{1,2})(,[0-9]{1,2})?)|[\x0f\x02\x1f\x03\x16]').sub
def strip_colors(string):