This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from importlib import invalidate_caches | |
from importlib.abc import MetaPathFinder | |
from importlib.machinery import ModuleSpec, SourceFileLoader | |
from os.path import dirname, join, abspath, isdir, isfile | |
class Finder(MetaPathFinder): | |
def find_spec(self, fullname, path, target=None): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = [ | |
{ | |
"id": 0, | |
"name": "Americano", | |
"price": 1.99 | |
}, | |
{ | |
"id": 1, | |
"name": "Espresso", | |
"price": 1.49 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install ARCH Linux with encrypted file-system and UEFI | |
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description. | |
# Download the archiso image from https://www.archlinux.org/ | |
# Copy to a usb-drive | |
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux | |
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration. | |
# Set swedish keymap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Names { | |
public final static String[] NAMES = { | |
"Britteny Bisignano", | |
"Vania Millikan", | |
"Ching Atnip", | |
"Willie Happ", | |
"Renata Dower", | |
"Jillian Beauchemin", | |
"Garth Bixby", | |
"Jared Honea", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am demianbrecht on github. | |
* I am demianbrecht (https://keybase.io/demianbrecht) on keybase. | |
* I have a public key whose fingerprint is 9ACF B014 BA1E 5B49 39AC A3B2 14E4 E967 42F2 2903 | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am demianbrecht on github. | |
* I am demianbrecht (https://keybase.io/demianbrecht) on keybase. | |
* I have a public key ASAjnGMDvetEdQG2Y1LqHHKt95oUkYpz6AMU0Hg6-AwDjwo | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
docker rm $(docker ps -aqf status=exited) | |
docker-machine ssh default docker volume rm $(docker-machine ssh default docker volume ls -qf dangling=true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import abc | |
def _new(mcls, name, bases, dct): | |
cls = type.__new__(mcls, name, bases, dct) | |
abstracts = set() | |
for k, v in filter(lambda o: not o[0].startswith('__'), | |
mcls.__looks_like__.__dict__.items()): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _get_content_length(body, method): | |
# Get the content-length based on the body. If the body is "empty", we | |
# set Content-Length: 0 for methods that expect a body (RFC 7230, | |
# Section 3.3.2). If the body is set for other methods, we set the | |
# header provided we can figure out what the length is. | |
if not body: | |
# do an explicit check for not None here to distinguish between unset | |
# and set but empty | |
if method.upper() in _METHODS_EXPECTING_BODY or body is not None: | |
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import cherrypy | |
from pprint import pprint | |
class Root: | |
@cherrypy.expose | |
def index(self): | |
pprint(cherrypy.request.headers) | |
print(cherrypy.request.body.read()) | |
return '' |
NewerOlder