Skip to content

Instantly share code, notes, and snippets.

View arxanas's full-sized avatar
💭
Seeking new job in devtools; if you have one, message at me@waleedkhan.name

Waleed Khan arxanas

💭
Seeking new job in devtools; if you have one, message at me@waleedkhan.name
View GitHub Profile
@arxanas
arxanas / batterytext.py
Created March 4, 2016 23:50
Battery text display script
#!/usr/bin/python
# -*- 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
arxanas / inclint.sh
Created January 28, 2016 20:22
inclint
#!/bin/bash
# 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
arxanas / __main__.py
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 http://stackoverflow.com/a/4665054/344643
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.