Skip to content

Instantly share code, notes, and snippets.

View m3adow's full-sized avatar
🌻

Till Wiese m3adow

🌻
View GitHub Profile
@m3adow
m3adow / A.py
Last active August 29, 2015 14:19
Logging - How does it work?
import logging
LOG = logging.getLogger('A')
ch = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s %(levelname)s %(name)s: %(message)s')
ch.setFormatter(formatter)
LOG.addHandler(ch)
LOG.setLevel("DEBUG")
from functions import common_functions
@m3adow
m3adow / zmq_rcon_dirty.py
Last active November 16, 2015 16:16
Very(!!!) dirty hack to make zmq_rcon execute arguments as commands without polling STDIN
#!/usr/bin/env python
import sys
import time
import struct
import argparse
import uuid
import threading
import Queue
@m3adow
m3adow / change_uid_www.sh
Created December 6, 2015 17:21
Changing the UID/GID of a docker user before starting the process
#!/bin/bash
set -e
set -u
DEFAULT_UID=33
DEFAULT_GID=33
usage(){
printf "Usage: ./%s -u NEW_UID [-f Force, needed if NEW_UID = 0 ]\n" "$0"
}
@m3adow
m3adow / node1.yml
Created May 4, 2016 06:37
CoreOS cloud-configs utilising kontena 0.12 (example files)
#cloud-config
hostname: "node1"
coreos:
update:
reboot-strategy: "best-effort"
group: "alpha"
units:
- name: settimezone.service
command: start
@m3adow
m3adow / brainfm-bubble-block
Created November 11, 2016 08:39
uBlock Origin Custom rule to block brain.fm bubbles in the background
# Just add this to "My filters" in uBlocks settings
www.brain.fm###bg_bubbles_container
@m3adow
m3adow / cmder_batch.bat
Created April 17, 2017 07:35
Batch file to start other applications (or batches) in CMDer
@echo off
rem Set CMDER_ROOT to your actual cmder installation directory
set CMDER_ROOT=%~dp0
start %CMDER_ROOT%\vendor\conemu-maximus5\ConEmu.exe /icon "%CMDER_ROOT%\cmder.exe" /title Cmder /loadcfgfile "%CMDER_ROOT%\config\ConEmu.xml" /cmd cmd /k "%CMDER_ROOT%\vendor\init.bat cd %CD% && %~1
@m3adow
m3adow / wifileech.sh
Last active June 17, 2018 09:28
Script to periodically change the MAC address of an interface an reconnect to WiFi in Ubuntu. Can be used for circumventing public WiFi limits. Has been tested with "WIFIonICE" WiFi from Deutsche Bahn.
#!/bin/bash
set -euo pipefail
#set -x
change_mac(){
OLDMAC=$(ip link show wlan0 |grep -oP '([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})'|head -1)
ifconfig ${1} down
set +e
while true
do
@m3adow
m3adow / borg-latest.sh
Last active November 29, 2019 07:04
Bash script to download newewst version of borg if not installed before executing it
#!/bin/bash
set -ueo pipefail
# set -x
BORG_ARCH=${BORG_ARCH:-linux64}
BORG_PATH=${BORG_PATH:-}
BORG_UPDATE_ONLY=${BORG_UPDATE_ONLY:-0}
if [ -z "${BORG_PATH}" ]
then
import json
import argparse
from time import sleep
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('input_file', metavar='INPUT')
parser.add_argument('output_file', metavar='OUTPUT')
@m3adow
m3adow / patch-k3s-iptables.sh
Last active July 4, 2020 17:20
A quick 'n dirty script to remove theIptables redirection for ports 80 and 443 of k3s from one IP. Substitute the IP in ADD_LINE with the one you don't want k3s to redirect. Add the script as "ExecStartPost" to /etc/systemd/system/k3s.service.
#!/bin/bash
#############################
# Author: Till Wiese/m3adow #
#############################
set -euo pipefail
set -x