Skip to content

Instantly share code, notes, and snippets.

View HoffmannP's full-sized avatar

Peter Hoffmann HoffmannP

View GitHub Profile
@HoffmannP
HoffmannP / gist:9714512
Last active August 29, 2015 13:57
Configuration of postfix for relay
===================================================================/etc/postfix/main.cf==========
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
append_dot_mydomain = no
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/lib/postfix
data_directory = /var/lib/postfix
inet_interfaces = localhost
mydomain = **********************
myhostname = **********************
@HoffmannP
HoffmannP / gist:9aaeccaebdea3495a872
Last active August 29, 2015 14:20
less cached for Lighttpd
#!/bin/sh
if [ -z "$1" ]; then
exit 1
fi
echo "/* Using less-cache */"
id="$(sha512sum "$1" | cut -d' ' -f1)"
file="/tmp/less.${id}.css"
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="//d3js.org/d3.v3.min.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
</body>
<script src="script.js"></script>
@HoffmannP
HoffmannP / queryFromHell.sql
Created December 2, 2015 11:44
SQL query from hell - original from our source
SELECT
p.sk_ID,
IFNULL(
IF(
!ISNULL(c.sk_ID),
c.sk_Verantwortlich,
p.sk_Verantwortlich
),
-1
) AS verantwortlich,
# using the instructions from http://golang.org/doc/code.html
# either use the first command line argument or read the test directory
if [ $# -gt 0 ]; then
dir=$1;
else
read -p "test directory: " dir
fi
###############################
SELECT
IF(a <=> NULL, 1, a),
IF( a IS NULL, 1, a ),
IF( a IS NOT NULL, a, 1 ),
IF( ISNULL(a), 1, a ),
IF( !ISNULL(a), a, 1 ),
IF( !!ISNULL(a), 1, a ),
IFNULL( a, 1 )
FROM
(SELECT 1 as a) as tmp
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<style>
/* CSS goes here */
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
@HoffmannP
HoffmannP / gist:7405635
Created November 11, 2013 00:02
My .zshrc
# history
HISTFILE=~/.zsh/histfile
HISTSIZE=1000
SAVEHIST=1000
setopt appendhistory
setopt hist_expire_dups_first hist_ignore_space share_history
setopt autocd beep extendedglob nomatch notify
autoload -Uz up-line-or-beginning-search
@HoffmannP
HoffmannP / gist:7921504
Created December 12, 2013 00:59
Creating a copy of you harddrives for a virtual machine copy
#!/bin/bash
## VM Clone ##
VM="$1" # "MeinRechner"
System="Debian_64"
isoFolder="$2" #"/root/VirtualBox VMs/MeinRechner"
strgCtl="sata"
VBM="/usr/bin/VBoxManage"
$VBM createvm --name $VM --ostype $System --register
$VBM storagectl $VM --name $strgCtl --add sata
bool candiesThrownGotChocolateBar=true, bool candyBoxBoxOpened=false, bool castleBigRoomHovenHappy=true, bool castleRoom2LitFire=true, bool castleRoom2TookObject=true, bool castleTowerFirstVisitDone=true, bool castleTowerPStoneDone=false, bool castleTowerLStoneDone=true, bool castleTowerAStoneDone=false, bool castleTowerYStoneDone=false, bool castleTowerTookTalkingCandy=false, bool castleKilledNougatMonster=true, bool cellarDone=true, bool dragonDone=true, bool dragonUnlockedCyclops=true, bool forgeFoundLollipop=false, bool forgeBoughtWoodenSword=true, bool forgeBoughtIronAxe=true, bool forgeBoughtPolishedSilverSword=true, bool forgeBoughtLightweightBodyArmour=true, bool forgeBoughtScythe=false, bool fortressRoom1ChestFound=true, bool fortressRoom3ChestFound=true, bool fourthHouseFoundLollipopOnCupboard=true, bool gameDebug=false, bool gameInvertedColors=true, bool lighthousePuzzleDone=false, bool lollipopFarmPlant1LollipopButtonUnlocked=true, bool lollipopFarmPlant10LollipopsButtonUnlocked=true, bool lollipo