Skip to content

Instantly share code, notes, and snippets.

@thorsummoner
thorsummoner / steamscript
Last active September 18, 2016 07:18
steamscript
#!/bin/bash
# steamcmd doesn't handle the shebang line, so lets remove it :\ Woo
# Use Tail to strip first line (print all lines starting at 2) of our input file
# Call steamcmd with automatic login and automatic exit
steamcmd +login ${STEAMLOGIN:-thorsummoner0} +runscript <(tail -n+2 $1) +exit
@thorsummoner
thorsummoner / gist:61d08448f48ebe017f5cf7718ff667e8
Last active August 25, 2016 05:34
apt-fast with squid-dep-proxy over zeroconf/avahi/bonjore
# Given your quid-deb-proxy is using the hostname `apt` and has avahi-daemon installed
# Change /etc/apt-fast.conf to include `--async-dns=false --http-proxy=apt.local`
_DOWNLOADER='aria2c -c -j ${_MAXNUM} --async-dns=false --http-proxy=apt.local -i ${DLLIST} --connect-timeout=600 --timeout=600 -m0'
# Using aysnc-dns will hit this line in aria2c:
# https://github.com/aria2/aria2/blob/a1ce6d2e7f8824b1c1cd18d4e531d84ba58a07df/src/AbstractCommand.cc#L788
# Due to this behavor getting set:
# https://github.com/aria2/aria2/blob/a1ce6d2e7f8824b1c1cd18d4e531d84ba58a07df/src/AbstractCommand.cc#L788
#
@thorsummoner
thorsummoner / hell_debuger.py
Created August 13, 2016 05:51
hell debugger
import inspect
depth = 0
def props(obj):
global depth
depth += 1
pr = {}
for name in dir(obj):
try:
value = getattr(obj, name)
{'ERROR': 128,
'FAST_FORWARD': 64,
'FORCED_UPDATE': 32,
'HEAD_UPTODATE': 4,
'NEW_HEAD': 2,
'NEW_TAG': 1,
'REJECTED': 16,
'TAG_UPDATE': 8,
'_flag_map': {' ': 64, '!': 128, '*': 0, '+': 32, '-': 8, '=': 4},
'flags': 4,
@thorsummoner
thorsummoner / numix.slack-theme
Created August 4, 2016 20:56
Numix based Slack theme.
#2d2d2d,#3E313C,#666666,#FFFFFF,#3E313C,#FFFFFF,#d64937,#D64937
@thorsummoner
thorsummoner / noise_png.py
Created June 17, 2016 16:50
Generates noisy png's with python's random functions.
import sys
import png
import random
import itertools
def rand(entries):
for _ in range(entries):
val = random.choice([0, 255])
assert val != 2
#!/usr/bin/env python
import argparse
import cairo
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
from gi.repository import GObject
@thorsummoner
thorsummoner / argparse-no-flags.py
Created April 22, 2016 21:09
argparse with --no-flag options
import argparse
class ActionFlagWithNo(argparse.Action):
"""
Allows a 'no' prefix to disable store_true actions.
For example, --debug will have an additional --no-debug to explicitly disable it.
"""
def __init__(self, opt_name, dest=None, default=True, required=False, help=None):
super(ActionFlagWithNo, self).__init__(
[
@thorsummoner
thorsummoner / .gitignore
Last active January 18, 2016 06:23
Pygtk3 window boilerplate
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
@thorsummoner
thorsummoner / RE.txt
Created November 30, 2015 06:01
Oniguruma Regular Expressions Version 5.9.1 2007/09/05
Oniguruma Regular Expressions Version 5.9.1 2007/09/05
syntax: ONIG_SYNTAX_RUBY (default)
1. Syntax elements
\ escape (enable or disable meta character meaning)
| alternation
(...) group