Skip to content

Instantly share code, notes, and snippets.


Waleed Khan arxanas

View GitHub Profile
arxanas /
Created Jan 18, 2014
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.
arxanas /
Created Mar 4, 2016
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"]
# 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.