Skip to content

Instantly share code, notes, and snippets.

@jacob-faber
jacob-faber / switch-local-git-repo-to-fork.md
Created July 20, 2018 13:16 — forked from jpierson/switch-local-git-repo-to-fork.md
How to move to a fork after cloning

If you are like me you find yourself cloning a repo, making some proposed changes and then deciding to later contributing back using the GitHub Flow convention. Below is a set of instructions I've developed for myself on how to deal with this scenario and an explanation of why it matters based on jagregory's gist.

To follow GitHub flow you should really have created a fork initially as a public representation of the forked repository and the clone that instead. My understanding is that the typical setup would have your local repository pointing to your fork as origin and the original forked repository as upstream so that you can use these keywords in other git commands.

  1. Clone some repo (you've probably already done this step)

@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

@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 / cheatsheet.md
Created August 22, 2017 06:45 — forked from hay/cheatsheet.md
Hay's dev cheatsheet
fun main(args: Array<String>) {
`fuck this shit`()
` `()
ľščťžýáél9()
}
fun `fuck this shit`() {
println("Hello from `fuck this shit`")
}
import time
import pyscreenshot as ImageGrab
import wx
def main():
count = 10
area = (0, 0, 1920, 1080)
#!/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"
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 = '''
@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)
@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",