Skip to content

Instantly share code, notes, and snippets.

View rwenz3l's full-sized avatar
🔨
Building new Things.

Robin Wenzel rwenz3l

🔨
Building new Things.
View GitHub Profile
# Variante 1: Pure Python
from random import randint
def wuerfeln(wuerfel=1, versuche=1):
ergebnis = {}
for a in range(wuerfel,(wuerfel*6)+1):
ergebnis[a] = 0
for i in range(0, versuche):
summe = 0
for j in range(0, wuerfel):
#! /bin/sh
#
# Credit to: www.byan-roper.org
#
#
# actually uses some bash extensions; see comment on line 36
#
# change the UID of a login on Mac OS X 10.11 El Capitan
#
# run this script using sudo *from another user account*!!!
@rwenz3l
rwenz3l / ToggleGateway.bat
Last active May 30, 2017 06:41
Toggle between two Gateways on Windows 7/8/10
@echo off
set /p DUMMY=Press ENTER to Toggle Internet Gateways..
CD %~dp0
IF EXIST "%~dp0fast.ini" (
ECHO Switch: Slow
route DELETE 0.0.0.0 MASK 0.0.0.0 192.168.10.6
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.10.5
DEL Fast.ini
@rwenz3l
rwenz3l / cli_upload.sh
Created July 22, 2017 19:26
upload file to php with CLI (curl)
curl -F "logfile=@safe01.log" -F "sub=archive" localhost:9000/recv.php
@rwenz3l
rwenz3l / verify_flac.sh
Created July 23, 2017 15:45
Verify a FLAC file ripped with XLD
crc32 <(flac --decode --stdout --force-raw-format --endian=little --sign=signed /path/to/file.flac)
@rwenz3l
rwenz3l / verify_flac.sh
Last active July 23, 2017 19:32
Verify a FLAC Folder ripped with XLD
# crc32 <(flac --decode --stdout --force-raw-format --endian=little --sign=signed /path/to/file.flac)
function veriflac() {
NC='\033[0m'
Red='\033[0;31m'
Green='\033[0;32m'
if [ $# -eq 0 ]
then
echo -e "${Red}Usage:"
echo -e " veriflac /path/to/folder${NC}";
@rwenz3l
rwenz3l / repairPermissions_Sierra.sh
Created September 17, 2017 21:46
repair Disk Permissions on ElCapitan / Sierra when System Integrity Protection (SIP) is off
sudo chown root:admin /Applications; sudo chmod 0775 /Applications
sudo chown root:wheel /Library; sudo chmod 0755 /Library
sudo chown root:admin /Library/Application\ Support; sudo chmod 0755 /Library/Application\ Support
sudo chown root:admin /Users; sudo chmod 0755 /Users
sudo chown root:wheel /usr; sudo chmod 0755 /usr
sudo chown root:wheel /usr; sudo chmod 0755 /usr/bin
# Snippets for fun and learning more about git (automation)
function abandon-git {
rescue_branch="Rescue-Branch-$(date +"%Y-%m-%d-%H-%M-%S")"
git checkout -b "${rescue_branch}"
git add --ignore-removal .
git commit -a -m 'This is a Rescue Commit - saves progress and pushes to new banch'
git push --set-upstream origin Rescue-Branch-2017-09-20-15-54-40
}
function restore-git {

Keybase proof

I hereby claim:

  • I am rwenz3l on github.
  • I am rwenz3l (https://keybase.io/rwenz3l) on keybase.
  • I have a public key ASA3-J6KLz8z8LFqC32iUxLegBr5QC8UIoFGlM94zUBEAwo

To claim this, I am signing this object:

@rwenz3l
rwenz3l / file2jsql.sh
Created November 7, 2019 15:46
Convert golang `db:"field"` comments into a sql-query for json objects..
#!/bin/sh
file2jsql(){
# $1=file, $2=table_name
keyval=$(cat "${1}" | perl -n -e '/`db:"(.*)"\ / && printf(qq{"%s", %s,\n},$1,$1);')
keyval=${keyval%?}
echo "SELECT JSON_OBJECT("
echo "$keyval"
echo ") FROM ${2};"
}