Skip to content

Instantly share code, notes, and snippets.

View cafca's full-sized avatar

Vincent Ahrend cafca

View GitHub Profile
@adzialocha
adzialocha / index.md
Last active February 11, 2022 13:46
How to work with CBOR and CDDL
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
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

@vkotovv
vkotovv / app.py
Created August 20, 2013 14:08
Clear data for all tables via flask-sqlalchemy
def clear_data(session):
meta = db.metadata
for table in reversed(meta.sorted_tables):
print 'Clear table %s' % table
session.execute(table.delete())
session.commit()
@puppe
puppe / absender.lco
Last active July 30, 2023 20:14
Deutsche Briefvorlage für LaTeX (scrlttr2) (ACHTUNG: Aktualisierte Version jetzt unter https://codeberg.org/puppe/german-latex-letter-template/)
\ProvidesFile{absender.lco}
\KOMAoptions{%
% fromemail=true, % Email wird im Briefkopf angezeigt
% fromphone=true, % Telefonnumer wird im Briefkopf angezeigt
% fromfax=true, % Faxnummer wird im Briefkopf angezeit
% fromurl=true, % URL wird im Briefkopf angezeigt
% fromlogo=true, % Logo wird im Briefkopf angezeigt
% subject=titled, % Druckt "Betrifft: " vor dem Betreff
locfield=wide, % Breite Absenderergänzung (location)
@elidickinson
elidickinson / real_ip_address.py
Created November 29, 2012 03:33
ProxiedRequest class for flask that gets correct remote_addr
from flask import Request
class ProxiedRequest(Request):
"""
`Request` subclass that overrides `remote_addr` with Frontend Server's
HTTP_X_FORWARDED_FOR when available.
"""
@property
def remote_addr(self):
@somic
somic / udp_hole_punch_tester.py
Created November 3, 2009 04:13
UDP Hole Punching test tool
#!/usr/bin/env python
#
# udp_hole_punch_tester.py - UDP Hole Punching test tool
#
# Usage: udp_hole_punch_tester.py remote_host remote_port
#
# Run this script simultaneously on 2 hosts to test if they can punch
# a UDP hole to each other.
#
# * remote_port should be identical on 2 hosts.