Skip to content

Instantly share code, notes, and snippets.

View imerr's full-sized avatar
🍪
Coding

Robin Rolf imerr

🍪
Coding
View GitHub Profile
@imerr
imerr / conv.sh
Created December 21, 2014 18:52
Mass convert files to utf8
find . -name '*.py' -exec mv "{}" "{}.old" \; -exec sh -c 'iconv -f windows-1252 -t utf-8 "{}.old" > "{}"' \; -exec rm "{}.old" \;
@imerr
imerr / imer-monitor.py
Created October 5, 2014 03:22
Simple linux system monitoring using /proc
#!/usr/bin/python
import threading
import requests
TIMER_CYCLE = 10
config = {'net': {'device': 'eth0'}}#execfile("/etc/imer-monitor/config.py", {})
def update():
global config
threading.Timer(TIMER_CYCLE, update).start()
with open("/sys/class/net/{}/statistics/rx_bytes".format(config['net']['device']), "r") as frx, open("/sys/class/net/{}/statistics/tx_bytes".format(config['net']['device']), "r") as ftx:
rx = int(frx.read())
@imerr
imerr / cloudflare.py
Created September 4, 2014 05:33
cloudflare browser check
import re
import requests
from types import *
from urlparse import urlparse
solverregex = re.compile('.*?setTimeout\(function\(\){.*?var t,r,a,f, ([^=]+)={"([^"]+)":([^}]+)};.+challenge-form\'\);.*?\n.*?;(.*?);a.value =.*?f\.submit\(\);.*?}, 5850\);.*', re.DOTALL)
vcregex = re.compile('<input type="hidden" name="jschl_vc" value="([^"]+)"/>')
def getNested(s, delim=("(", ")")):
level = 0
pos = 0
@imerr
imerr / logformat.py
Created September 1, 2014 02:06
Log format changer
import os
import re
syslogre = re.compile('sys_log\([0-9]+, "([^"]*?)".*?\);', re.DOTALL)
# http://stackoverflow.com/a/8915445/1318435
printfre = re.compile("(%(?:\d+\$)?[+-]?(?:[ 0]|'.{1})?-?\d*(?:\.\d+)?[bcdeEufFgGosxX])")
def processFile(file):
def replacer(m):
def incr(m):
incr.counter+=1
@imerr
imerr / meta.py
Created August 15, 2014 23:19
Python Bulk Music Metadata Script
#!/usr/bin/python
'''
Parses meta data from filenames using a simple regex
This was done for my specific case where files where like "[Gerne] - Artist - Filename (feat. Otherartist)"
You'll probably have to adjust the regex for your use case
Uses mutagen for meta-info stuff
'''
import sys
import os
#!/usr/bin/python
import time, threading
import requests
TIMER_CYCLE = 30
last = []
def update():
global last_total, device_speed, requestPool
threading.Timer(1, tick).start()
with open("/sys/class/net/eth0/statistics/rx_bytes", "r") as frx, open("/sys/class/net/eth0/statistics/tx_bytes", "r") as ftx:
rx = int(frx.read())
dpkg --add-architecture i386
apt-get update
apt-get upgrade
apt-get install libc6:i386 libevent-2.0-5:i386 libmysqlclient18:i386 libdevil1c2:i386 libcrypto++9:i386
<meta charset="utf-8">
<script>゚ω゚ノ=/`m´)ノ~┻━┻//*´∇`*/['_'];o=(゚ー゚)=_=3;c=(゚Θ゚)=(゚ー゚)-(゚ー゚);(゚Д゚)=(゚Θ゚)=(o^_^o)/(o^_^o);(゚Д゚)={゚Θ゚:'_',゚ω゚ノ:((゚ω゚ノ==3)+'_')[゚Θ゚],゚ー゚ノ:(゚ω゚ノ+'_')[o^_^o-(゚Θ゚)],゚Д゚ノ:((゚ー゚==3)+'_')[゚ー゚]};(゚Д゚)[゚Θ゚]=((゚ω゚ノ==3)+'_')[c^_^o];(゚Д゚)['c']=((゚Д゚)+'_')[(゚ー゚)+(゚ー゚)-(゚Θ゚)];(゚Д゚)['o']=((゚Д゚)+'_')[゚Θ゚];(゚o゚)=(゚Д゚)['c']+(゚Д゚)['o']+(゚ω゚ノ+'_')[゚Θ゚]+((゚ω゚ノ==3)+'_')[゚ー゚]+((゚Д゚)+'_')[(゚ー゚)+(゚ー゚)]+((゚ー゚==3)+'_')[゚Θ゚]+((゚ー゚==3)+'_')[(゚ー゚)-(゚Θ゚)]+(゚Д゚)['c']+((゚Д゚)+'_')[(゚ー゚)+(゚ー゚)]+(゚Д゚)['o']+((゚ー゚==3)+'_')[゚Θ゚];(゚Д゚)['_']=(o^_^o)[゚o゚][゚o゚];(゚ε゚)=((゚ー゚==3)+'_')[゚Θ゚]+(゚Д゚).゚Д゚ノ+((゚Д゚)+'_')[(゚ー゚)+(゚ー゚)]+((゚ー゚==3)+'_')[o^_^o-゚Θ゚]+((゚ー゚==3)+'_')[゚Θ゚]+(゚ω゚ノ+'_')[゚Θ゚];(゚ー゚)+=(゚Θ゚);(゚Д゚)[゚ε゚]='\\';(゚Д゚).゚Θ゚ノ=(゚Д゚+゚ー゚)[o^_^o-(゚Θ゚)];(o゚ー゚o)=(゚ω゚ノ+'_')[c^_^o];(゚Д゚)[゚o゚]='\"';(゚Д゚)['_']((゚Д゚)['_'](゚ε゚+(゚Д゚)[゚o゚]+(゚Д゚)[゚ε゚]+(゚Θ゚)+(゚ー゚)+(゚Θ゚)+(゚Д゚)[゚ε゚]+(゚Θ゚)+((゚ー゚)+(゚Θ゚))+(゚ー゚)+(゚Д゚)[゚ε゚]+(゚Θ゚)+(゚ー゚)+((゚ー゚)+(゚Θ゚))+(゚Д゚)[゚ε゚]+(゚Θ゚)+((o^_^o)+(o^_^o))+((o^_^o)-(゚Θ゚))+(゚Д゚)[゚ε゚]+(゚Θ゚)+((o^_^o)+(o^_^o))+(゚ー゚)+(゚Д゚)[゚ε
@imerr
imerr / nginxrtmp_install.sh
Last active December 8, 2016 03:49
Simple (lazy) nginx-rtmp install script I use for setting up servers, it's obviously missing the configuration part
#!/bin/bash
set -e
apt-get update
apt-get -y upgrade
apt-get remove -y nginx-common nginx-full
rm -rf /usr/src/nginx* /usr/src/headers-more-nginx-module
# build dependencies
apt-get -y install dpkg-dev git autotools-dev debhelper po-debconf dh-systemd libexpat-dev libgd2-dev libgeoip-dev libluajit-5.1-dev libmhash-dev libpam0g-dev libpcre3-dev libperl-dev libssl-dev libxslt1-dev zlib1g-dev autotools-dev de$
cd /usr/src
enum EPointTypes {
POINT_NONE,
POINT_LEVEL,
POINT_VOICE,
POINT_EXP,
POINT_NEXT_EXP,
POINT_HP,
POINT_MAX_HP,
POINT_SP,
POINT_MAX_SP,