This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# first get all xml files with the download link | |
for url in $(curl http://www.br.de/fernsehen/ard-alpha/sendungen/alpha-centauri/alle-videos/index.html | egrep -o 'href="(.*[^"])" .* title="zur Übersicht' | awk -F "\"" '{ print $2 }'); do | |
for videourl in $(curl http://www.br.de/$url | egrep -o 'href="(.*[^"])" .* title="zum Video' | awk -F "\"" '{ print $2 }'); do | |
xmlfile=$(curl http://www.br.de/$videourl | egrep -o "dataUrl:'(.*[^'])'" | awk -F "'" '{ print $2 }') | |
wget http://www.br.de/$xmlfile | |
done | |
done | |
# second get the actual file | |
for file in *.xml; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Get jeopardy.mp4 from: | |
# clive https://www.youtube.com/watch?v=0Wi8Fv0AJA4 | |
# ffmpeg -i <file> -vn -acodec copy "jeopardy.mp" | |
mpv -loop $(dirname $0)/jeopardy.mp4 >/dev/null 2>&1 & | |
PID=$! | |
while [ "$(git pull)" = "Already up-to-date." ]; do | |
echo -n "." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from argparse import ArgumentParser | |
from multiprocessing import Queue, Array | |
import multiprocessing | |
import signal | |
import os | |
import time | |
# this signal handler terminates the child-process on SIGINT or SIGTERM event |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
radius <- function(h, s){ | |
# Abbruchbedingung | |
h <- ifelse(h > s/2, NaN, h) | |
n <- ((4 * h^2) + s^2) / (8 * h) | |
return( n ) | |
} | |
library(ggplot2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
versions = filter(lambda x: re.match(r"^v[0-9]+\.[0-9]+\.[0-9]+$", x), os.listdir(path)) | |
# The short form for: | |
# Take the version code like 1.2.197 and create a number out of it: 100020197 (every code part has 4 digits) | |
# Then sort it numerically and take the last one, which should be the largest number | |
last_version = sorted(versions, key=lambda x: sum(map(lambda x: 10 ** ((2-x[0]) * 4) * x[1], enumerate(map(int, x[1:].split("."))))))[-1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# creake a backup of several folders using bup | |
# Using $TARGET as $BUP_DIR | |
TARGET=/mnt/backup | |
FOLDERS="/etc /root /home /srv /var" | |
LOGFILE="$TARGET/logs/$(date +%Y%m%d_%H%M%S).log" | |
( | |
flock -n 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is very simple but I always forget it... | |
gphoto2 --set-config datetime=$(date +%s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# Name of the VM | |
IMAGE=some-fancy-name | |
# IP address for VM | |
IP="192.168.122.30" | |
MIRROR=http://mirror.hetzner.de/debian/packages | |
PACKAGES="openssh-server htop vim" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Unfortunately virtio seems to not work with win8 (it seems to work with windows 10) | |
virt-install --import --memory 4096 --vcpus 1 --name win8 --os-variant win8 --disk ~/VirtualBox\ VMs/Windows/Windows-disk1.vmdk,format=vmdk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fine mesh | |
fn = 1000; | |
// epsilon for clean intersection | |
eps = 0.1; | |
module tube(inner=5, outer=10, angle=45, length=250){ | |
// we want the thing in z direction, thus we rotate on x axis | |