Skip to content

Instantly share code, notes, and snippets.

View joar's full-sized avatar
:bowtie:
Not wearing a bowtie

Joar Wandborg joar

:bowtie:
Not wearing a bowtie
View GitHub Profile
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 09:53
GraphQL memory leak
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)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joar
joar / test.rst
Last active January 2, 2018 12:45

Note

Single colon

kubectl snippets

List Pods by Node

@joar
joar / README.md
Last active November 17, 2017 13:42
Hide tabs in Firefox 57

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 November 2, 2017 15:11
gunicorn - disable logging configuration
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 November 1, 2017 16:49
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:

@joar
joar / lib-tty.py
Last active November 21, 2017 12:26
"""Terminal utilities."""
# Author: Steen Lumholt.
from termios import *
__all__ = ["setraw", "setcbreak"]
# Indexes for termios list.
IFLAG = 0
# 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