Skip to content

Instantly share code, notes, and snippets.

@zvodd
zvodd / Doge
Created November 28, 2013 19:47
wow such doge
▄ ▄
▌▒█ ▄▀▒▌
▌▒▒█ ▄▀▒▒▒▐
▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐
▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐
▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌
▐▒▒▒▄▄▒▒▒▒░░░▒▒▒▒▒▒▒▀▄▒▒▌
▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐
▐░░░▒▒▒▒▒▒▒▒▌██▀▒░░░░▒▒▒▀▄▌
▌░▒▄██▄▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒▌
local enemies = {}
local SumSpell = "SummonerFlash"
function onLoad()
for i, heroObj in pairs(GetEnemyHeroes()) do
if heroObj and heroObj.valid then
local curflash
if hero:GetSpellData(SUMMONER_1).name:find(SumSpell) then curflash = SUMMONER_1 end
if hero:GetSpellData(SUMMONER_2).name:find(SumSpell) then curflash = SUMMONER_2 end
enemies[heroObj.charName] = {curflash, nil}
@zvodd
zvodd / sexy_struct_strings.py
Created July 16, 2014 16:31
Make packing string more verbose and human readable.
def convert(instr, token=','):
longtoshort = {'pad' : 'x',
'char' : 'c',
'schar' : 'b',
'uchar' : 'B',
'byte' : 'B',
'bool' : '?',
'short' : 'h',
'ushort' : 'H',
'int' : 'i',
@zvodd
zvodd / xkcd captionator
Last active August 29, 2015 14:04
UserScript | xkcd.com | Show xkcd comic captions on the page. (Click the comic image to make it stay.)
// ==UserScript==
// @name xkcd captionator
// @namespace https://gist.github.com/zvodd/035e488f912aa18ba0c6
// @version 0.1
// @description Show xkcd comic captions on the page. (Click the comic image to make it stay.)
// @match http://xkcd.com/*
// @copyright 2014+, zvodd
// ==/UserScript==
var comic = $("#comic>img"),
@zvodd
zvodd / ascii2bin.py
Last active August 29, 2015 14:04
Simple Example Command Line Python App
#!/usr/bin/env python
import sys
def main():
if len(sys.argv) >= 2:
infile = sys.argv[1]
else:
infile = sys.stdin
if len(sys.argv) >= 3:
@zvodd
zvodd / LoL Average Game Time.js
Last active August 29, 2015 14:04
Average game times for League of Legends match history display.
function get_game_times() {
var durs = document.querySelectorAll('.date-duration-duration'),
games = Array();
for ( i in durs) {
var dtxt = durs[i].innerText;
if (dtxt != undefined) {
// Does it output hours? i have no appplicable data to test.
var tar = dtxt.match(/(\d\d):(\d\d)/),
tm = Number(tar[1]),
ts = Number(tar[2])/60, // convert seconds to percentage
@zvodd
zvodd / list_flatten.py
Created October 24, 2014 00:31
Flatten lists of lists. Including callback argument to filter iterable types.
import collections
# ignore functions
ignore_strings = lambda x: isinstance(x, basestring)
ignore_dicts = lambda x: isinstance(x, dict)
def list_flatten(*ilist, **kwargs):
"""
Flattens nested indexable iterables, i.e lists of lists
By default treats strings and dicts as scalar values
@zvodd
zvodd / chooser.sh
Created November 17, 2014 15:12
Bash Script: Recursive YES/NO user input with parameter for maximum retries.
#!/bin/bash
yesnochoose () {
# $1 is the maximum number of retries
max=$( [ "$1" -eq "$1" ] 2>/dev/null && echo $1 || echo 5 )
# $2 is the retry count and should not be set when called outside of recursion.
count=$( [ "$2" -eq "$2" ] 2>/dev/null && echo $2 || echo 0 )
read uchoose
uchoose=$(echo $uchoose | sed -e 's/\(.*\)/\U\1/' -e 's/ //g')
case "$uchoose" in
"YES"|"YE"|"Y")
@zvodd
zvodd / envpython.bat
Last active December 3, 2018 11:49
A batch script to setup python file association and all the required junk for using python on the command line in windows. Useful if you have a few different python installs e.g python 2 & python 3 and maybe a python 2 install in Xampp or Ampps. Simply put the batch file in C:\windows or any folder on you $PATH environment variable and modify th…
@echo off
REM "ftype /?" explains all of this assoc and ftype and PATHEXT usage
REM https://docs.python.org/2/using/windows.html for more info around the subject.
REM set PythonDIR to your python 2 or 3 install path; e.g. the folder with python.exe in it.
set PythonDIR=C:\Python27
set PATH=%PythonDIR%;%PythonDIR%\Scripts;%PATH%
set PYTHONPATH=%PythonDIR%\Lib;%PythonDIR%\Lib\site-packages;%PythonDIR%\DLLs;
set PATHEXT=%PATHEXT%;.PY;.PYW
@zvodd
zvodd / makeascr.py
Created March 27, 2015 18:32
Compile Actiona/Actionaz file from JavaScript files.
import argparse, os, os.path, subprocess, platform
# import inspect
# from pprint import pprint
ACTIONAZ_EXE = ""
ACTIONAZ_VERSIONS = {
'37': dict(script_version="1.0.0", version="3.7.0"),
'38': dict(script_version="1.1.0", version="3.8.0")
}
if platform.system().lower() == "windows":