Skip to content

Instantly share code, notes, and snippets.

View arusahni's full-sized avatar

Aru Sahni arusahni

View GitHub Profile

aspe:keyoxide.org:VCUCH7HSNW3ZCAQWTMUZKAXFQ4

@arusahni
arusahni / main.py
Created June 19, 2020 19:09
MyPy fail
#!/usr/bin/env python3
import mod
def do_the_thing():
bar = mod.get_optional_bar()
print(bar.x)
if __name__ == "__main__":
@arusahni
arusahni / pokemongo-keepscreen.xml
Created July 13, 2016 12:57
PokémonGo KeepScreen
<TaskerData sr="" dvi="1" tv="4.8u5m">
<Profile sr="prof11" ve="2">
<cdate>1468408605911</cdate>
<edate>1468408798206</edate>
<id>11</id>
<mid0>12</mid0>
<nme>PokémonGo</nme>
<App sr="con0" ve="2">
<cls0>com.unity3d.player.UnityPlayerNativeActivity</cls0>
<flags>2</flags>
snippet fun "function with dynamic docblock" b
`!p
# Currently Ultisnips does not support dynamic tabstops, so we cannot add
# tabstops to the datatype for these param tags until that feature is added.
def formatTag(argument):
return " * @param {{}} {0}".format(argument)
tags = [formatTag(argument.strip()) for argument in t[2].split(',') if argument]
if tags:

Keybase proof

I hereby claim:

  • I am arusahni on github.
  • I am aru (https://keybase.io/aru) on keybase.
  • I have a public key whose fingerprint is 2011 76AC B21E 3246 2373 2D65 B1FF 0FEB 6864 4ED4

To claim this, I am signing this object:

@arusahni
arusahni / nocache.py
Last active December 28, 2022 13:12
Flask nocache decorator
from flask import make_response
from functools import wraps, update_wrapper
from datetime import datetime
def nocache(view):
@wraps(view)
def no_cache(*args, **kwargs):
response = make_response(view(*args, **kwargs))
response.headers['Last-Modified'] = datetime.now()
response.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0'
@arusahni
arusahni / runserver.sh
Last active December 19, 2015 15:29
A lightweight wrapper for launching wdb alongside a dev web server, and killing it when the web server is killed.
#!/bin/bash
function cleanup {
echo ""
echo "Kill signal detected. Killing wdb server."
kill 0
}
trap cleanup EXIT
echo "Starting wdb server..."