Skip to content

Instantly share code, notes, and snippets.

@jacob-faber
jacob-faber / Matlibplot tutorial.ipynb
Last active April 5, 2016 09:48
Sample IPython notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jacob-faber
jacob-faber / os_arch.go
Last active July 25, 2020 18:29
Golang build flags
// Go 1.6.1, Some combinations are valid, some not
// The known operating systems.
var okgoos = []string{
"darwin",
"dragonfly",
"linux",
"android",
"solaris",
"freebsd",
"nacl",
@jacob-faber
jacob-faber / cache.py
Created August 18, 2016 16:52
lru_cache
from functools import lru_cache
# Without cache:
# User time (seconds): 29.46
# Maximum resident set size (kbytes): 9724
# With cache:
# User time (seconds): 2.34
# Maximum resident set size (kbytes): 297288
# CacheInfo(hits=999998, misses=2168611, maxsize=None, currsize=2168611)
from timeit import timeit
setup_chunks_iter = '''
def chunks_iter(n, seq):
"""Chunks from iterable"""
for i in range(0, len(seq), n):
yield seq[i:i + n]
'''
setup_chunks_gen = '''
#!/usr/bin/env bash
ITERS=8000
FILE="mandelbrot.py"
PY_3_5_PATH="python3.5"
PY_3_6_PATH="python3.6"
PYPY_3_PATH="/opt/pypy/pypy3-v5.5.0-linux64/bin/pypy3"
import time
import pyscreenshot as ImageGrab
import wx
def main():
count = 10
area = (0, 0, 1920, 1080)
fun main(args: Array<String>) {
`fuck this shit`()
` `()
ľščťžýáél9()
}
fun `fuck this shit`() {
println("Hello from `fuck this shit`")
}
@jacob-faber
jacob-faber / cheatsheet.md
Created August 22, 2017 06:45 — forked from hay/cheatsheet.md
Hay's dev cheatsheet
@jacob-faber
jacob-faber / loggers.py
Last active May 24, 2018 11:20
Loggers
import logging.handlers
logger = logging.getLogger("loggers")
class CustomFormatter(logging.Formatter):
def format(self, record):
return f"{record.levelname} | {record.filename}:{record.levelno}:{record.lineno} | {record.msg}"
@jacob-faber
jacob-faber / docker-cleanup-resources.md
Created July 13, 2018 07:07 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm