Skip to content

Instantly share code, notes, and snippets.

Avatar

Tobias Schmidl schtobia

View GitHub Profile
@schtobia
schtobia / upgrade.sh
Last active Aug 29, 2015
ESXi upgrade script
View upgrade.sh
#! /bin/sh
# open firewall for outgoing http requests:
esxcli network firewall ruleset set -e true -r httpClient
#shutting down VMs
allVMs=$(esxcli vm process list | sed -n 's/^[[:space:]][[:space:]]*World ID\: \([0-9][0-9]*\)$/\1/p');
if [ -n "${allVMs}" ];
then
for currentVM in $allVMs;
do
@schtobia
schtobia / _Thinkpad-conf.md
Last active Aug 29, 2015
Configuration for Thinkpad Edge E145
View _Thinkpad-conf.md

These files should be put in /etc/modprobe.d/.

View keybase.md

Keybase proof

I hereby claim:

  • I am schtobia on github.
  • I am schtobia (https://keybase.io/schtobia) on keybase.
  • I have a public key whose fingerprint is BA97 2630 7B2C C314 33AE F496 6BA9 A5C0 5D01 15D2

To claim this, I am signing this object:

@schtobia
schtobia / clean.cmd
Created Jul 10, 2015
shutdown script for a virtualized Windows 7
View clean.cmd
@echo off
set UD_IN_FILTER=windows;winnt
set UD_EX_FILTER=temp;recycle;system volume information;ntuser;pagefile;hiberfil
set UD_DISABLE_REPORTS=1
udefrag %SYSTEMDRIVE%
"%ProgramFiles(x86)%\Sysinternals\sdelete.exe" -c %SYSTEMDRIVE%
"%ProgramFiles(x86)%\Sysinternals\sdelete.exe" -z %SYSTEMDRIVE%
shutdown /s /f /t 0
@schtobia
schtobia / kill-zombies.sh
Last active Aug 1, 2016
Kill all zombies, with increasing vigor
View kill-zombies.sh
#! /bin/sh
for current_signal in HUP TERM KILL SEGV;
do
ZOMBIES=$(ps -A -ostat,ppid | sed -rn 's/^[zZ][^[:space:]]*[[:space:]]*([0-9]+)/\1/p' | sort -nu);
[ -n "$ZOMBIES" ] && { kill -s $current_signal $ZOMBIES; sleep 2; } || true;
done
@schtobia
schtobia / tinytinyrss.init.sh
Last active Aug 2, 2016
Init script for TinyTinyRSS
View tinytinyrss.init.sh
### BEGIN INIT INFO
# Provides: tinytinyrss
# Required-Start: $network postgresql
# Required-Stop: $network postgresql
# Should-Start: $syslog
# Should-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: TinyTinyRSS update daemon
### END INIT INFO
@schtobia
schtobia / quasselweb
Last active Aug 2, 2016
quasselweb init script
View quasselweb
#! /bin/bash
### BEGIN INIT INFO
# Provides: quasselweb
# Required-Start: quasselcore
# Required-Stop: quasselcore
# Should-Start: $syslog
# Should-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: distributed IRC client using a central core component
@schtobia
schtobia / backup-etc
Last active Nov 12, 2016
Find and tar all changed config files in /etc. Kudos to blast_hardcheese https://serverfault.com/a/658796
View backup-etc
#! /bin/bash
[ -z "$1" ] && { (>&2 echo "Usage: $0 <backup.tar>"); exit 1; }
touch "$1" || { (>&2 echo "Cannot write to $1"); exit 1; }
find /etc -type f | grep -vFf <(debsums -e 2>/dev/null | sed 's/[[:space:]]*OK$//') | xargs tar cf "$1" 2>/dev/null
@schtobia
schtobia / user-flags
Created Feb 7, 2017
Reenable chromium extensions under debian
View user-flags
# Renable "remote extensions", until the debilians get their shit together
# see also: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=851927 ,
# http://metadata.ftp-master.debian.org/changelogs/main/c/chromium-browser/chromium-browser_55.0.2883.75-6_NEWS
# This file should be placed under /etc/chromium.d/
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --enable-remote-extensions"
@schtobia
schtobia / lambda_wrapper.hpp
Last active Feb 15, 2017
Wrapper for using lambda statements wiith C style APIs within MSVC 2010
View lambda_wrapper.hpp
#pragma once
/**
* @brief the storage class for lambda_cast
* @details You have to set up the storage a partial specialization in your cpp file:
* @code
typedef unsigned int(WINAPI *BeginThreadFunction)(void *);
template <typename From> struct LambdaWrapper<From, BeginThreadFunction, unsigned int, void*>
{
static From * Lambda;
static unsigned int WINAPI Call(void* argument) { return (*Lambda)(argument); }