Skip to content

Instantly share code, notes, and snippets.

Waleed Khan arxanas

View GitHub Profile
@arxanas
arxanas / batterytext.py
Created Mar 4, 2016
Battery text display script
View batterytext.py
#!/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"]
View inclint.sh
#!/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 Jan 18, 2014
Cockatrice deck hash in Python.
View __main__.py
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.
You can’t perform that action at this time.