Skip to content

Instantly share code, notes, and snippets.

@luelista
luelista / adr_postleit.sql
Last active September 2, 2016 17:41
Liste der deutschen Postleitzahlen (PLZ) mit Ort, Landkreis und Bundesland als MySQL dump
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Exportiere Struktur von Tabelle adr_postleit
CREATE TABLE IF NOT EXISTS `adr_postleit` (
`plz` varchar(5) NOT NULL,
`ort` varchar(50) DEFAULT NULL,
`kreis_nr` varchar(5) DEFAULT NULL,
<?php
$f3 = require('lib/base.php');
$f3->set('DEBUG',5);
$test=new Test();
$dbpath = __DIR__ . '/_test.sqlite';
echo "Using test db: $dbpath\n";
$db=new DB\SQL('sqlite:'.$dbpath);
\documentclass
[foldmarks=true,foldmarks=BlmTP,firstfoot=true,
fromalign=no,fromrule=no,backaddress=plain,refline=narrow,
version=last]{scrlttr2}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{graphics}
\LoadLetterOption{../mwbrief}
#!/bin/sh
#Copyright (C) 2015 Max Weller
#This program comes with ABSOLUTELY NO WARRANTY. This is free
#software, and you are welcome to redistribute it under certain
#conditions; see LICENSE for details of the BSD 2-Clause License
if [ $# -eq 0 -o "-h" = "$1" -o "-help" = "$1" -o "--help" = "$1" ]; then
cat <<EOHELP
Usage: $0 MANIFEST PUBKEY...
#!/usr/bin/perl -w
open SHD, "<", "/etc/shadow" or die "cannot open /etc/shadow: $_";
while(<SHD>) {
@fields = split /:/;
print("\ndn: uid=$fields[0],ou=People,dc=fachschaft,dc=informatik,dc=tu-darmstadt,dc=de\n");
print("changetype: modify\n");
print("replace: userPassword\n");
print("userPassword: {crypt}$fields[1]\n");
}
@luelista
luelista / Makefile
Created January 28, 2015 19:00
Zone transfer to secondary name server via mysqldump...
zone.txt: last_change
pdnssec rectify-all-zones
echo "SELECT name,type,content from records;" | mysql pdns > new_zone.txt
diff zone.txt new_zone.txt > zone.diff
rm zone.txt
mv new_zone.txt zone.txt
gzip --stdout zone.diff > diffs/zone.diff.$(date +"%Y%m%d%H%M")
mysqldump pdns | ssh -i /root/.ssh/copydns_key ns3.teamwiki.net "mysql pdns"
@luelista
luelista / export_rsnapshot.sh
Last active August 29, 2015 14:07
export_rsnapshot
#!/bin/bash
RSNAPDIR=/.private/.snapshots
EXPDIR=$1
if [ -z "$EXPDIR" ]; then
echo Please give folder
exit 12
fi
@luelista
luelista / gist:eba639ee62900ab41193
Created June 25, 2014 13:36
Parser for matching parentheses and strings
function check_parens(str) {
var br=0,skip=false,instr=false;
for(var i = 0, len = str.length; i<len; i++) {
if(skip) { skip=false; continue; }
var z = str[i];
switch(z) {
case "[":case "{":case "(": if(!instr)br++;break;
case "]":case "}":case ")": if(!instr)br--; if(br==0)return i; break;
case "\"":case "'": instr=!instr;
case "\\": skip=true; break;
@luelista
luelista / change_wallpaper
Last active November 24, 2019 05:02
Use the recent "Astronomy Picture of the Day" by NASA as your desktop wallpaper (Python script for Mac OS X, should be easy do adapt for Linux or Windows)
#!/usr/bin/python
# Downloads the current "Astronomy Picture of the Day" from nasa.gov and sets as wallpaper
#
# Installation steps:
# - store this file somewhere and take note of the path
# - change WALLPAPER_DIR to some folder in your home directory
# and create the folder
# - make it executable:
# chmod a+x /path/to/change_wallpaper
# - follow instructions given in the .plist file to make it run daily
@luelista
luelista / workingdays.c
Last active August 29, 2015 14:01
Workingdays - Calculate the number of business days in a given year
// Workingdays - Calculate the number of business days in a given year
// Copyright (c) 2014 Max Weller
// COMPILE AND RUN:
// $ gcc -o workingdays workingdays.c
// $ ./workingdays -h
// Tested with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) (x86_64-apple-darwin13.1.0)
// and gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) (x86_64-linux-gnu)