Skip to content

Instantly share code, notes, and snippets.

View dmr's full-sized avatar

Daniel Rech dmr

View GitHub Profile
@miohtama
miohtama / gist:34a83d870a14aa7e580d
Last active October 31, 2021 13:21
Safe evaluation of math expressions in Python, using byte code verifier and eval()
""""
The orignal author: Alexer / #python.fi
"""
import opcode
import dis
import sys
import multiprocessing
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active February 25, 2024 13:47
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

/* Die tarifliche Einkommensteuer nach § 52 Abs. 41 EStG:
*
* (1) Die tarifliche Einkommensteuer bemisst sich nach dem zu
* versteuernden Einkommen. Sie beträgt vorbehaltlich der §§ 32b,
* 32d, 34, 34a, 34b und 34c jeweils in Euro für zu versteuernde
* Einkommen
*
* 1. bis 8 130 Euro (Grundfreibetrag):
* 0;
* 2. von 8 131 Euro bis 13 469 Euro:
@eamartin
eamartin / benchmark.py
Created August 10, 2011 09:10
Python JSON Benchmark
'''cjson, jsonlib, simplejson, and yajl also use C code
demjson did not use C code, but was too painfully slow to benchmark
(took about 20 seconds for these tests)
'''
import json
import sys
import time
with open('doc.json') as f:
#!/bin/sh
#
# Postgresql backup script
# http://www.bitweaver.org/wiki/pg_backup+PostgreSQL+backup+script
#
# Author
# |
# +-- speedboy (speedboy_420 at hotmail dot com)
# +-- spiderr (spiderr at bitweaver dot org)
# +-- flexiondotorg (code at flexion dot org)