Skip to content

Instantly share code, notes, and snippets.

View matschundbrei's full-sized avatar

Jan 'Maub' Kapellen matschundbrei

View GitHub Profile
@matschundbrei
matschundbrei / scheiss-encoding.php
Last active September 5, 2017 14:02
php functions based on mbstring/preg_match that will detect utf8 and fix German encoding if no utf8 is detected.
<?php
//SCHEISS ENCODING!!!
//via: http://php.net/manual/de/function.mb-detect-encoding.php#68607
function detectUTF8($string){
return preg_match('%(?:
[\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
|\xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
|\xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
|\xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
@matschundbrei
matschundbrei / nsupdate.sh
Last active September 4, 2016 00:43
A bash script (relying on jq & awscli) to update/add single records in Route53
#!/bin/bash
# author: Matschundbrei <[email protected]>
# usage
USAGE="usage: `basename $0` name.domain.tld type value [ttl]"
# default ttl:
DEFTTL=3600
# AWS profile (in .aws/credentials) to use
AWSPROFILE="owndns"
if [[ $# -lt 3 ]]; then
echo $USAGE
@matschundbrei
matschundbrei / human_readable_to_bytes.py
Last active January 2, 2018 13:25 — forked from beugley/human_readable_to_bytes.py
Python function to convert a human-readable byte string (e.g. 2G, 10GB, 30MB, 20KB) to a number of bytes
# stolen from https://stackoverflow.com/questions/354038/how-do-i-check-if-a-string-is-a-number-float
def is_number(s):
"""
tries to convert to float and returns true if it works
"""
try:
float(s)
return True
except ValueError:
return False
@matschundbrei
matschundbrei / rpm-yum-reminder.md
Last active April 2, 2019 15:50
all the rpm/yum commands that I constantly fail to remember but need anytime I have to do something with rpm/yum

show me the description/details of the package

rpm -qip <yourpackage.rpm>
yum info <yourpackage>

show me what is inside the package

rpm -qlp <yourpackage.rpm>
repoquery -l 
@matschundbrei
matschundbrei / csv_switch_fieldseparator.py
Last active June 11, 2019 13:32
Switch out the field separator in a csv (for easy import in Excel)
#!/usr/bin/env python3
"""
small script to exchange the field separator in a CSV
"""
import csv
import argparse
import sys
def main():

Keybase proof

I hereby claim:

  • I am matschundbrei on github.
  • I am maub (https://keybase.io/maub) on keybase.
  • I have a public key ASAka-L33hj478_0Jznqk7XcgLvp3CyCXSvGvrR5gLQGWwo

To claim this, I am signing this object:

@matschundbrei
matschundbrei / ps2-squad-handbook.md
Last active January 11, 2021 02:43
Planetside 2 Squad Handbook
#!/bin/bash
# unofficial bash strict mode
set -euo pipefail
IFS=$'\n\t'
# this is the target-dir for images
TARGET="all-images"
# find the images (change extension as needed)
IMG=$(find ./ -iname '*.jpg')
@matschundbrei
matschundbrei / update_docker_images.sh
Last active June 27, 2021 22:50
Update all locally pulled and tagged docker images
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
docker image ls | \
tail -n +2 | \
grep -v '<none>' | \
awk '{print $1 ":" $2 }' | \
xargs -n1 docker pull
@matschundbrei
matschundbrei / pentesting_searchengines.md
Last active September 17, 2023 00:14
Copy of Searchengines for Pentesting (Twitter Post by @voldimmoral)