Skip to content

Instantly share code, notes, and snippets.

Avatar
:bowtie:
Not wearing a bowtie

Joar Wandborg joar

:bowtie:
Not wearing a bowtie
View GitHub Profile
View dilllock.py
import threading
import dill
def main():
lock = threading.RLock()
dill_lock = dill.loads(dill.dumps(lock))
print(dill_lock) # Prints as "unlocked"
@joar
joar / async-middleware.md
Created May 4, 2018
GraphQL memory leak
View async-middleware.md
async def monitoring(handler, root, info: ResolveInfo, **kwargs):
    t_start = time.perf_counter()
    result = handler(root, info, **kwargs)

    if not isawaitable(result):
        return result

    result = await result
 duration = max(time.perf_counter() - t_start, 0)
View magic-icon.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joar
joar / README.md
Last active Nov 17, 2017
Hide tabs in Firefox 57
View README.md

Hide tabs in Firefox 57

Place userChrome.css in ~/.mozilla/firefox/*.default/chrome/. Create the chrome folder if it does not exist.

  • Hide the tab bar at the top of the window.
  • Shrink sidebar-header.
  • Make sidebar-header dark.
@joar
joar / gunicorn_logging.py
Created Nov 2, 2017
gunicorn - disable logging configuration
View gunicorn_logging.py
import gunicorn.glogging
import structlog
_logger = structlog.get_logger(__name__)
class Logger(gunicorn.glogging.Logger):
def setup(self, cfg):
"""
@joar
joar / keybase.md
Last active Nov 1, 2017
keybase.md
View keybase.md

Keybase proof

I hereby claim:

  • I am joar on github.
  • I am joar (https://keybase.io/joar) on keybase.
  • I have a public key ASDguJoosHWHVEV2ET5ZsmTMDMbBz9Nf36vJ8ZzIxFEsnQo

To claim this, I am signing this object:

View lib-tty.py
"""Terminal utilities."""
# Author: Steen Lumholt.
from termios import *
__all__ = ["setraw", "setcbreak"]
# Indexes for termios list.
IFLAG = 0
View kubectl.fish
# Subcommand parsing
function __kctl_pos_args
set -l pos_args (__fish_print_cmd_args_without_options)
# echo __fish_print_cmd_args_without_options pos_args $pos_args > /dev/stderr
# remove "kubectl"
set -e pos_args[1]
string join \n $pos_args
end