This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def convert(instr, token=','): | |
longtoshort = {'pad' : 'x', | |
'char' : 'c', | |
'schar' : 'b', | |
'uchar' : 'B', | |
'byte' : 'B', | |
'bool' : '?', | |
'short' : 'h', | |
'ushort' : 'H', | |
'int' : 'i', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cart_product_len(sets): | |
""" length of cartasien product space """ | |
p = 1 | |
for n_set in sets: | |
p *= len(n_set) | |
return p | |
def indexable_set_product(sets, index): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
average = lambda L: filter( float, | |
[[0 for acc in [sum(L) ]][-1], | |
[0 for avg in [acc / float(len(L))]][-1], | |
avg] | |
)[-1] | |
average([1,2,3,4,5]) |
OlderNewer