This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |