Skip to content

Instantly share code, notes, and snippets.

@stephenmm
stephenmm / bash-named-param
Last active July 23, 2018 20:36 — forked from caruccio/bash-named-param
Named parameters in bash
# Do you like python named parameters (kvargs) ?
# Well, you can have it in bash too!! (but unfortunatly this will not allow you to mix positional and named parameters)
function myfunc() { local $*; echo "# foo=$foo, bar=$bar"; }
myfunc bar=world foo=hello
# foo=hello, bar=world
#########
# And with default arguments:
@stephenmm
stephenmm / wotreplay-parser_notes.txt
Created July 1, 2017 03:39 — forked from anonymous/wotreplay-parser_notes.txt
Grab game data from WoT replay files.
# Notes on reviewing a replay:
#Use this to dig into the replay info:
https://github.com/evido/wotreplay-parser
#Installed the tool here (from windows command prompt):
cd C:\Games\World_of_Tanks
#Ran it like this:
mkdir wotreplay-parser_output
#create all the maps:
wotreplay-parser.exe --output wotreplay-parser_output --create-minimaps
wotreplay-parser.exe --parse --root . --output wotreplay-parser_output/replay_last_battle.wotreplay.png --type png --input replays/replay_last_battle.wotreplay
@stephenmm
stephenmm / fabfile.py
Last active January 26, 2016 01:09 — forked from SeanHayes/fabfile.py
Example Fabric fabfile.py. It's a hodgepodge of old scripts and probably isn't best practice (uWSGI ought to have an init script), but it should give you a practical idea of how to use Fabric. This fabfile relies heavily on custom settings from a Django project in order to be more DRY. Includes commands for setting up a fresh Ubuntu Server insta…
# -*- coding: utf-8 -*-
#Copyright (C) 2013 Seán Hayes
import my_project.settings as dj_settings
from fabric.api import local, run, sudo, env, prompt, settings, cd, parallel, execute
from fabric.contrib.files import exists
from fabric.decorators import hosts, roles, runs_once
import json
import logging
import os
@stephenmm
stephenmm / tee.py
Last active August 29, 2015 14:12 — forked from eacousineau/tee.py
#!/usr/bin/python
import sys
class Tee(object):
"""
Allow forking of output to stdout and other files
From: http://stackoverflow.com/questions/11325019/output-on-the-console-and-file-using-python
@author Thrustmaster <http://stackoverflow.com/users/227884/thrustmaster>
@author Eric Cousineau <[email protected]>
"""
from PIL import Image
backgroundColor = (0,)*3
pixelSize = 9
image = Image.open('input.png')
image = image.resize((image.size[0]/pixelSize, image.size[1]/pixelSize), Image.NEAREST)
image = image.resize((image.size[0]*pixelSize, image.size[1]*pixelSize), Image.NEAREST)
pixel = image.load()