Skip to content

Instantly share code, notes, and snippets.

@ninux
ninux / gist:4699711
Created February 2, 2013 23:23
read from sqlite to file
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sqlite3 as lite
import sys
con = lite.connect('datenbank2')
id_ctr = 10
@ninux
ninux / gist:4700391
Created February 3, 2013 03:07
seribrief python, sqlite und latex
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sqlite3 as lite
import sys
import os
con = lite.connect('datenbank2')
ctr=0
@ninux
ninux / gist:5713741
Created June 5, 2013 13:12
Merge PDFs with Ghostscript
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdf file1.pdf file2.pdf
found at https://bbs.archlinux.org/viewtopic.php?id=65036
@ninux
ninux / gist:67abc556eba11af98e54
Created February 25, 2014 13:39
cleanup repo with new .gitignore
# http://stackoverflow.com/questions/7075923/resync-git-repo-with-new-gitignore-file
git rm -r --cached .
git add .
git commit -m "cleaned up repo with new gitignore"
@ninux
ninux / bugreport.tex
Created April 13, 2014 19:50
minimal example for "venndiagram" bugreport
\documentclass[a4paper, 10pt, fleqn]{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{venndiagram}
\begin{document}
\begin{figure}[h!]
\centering
@ninux
ninux / gist:10648411
Last active August 29, 2015 13:59
using regex in java
private boolean containsNumbers(String s) {
Pattern p = Pattern.compile(".*\\d.*");
return p.matcher(s).find();
}
private boolean containsCharacters(String s){
Pattern p = Pattern.compile("[a-zA-Z]");
return p.matcher(s).find();
}
git archive HEAD --format=zip > archive.zip
@ninux
ninux / gist:bffcfb366b668e4dd41f
Created June 16, 2014 08:50
some fun with gnu octaves' control package
# Octave 3.8.1, Mon Jun 16 09:08:01 2014 CEST <ninux@x200>
pkg load control signal
G = zpk([];[-1,-1; -1,1],1);
G = zpk([],[-1,-1; -1,1],1);
H = zpk([],[-2,-1; -2,1],1);
zplane(G,H)
graphics_toolkit("gnuplot")
zplane(G)
s = tf('s')
G = zpk([],[-1,-1; -1,1],1);
main:
LDA #$07 ; load byte mask for joystick input
ORA $1858 ; map mask
STA $1858 ; write byte
loop: LDA #$07 ; load byte mask for LED output
ORA $000b ; map mask
STA $000b ; write byte
LDA $000c ; load port G
@ninux
ninux / gist:75737af00635d9512164
Last active August 29, 2015 14:08
debug messages in c
#ifdef DEBUG
#define _dbgmsg(MESSAGE, ...) printf("DEBUG: " #MESSAGE "\n", \
##__VA_ARGS__)
#else
#define _dbgmsg(MESSAGE) {}
#endif