Skip to content

Instantly share code, notes, and snippets.

L = [int(x) for x in "1307 2716 3449 2758 4597 5191 1465 2259 2829 3004".split()]
N = 20000
array = [[]] + [None for i in range(N-1)]
minimum, route = float("inf"), None
for num in L:
todo = []
for index in range(N):
@mcpower
mcpower / userscript.js
Last active August 29, 2015 14:24
osu! HTML5 audio playback
// ==UserScript==
// @name osu! HTML5 audio playback
// @namespace http://your.homepage/
// @version 0.1
// @description Replaces the osu! Flash audio preview with an HTML5 one.
// @author mcpower
// @match https://osu.ppy.sh/p/beatmaplist*
// @match https://osu.ppy.sh/s/*
// @match https://osu.ppy.sh/b/*
// @grant none
@mcpower
mcpower / grim_patron.md
Last active August 29, 2015 14:16
Grim Patron + Bouncing Blade outcomes

Stats overview:

Attack Health Chance
9 8 16.6667%
6 6 16.6667%
12 10 15.8333%
15 12 13.0556%
18 14 10.2976%
18 13 8.9116%
@mcpower
mcpower / horrible_hacky_code.py
Created March 7, 2015 08:47
Grim Patron + Bouncing Blade
from __future__ import division, print_function # Python 3 backwards compatible (and I'm lazy/hacky)
outcomes = 0
# zip mult sum
# returns [a[0] * amult + b[0] * bmult, a[1] * amult + b[1] * bmult, ...]
def zms(a, b, amult=1, bmult=1):
return list(map(lambda x, y: x * amult + y * bmult, a, b))
# cache decorator
def cache(f):

Question to pythonistas out there: Is it acceptable to reduce indentation by doing:

if blah:
	# do stuff
	return
# do lots of other stuff

instead of: