Skip to content

Instantly share code, notes, and snippets.

View e3krisztian's full-sized avatar

Krisztián Fekete e3krisztian

  • Budapest, Hungary
View GitHub Profile
#!/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)
@e3krisztian
e3krisztian / class4-tasks-loops-and-strings.ipynb
Created March 8, 2016 12:17
class4 tasks: loops and strings
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Convert code from last class to functions

function: tohex1(n) n in {0..15}

assert tohex1(0) == '0'
assert tohex1(15) == 'F'

function: tohex2(n)

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):
@e3krisztian
e3krisztian / mtree.py
Created August 10, 2015 21:31
calculate diff between file system state and installed packages - reproducible Arch - work in progress!
# 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
@e3krisztian
e3krisztian / spr.py
Created May 4, 2015 09:12
sublime text python runner
# 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():
@e3krisztian
e3krisztian / pyd
Created April 16, 2015 14:00
pyd - give Python development shell with required packages already installed
#!/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 "$@"
@e3krisztian
e3krisztian / install.sh
Last active August 29, 2015 14:18
PEX tools
# 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.