Skip to content

Instantly share code, notes, and snippets.

View ehrenfeu's full-sized avatar

Niko Ehrenfeuchter ehrenfeu

View GitHub Profile
@ehrenfeu
ehrenfeu / backup-lxc-with-tar.md
Last active April 19, 2022 12:49
Backup up LXC containers using `tar`

Creating tarballs from LXC containers

NOTE: this is about tarring up plain LXC (i.e. not LXD) containers without the benefits of btrfs or similar

shut down the respective container, e.g.

lxc-stop mycontainer
@ehrenfeu
ehrenfeu / README.md
Created January 27, 2022 22:04 — forked from jasco/README.md
ARM64 Raspberry Pi 4 Unifi Controller Setup

Background

The instructions for setting up the Unifi Controller on ARM do not cover ARM64. The documentation states that ARM64 is not supported but hints it can be setup manually. The documentation also states that Java 8 is currently required. The following is therefore clearly in unsupported territory but so far seems to work fine. The internet has numerous references and resources but they weren't all easy to find and the ones I read required some modification for my configuration.

Note for the future: double check versions and source documentation if these instructions are dated. Also these instructions are specifically tailored for Ubuntu. See original references for other platforms.

Last update March 25, 2021

Base configuration

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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
@ehrenfeu
ehrenfeu / html_mail.py
Last active March 16, 2024 06:54
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 / 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.
# 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 / 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:- |
@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 / 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"