Skip to content

Instantly share code, notes, and snippets.

View arxanas's full-sized avatar
Busy with day job lately

Waleed Khan arxanas

Busy with day job lately
View GitHub Profile
arxanas /
Created January 28, 2016 20:22
# Linter for C++ imports (`using`s).
# Features:
# * Ensures that you don't use `std::foo` directly in your code, but rather
# mandates that you do `using std::foo` elsewhere.
# * Ensures that for every `using std::foo`, `foo` is used somewhere in your
# code. This is the killer feature because it helps you keep your `using`s
# in-sync with your actual code.
# * Ensures that includes are in alphabetical order.
arxanas /
Created March 4, 2016 23:50
Battery text display script
# -*- coding: utf-8 -*-
import json
import os
import pickle
import subprocess
import time
BATTERY_CMD = ["/usr/sbin/ioreg", "-r", "-n", "AppleSmartBattery"]
GREP_CMD = ["/usr/bin/egrep", "Capacity|ExternalConnected"]
arxanas /
Created January 18, 2014 15:55
Cockatrice deck hash in Python.
import hashlib
def int2str(num, base=16, sbl=None):
"""Converts a number to base `base`, with alphabet `sbl`.
Shamelessly stolen from
num -- The number to convert.
base -- The base to convert to.
sbl -- The alphabet to use. If not specified, defaults to nunbers and then
lowercase letters.