function: tohex1(n)
n in {0..15}
assert tohex1(0) == '0'
assert tohex1(15) == 'F'
function: tohex2(n)
| #!/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) | |
| from datetime import datetime | |
| import csv | |
| import sys | |
| START_DATE = 'start_date' | |
| END_DATE = 'end_date' | |
| TOLERANCE = 31 # days | |
| PRIMARY_KEYS = ['frame_id', 'person_id'] | |
| def mold_date(any_date): |
| # coding: utf-8 | |
| ''' | |
| `man mtree`: | |
| Signature | |
| The first line of any mtree file must begin with “#mtree”. If a file | |
| contains any full path entries, the first line should begin with | |
| “#mtree v2.0”, otherwise, the first line should begin with | |
| “#mtree v1.0”. | |
| Blank |
| # sublime view runner, to help making sublime text python experiments | |
| # | |
| # bootstrap: | |
| # | |
| # exec view.substr(sublime.Region(0, view.size())) | |
| import sublime | |
| import sublime_plugin | |
| def r(): |
| #!/bin/bash | |
| [ -e test-requirements.txt ] && { | |
| echo 'Entering Python environment as defined by test-requirements.txt' | |
| exec in-virtualenv -r test-requirements.txt /bin/bash "$@" | |
| } | |
| [ -e test_requirements.txt ] && { | |
| echo 'Entering Python environment as defined by test_requirements.txt' | |
| exec in-virtualenv -r test_requirements.txt /bin/bash "$@" |
| # PEX | |
| ( VE="$(mktemp -d)"; virtualenv "$VE"; . "$VE/bin/activate"; pip install pex; pex -r pex -e pex.bin.pex:main -o ~/bin/pex; rm -rf "$VE"; ) | |
| # Python | |
| pex -r autopep8 -e autopep8:main -o ~/bin/autopep8 | |
| pex -r pip-init -e pip_init:main -o ~/bin/pip-init | |
| pex -r pyrene -e pyrene.main:main -o ~/bin/pyrene | |
| # pex -r yolk -e yolk.cli:main -o ~/bin/yolk | |
| pex -r ptpython -e ptpython.entry_points.run_ptpython:run -o ~/bin/ptpython | |
| pex -r ptpython -r ipython -e ptpython.entry_points.run_ptipython:run -o ~/bin/ptipython |