Skip to content

Instantly share code, notes, and snippets.

Avatar

Mathias Perlet mperlet

View GitHub Profile
@mperlet
mperlet / mover.sh
Created Mar 16, 2014
moves files //> mvr *
View mover.sh
function mvr() {
spath="/MEDIASHARE/Serien/"
select d in $spath*/; do
test -n "$d" && break;
echo ">>> Invalid Selection";
done
mv "$@" "$d"
ls
}
View last.py
import commands
import datetime
import time
import sys
user = commands.getoutput('echo $USER')
last = commands.getoutput('last -F $USER | grep ":0 .* :0" | sed "s/\s\s*/ /g" | grep -v "(00:00)"').split('\n')
last = [x.replace('%s :0 :0 ' % user, '') for x in last]
@mperlet
mperlet / django_list_to_queryset.py
Created Jun 26, 2014
Converts a list to a django queryset
View django_list_to_queryset.py
def list_to_queryset(model_list):
if len(model_list) > 0:
return model_list[0].__class__.objects.filter(
pk__in=[obj.pk for obj in model_list])
else:
return []
View droppi2.py
from dropbox import client, rest, session
import os,sys
#Const
APP_KEY = ''
APP_SECRET = ''
ACC_KEY = ''
ACC_SECRET = ''
ACCESS_TYPE = 'dropbox'
folder_to_sync = '/'
@mperlet
mperlet / link_parser.py
Created Jul 18, 2014
>python link_parser.py <url> <jquery_selector>
View link_parser.py
@mperlet
mperlet / picraf.sh
Created Aug 28, 2014
Picraf ist ein kleines Shell-Script welches mit 2 optionalen Parametern ein Zeitraffer Video erstellt. Verwendet wird fswebcam und ffmpeg.
View picraf.sh
#!/bin/bash
if [[ "$1" == "" ]]; then
to=1440
else
to=$1
fi
if [[ "$2" == "" ]]; then
waitsek=60
else
@mperlet
mperlet / flickrstats.sh
Last active Aug 29, 2015
Twitter Bot for Flickr User Stats
View flickrstats.sh
#!/bin/bash
# Requires: curl, jq, xargs, sed, bc, convert and t
# Flickr + Twitter User
FUSER='mperlet'
TUSER='@mperlet_'
# User Info URL
DATA=$(curl http://flickrit.pboehm.org/photos/$FUSER)
@mperlet
mperlet / pdfsites
Created Dec 12, 2014
PDF Site info (number of pages + color pages)
View pdfsites
function pdfsites() {
echo "Seitenanzahl: " $(pdfinfo $1 | grep Pages: | cut -d":" -f2 | awk '{$1=$1}{ print }')
echo "Farbseiten: " $(ghostscript -o - -sDEVICE=inkcov $1 | grep -v "^ 0.00000 0.00000 0.00000" | grep "^ " | wc -l)
}
@mperlet
mperlet / mary_tts_wav_2_mp3_webservice
Created Jan 20, 2015
FlaskApp, TTS-mp3 (localhost:5000/Ich+bin+kein+Mensch)
View mary_tts_wav_2_mp3_webservice
from flask import Flask
from flask import send_file
from urllib.request import urlopen
import random, string
import os, glob
app = Flask(__name__)
@app.route("/<tts>")
def hello(tts):
@mperlet
mperlet / random 9gag
Created Jan 27, 2015
fire key "r", every 3sec (random 9gag page)
View random 9gag
while :
do
xdotool key "r"
sleep 3
done
You can’t perform that action at this time.