function: tohex1(n)
n in {0..15}
assert tohex1(0) == '0'
assert tohex1(15) == 'F'
function: tohex2(n)
#!/bin/bash | |
KEEP_ONLY_GIT_HASH='sed "s/^[*|\\\\/ ]*\\([^ ]*\\) .*/\\1/"' | |
GIT_LOG=( | |
git log | |
--color=always | |
--graph | |
--pretty=format:'%Creset%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' | |
--abbrev-commit | |
--date=relative |
import functools | |
def converter(convert): | |
"""Decorator for making decorators converting function return values. | |
Take a single argument function and make it into a decorator | |
converting return values of other functions. | |
""" | |
@functools.wraps(convert) |
import sys | |
from xml.etree.ElementTree import ElementTree, XML, tostring as xml_tostring | |
JUNIT_SINGLE_SUCCESS = '''\ | |
<?xml version="1.0" encoding="UTF-8"?> | |
<testsuite tests="1"> | |
<testcase name="Clean code!"/> | |
</testsuite> | |
''' | |
JUNIT_SINGLE_FAILURE = '''\ |
""" | |
A really stupid python template language inspired by coffeekup, markaby. | |
Do not use this code, it will ruin your day. A byproduct of insomnia. | |
TL;DR | |
----- | |
This module defines a template language that allows us to do: | |
d = Doc() |
conda install -c defaults -c conda-forge nb_conda_kernels |
#!/usr/bin/env python2 | |
import Tkinter as tk | |
f = tk.Frame() | |
f.pack() | |
w1 = tk.Label(f, text='widget1') | |
w1.grid(column=0, row=0) | |
w2 = tk.Label(f, text='widget2') | |
w2.grid(column=120, row=12) |
#!/bin/bash | |
# This worked kind of, now brother suggests using another driver - HL-1118 | |
# https://www.reddit.com/r/linuxquestions/comments/2pupp3/linux_print_driver_for_brother_hl1110/ | |
# http://support.brother.com/g/s/id/linux/en/download_prn.html#HL-1110 | |
# exit on error | |
set -e | |
wget http://www.brother.com/pub/bsc/linux/dlf/hl1110cupswrapper-3.0.1-1.i386.rpm |
def tohex1(n): | |
assert 0 <= n <= 15 | |
return '0123456789ABCDEF'[n] | |
def tohex2(n): | |
assert 0 <= n <= 255 | |
return tohex1(n // 16) + tohex1(n % 16) | |