Skip to content

Instantly share code, notes, and snippets.

View NewProggie's full-sized avatar
👨‍💻
Working...

Kai Wolf NewProggie

👨‍💻
Working...
View GitHub Profile
@NewProggie
NewProggie / psd2pngConverter.sh
Created November 12, 2011 14:40
Converting all psd files recursively into png files with spaces and brackets in each filename
find . -name "*.psd" | while read file; do NEU=`dirname "$file"`/`basename "$file" psd`png; convert "$file" "$NEU"; done
@NewProggie
NewProggie / gist:2570477
Created May 1, 2012 18:54
adb shell commands for putting device in car mode / dock mode
adb shell am broadcast -a android.intent.action.DOCK_EVENT --ei android.intent.extra.DOCK_STATE 0 // normal mode
adb shell am broadcast -a android.intent.action.DOCK_EVENT --ei android.intent.extra.DOCK_STATE 1 // dock mode
adb shell am broadcast -a android.intent.action.DOCK_EVENT --ei android.intent.extra.DOCK_STATE 2 // car mode
@NewProggie
NewProggie / square.prolog
Created June 28, 2012 09:19
Calc magic square in Prolog
:- use_module(library(clpfd)).
create_mat(0, _, []).
create_mat(N0, N, [Zeile|Matrix]) :-
N0 > 0,
N1 is N0 - 1,
length(Zeile, N),
create_mat(N1, N, Matrix).
sum_row([], _).
@NewProggie
NewProggie / gist:3826062
Created October 3, 2012 09:33 — forked from rpls/gist:3760188
Loading and norming WAV files in python.
import wave
import pylab
import os
import numpy as np
def readwavefile(filename):
"""
Reads a WAV file and returns all the frames converted to floats and the framerate.
"""
assert os.path.exists(filename) and os.path.isfile(filename)
@NewProggie
NewProggie / VBS Brief schreiben
Created February 6, 2013 20:35
Kleines VBS-Skript zum Wordbrief an Kunden schreiben
Sub Brief_schreiben()
Dim word_app As Word.Application
Dim word_doc As Word.Document
' Aktive Zelle ermitteln und Adresse rausfischen
Dim CustomerAddress as string
CustomerAddress = Cells(ActiveCell.Row, 4).value
If CustomerAddress = "" Then
MsgBox "Bitte Kunde auswählen", , "Fehler"
@NewProggie
NewProggie / csv2xml.py
Created February 24, 2013 19:33
create fritzbox compatible xml file from csv contacts file
#/usr/bin env python
# -*- coding: utf-8 -*-
from lxml import etree as et
def main():
mpa = dict.fromkeys(range(32))
phonebooks = et.Element('phonebooks')
phonebook = et.SubElement(phonebooks, "phonebook")
for line in open('kontakte.csv', 'r').read().split('\r'):
@NewProggie
NewProggie / .emacs
Created October 4, 2013 20:52
My .emacs config
(package-initialize)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(blink-cursor-mode nil)
'(custom-enabled-themes (quote (tango-dark)))
'(global-visual-line-mode t)
@NewProggie
NewProggie / code churn
Created February 22, 2014 15:46
Small python script to publish a js chart of git file changes, insertions and deletions
#!/usr/bin/env python
import os
def header():
print """
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
cv::FileStorage fs("viff.xml", cv::FileStorage::READ);
for (int i=0; i<36; i++) {
std::stringstream smat;
cv::Mat P;
smat << "viff" << std::setfill('0') << std::setw(3) << i << "_matrix";
fs[smat.str()] >> P;
}
@NewProggie
NewProggie / create_faces.c
Last active August 29, 2015 14:04
Fast meshing of grid-like ordered vertices
/*****************************************************************************
* Fast meshing of grid-like ordered vertices.
* This code snippet shows the indexing for a faces array to mesh grid-like
* ordered vertices using only one for loop. The indexing looks as follows:
*
* 0-----1-----2-----3
* | //| //| //|
* | // | // | // |
* | // | // | // |
* |// |// |// |