Skip to content

Instantly share code, notes, and snippets.

#!/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");
}
#!/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...
\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}
<?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);
@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,
@luelista
luelista / adr_land.sql
Created March 5, 2016 15:13
MySQL table with list of all (most?) countries of the world
-- --------------------------------------------------------
-- Host: xx
-- Server Version: xx
-- Server Betriebssystem: xx
-- HeidiSQL Version: 9.3.0.4984
-- --------------------------------------------------------
/*!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 */;
def drawbars(img, width, height):
x=0
while x<width:
img.paste((255,0,0), (x,0,x+1,height))
x+=2
img.paste((255,0,0), (x,0,x+3,height))
x+=6
img.paste((0,255,0), (x,0,x+1,height))
x+=2
#!/bin/bash
if [[ $EUID != 0 ]] ; then
echo This must be run as root!
exit 1
fi
for xhci in /sys/bus/pci/drivers/?hci_hcd ; do
if ! cd $xhci ; then
@luelista
luelista / rpsls.sh
Created June 1, 2017 14:44
Rock Paper Scissors Lizard Spock
#!/bin/sh
CHOICES="Rock Paper Scissors Lizard Spock"
check_rule() {
user="$1"; computer="$2"; draw="yes"
while read rulestr ; do
rule="$rulestr"
winner="${rule%% *}"; rule="${rule#* }"
verb="${rule%% *}"; rule="${rule#* }"
@luelista
luelista / android_MITM_system_trust_store.sh
Last active September 7, 2017 14:51
generate certificate for android MITM and put it in system trust store
openssl genrsa -out rootCA.key 2048 -nodes
openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.pem
openssl pkcs12 -export -in rootCA.pem -out rootCA.pkcs12 -inkey rootCA.key -name "fooCA"
certhash=$(openssl x509 -in rootCA.pem -subject_hash_old -noout)
cat rootCA.pem > $certhash.0
openssl x509 -inform PEM -text -in rootCA.pem -out /dev/null >> $certhash.0