Skip to content

Instantly share code, notes, and snippets.

Alessio defacto133

  • Italy
Block or report user

Report or block defacto133

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View balls.py
def choose(n, k):
"""
A fast way to calculate binomial coefficients by Andrew Dalke (contrib).
"""
if 0 <= k <= n:
ntok = 1
ktok = 1
for t in xrange(1, min(k, n - k) + 1):
ntok *= n
ktok *= t
View coins.py
def fib_n_step_aux(n, k, memo):
if k <= 0:
return 0
if k in [1, 2]:
return 1
if k not in memo:
res = 0
for i in range(1, n + 1):
res += fib_n_step_aux(n, k - i, memo)
memo[k] = res
@defacto133
defacto133 / tmt20ii_status.php
Last active May 22, 2019
Get TM-T20II Epson ASB status through UDP socket
View tmt20ii_status.php
/*
* $status = {
* "status": "online" | "offline",
* "cover": "open" | "closed", (opt)
* "feeding": "feeding" | "not", (opt)
* "autocutterError": "error" | "not", (opt)
* "unrecoverableError": "error" | "not", (opt)
* "recoverableError": "error" | "not", (opt)
* "paper": "paperEnd" | "paperPresent" (opt)
* }
You can’t perform that action at this time.