Skip to content

Instantly share code, notes, and snippets.

View ehrenfeu's full-sized avatar

Niko Ehrenfeuchter ehrenfeu

View GitHub Profile
@ehrenfeu
ehrenfeu / he-ipv6.sh
Last active August 29, 2015 14:14 — forked from jbhannah/he-ipv6.sh
#!/bin/sh
# Hurricane Electric IPv6 Tunnel Broker script for Ubuntu
# /etc/network/if-up.d/he-ipv6.sh
# Written by Jesse B. Hannah (http://jbhannah.net) <[email protected]>
# Based on instructions provided by Hurricane Electric (http://tunnelbroker.net)
###
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ehrenfeu
ehrenfeu / compact_vmdk.sh
Created October 13, 2015 13:55
Compacting VMDK files
#!/bin/bash
# NOTE:
# first, start up the VM, log in and fill the free space with zeros, e.g.:
# > cat /dev/zero > zero.fill ; sync ; sleep 1 ; sync ; rm -f zero.fill
# exit on any error:
set -e
VBOX_BASEDIR="$HOME/VirtualBox_VMs"
@ehrenfeu
ehrenfeu / i-librarian_pdf_export.sh
Created October 16, 2015 10:48
"I, Librarian" PDF file exporter
#!/bin/bash
#
LIB="/storage/www/librarian/library"
DB="${LIB}/database/library.sq3"
TGT="/storage/pdf_export"
START_ID="4500"
STOP_ID="99999999"
@ehrenfeu
ehrenfeu / fix_encoding_437_to_utf8.sh
Created October 17, 2015 23:37 — forked from anonymous/fix_encoding_437_to_utf8.sh
Fix filenames encoded in 437 to UTF-8.
#!/bin/bash
#
test -z "$1" && exit 1
# echo "$1"
FIXED=$(echo "$1" | iconv -f 437 -t utf8)
# echo "$FIXED"
if ! [ "$1" == "$FIXED" ] ; then
mv -v "$1" "$FIXED"
@ehrenfeu
ehrenfeu / date-to-imagej-textimage.sh
Last active February 17, 2016 16:49
quick hack to render current time as an ImageJ text image
XRES=180
YRES=32
convert -size ${XRES}x${YRES} \
-background white \
-fill black \
-pointsize $YRES label:"$(date +%X)" \
-colorspace gray \
-compress none \
-depth 8 PGM:- |
# Use local scikit-image
import sys
sys.path.insert(0, "/home/dan/University/projects/gsoc_face_detection/scikit-image/")
from skimage.feature import multiblock_local_binary_pattern
from skimage.transform import integral_image
import numpy as np
import skimage.io as io
import xml.etree.ElementTree as ET
@ehrenfeu
ehrenfeu / face-boxer-usage.md
Created April 25, 2017 12:29 — forked from dannguyen/face-boxer-usage.md
A face-detection script in Python

This face-boxer.py script is more-or-less the same code that you'll find in the OpenCV tutorial: Face Detection using Haar Cascades. For another variation, with more explanation, check out RealPython's tutorial.

Usage

The face-boxer.py script is designed to be run from the command-line. It has two required arugments:

  1. The path to a XML file containing a Haar-cascade of visual features. In this example, it will be the features that make up a face.
  2. The path to an image file that you want to perform face-detection on. You can pass in more than one image file as space-separated arguments.
@ehrenfeu
ehrenfeu / html_mail.py
Last active April 24, 2024 22:24
Use Python to send HTML emails with expand/collapse boxes working in TB and Android
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
def send_html_mail(subject, body, to_addr, from_addr):
"""Send an HTML email using the given subject, body, etc."""
# Create message container - the correct MIME type is multipart/alternative here!
message = MIMEMultipart('alternative')
message['subject'] = subject
@ehrenfeu
ehrenfeu / curie_captive.sh
Created October 15, 2018 13:03
curie wifi captive renewal
#!/bin/sh
curl -c /tmp/curie.cookies -v -v -v -k -i \
https://wifi.curie.fr/portal_degraded.php
curl -c /tmp/curie.cookies -v -v -v -k -i \
-F action=automatic_authenticate -F secure_pwd= -F policy_accept=on \
-F connect= --ignore-content-length -D /dev/stdout \
https://wifi.curie.fr/portal_degraded.php
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.