Skip to content

Instantly share code, notes, and snippets.

View monstermunchkin's full-sized avatar

Thomas Hipp monstermunchkin

View GitHub Profile
#!/bin/bash
ls *.m4a | sed -rn 's/(.*)\.m4a/\1/p' | \
xargs -d '\n' -P 2 -n 1 -I{} ffmpeg -i "{}.m4a" \
-acodec libmp3lame -ab 320k "{}.mp3"
@monstermunchkin
monstermunchkin / gist:805902
Created February 1, 2011 14:09
WS08/09 Aufgabe 3
#!/usr/bin/python2
class Datum09(object):
def __init__(self, Tag=4, Monat=2):
self.__hv = (31, 28, 30, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
self.__wt = ('Donnerstag', 'Freitag', 'Samstag', 'Sonntag',
'Montag', 'Dienstag', 'Mittwoch')
if Monat not in range(1,13) or Tag not in range(1,self.__hv[Monat-1]+1):
print 'Fehlerhafte Eingabe. Werte werden auf 4 und 2 gesetzt'
self.__tag = 4
@monstermunchkin
monstermunchkin / rechenTrainer.py
Created February 2, 2011 13:47
WS10/11 Aufgabe 3
#!/usr/bin/python2
import random
# Anzahl falscher Antworten
Fehler = 0
# Alle Moeglichkeiten ermitteln
Aufgaben_total = []
for typ in ['+', '-', '*']:
for n1 in range(10):
@monstermunchkin
monstermunchkin / workspace.sh
Created April 27, 2011 15:20
Open and place 4 terminals
#!/bin/bash
pos=(0,31 705,31 0,492 705,492)
iter=0
for (( i = 0; i < 3; i++ )); do
Terminal --geometry 85x24
done
sleep 1
@monstermunchkin
monstermunchkin / messaged.c
Created May 18, 2011 18:00
Avoiding zombie processes
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <signal.h>
#define PIPENAME "foopipe"
#define MAXLEN 100
@monstermunchkin
monstermunchkin / auex.sh
Created June 8, 2011 05:39
Extract audio and add tags for acc files.
#!/bin/bash
if ! [[ -f "$1" ]]; then
exit 1
fi
ftype=$(ffmpeg -i "$1" 2>&1 | grep -o 'Audio:[^,]*' | awk '{print $2}')
fflags='-vn -acodec copy'
case "$ftype" in
@monstermunchkin
monstermunchkin / SecureXMLRPCServer.py
Created July 22, 2011 19:29
SSL / TLS XML-RPC Server in Python
import socketserver
import ssl
import xmlrpc.server
try:
import fcntl
except ImportError:
fcntl = None
class SecureXMLRPCServer(socketserver.TCPServer,
xmlrpc.server.SimpleXMLRPCDispatcher):
@monstermunchkin
monstermunchkin / xbmc_sets.py
Created August 5, 2011 20:47
Create .nfo file for movie sets in XBMC
#!/usr/bin/python3
# Copyright 2011 Thomas Hipp
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@monstermunchkin
monstermunchkin / suntab.py
Created January 6, 2012 23:24
Graph which shows sunrise and sunset times
# This program plots a graph with sunrises and sunsets.
#
# Copyright (C) 2012 Thomas Hipp
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
@monstermunchkin
monstermunchkin / cp_with_prog.py
Created April 15, 2012 10:14
Copy function with progress display in Python
#!/usr/bin/python
# Copy function with progress display using a callback function.
# The callback function used here mimics the output of
# 'rsync --progress'.
# Copyright (C) 2012 Thomas Hipp
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by