Skip to content

Instantly share code, notes, and snippets.

@tobigue
tobigue / git-step
Created July 27, 2016 15:48
Script to step through changes since a given commit
#!/bin/bash
# step through commits showing the commit information
BASE_REV=$1;
skip=true;
for rev in $(git log --pretty=oneline --reverse --abbrev-commit | awk '{print $1}'); do
if [ "$rev" = "$BASE_REV" ] ; then
skip=false;
fi
@tobigue
tobigue / dvbt.py
Created April 30, 2016 13:25
vlc dvbt picker
import sys, io, csv, subprocess
VLC = "C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe"
programs = """
Programm,Frequenz,SID
Das Erste,522,14
ZDF,570,514
RTL Television,506,16405
SAT.1,658,16408
@tobigue
tobigue / es_reindex.py
Last active December 11, 2015 16:13
Elasticsaerch reindexing command line script
from __future__ import print_function
import argparse
import sys
import time
from copy import deepcopy
from datetime import datetime
from elasticsearch import Elasticsearch
from elasticsearch.exceptions import NotFoundError
from elasticsearch.helpers import reindex
@tobigue
tobigue / apachenpub
Last active August 29, 2015 14:17
apachenpub
#!/usr/bin/env bash
mkdir -p /home/$USER/Desktop/apachenpub/
date >> /home/$USER/Desktop/apachenpub/__LOG__.txt ;
find /home/$USER/Desktop -maxdepth 1 -type f -atime +14 -exec mv -v {} /home/$USER/Desktop/apachenpub/ \; >> /home/$USER/Desktop/apachenpub/__LOG__.txt ;
@tobigue
tobigue / playsong.py
Created February 17, 2015 16:49
Play sound on keypress (captured in background)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import pygame
from pygame.locals import *
from evdev import InputDevice, categorize, ecodes, list_devices
pygame.init()
@tobigue
tobigue / serve.sh
Created September 13, 2014 13:09
Serve files from a directory locally
python -c "
import flask
f=flask.Flask('a', static_folder='./')
@f.route('/<path:p>')
def s(p): return f.send_static_file(p)
f.run()
"
@tobigue
tobigue / fest.py
Created March 29, 2013 08:38
Python (sklearn) FEST Wrapper
import os
import random
import string
from subprocess import call
import numpy as np
from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.datasets import dump_svmlight_file
@tobigue
tobigue / cvdiff.py
Created July 27, 2012 15:45
Sklearn GridSearchCV vs. CrossValidation
from sklearn.linear_model import SGDClassifier
from sklearn import cross_validation
from sklearn import metrics
from sklearn.grid_search import GridSearchCV
from sklearn.datasets import load_iris
data = load_iris()
sample_vector = data.data
targets = data.target