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
from dragn.dice import D6, D10 | |
def explode() -> int: | |
roll = D10() | |
if roll == 10: | |
return roll + explode() | |
else: | |
return roll | |
def rolld10() -> int: |
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 asyncio | |
from aiohttp import web | |
from concurrent.futures import ThreadPoolExecutor | |
import time | |
def blocking_func(seconds: int) -> int: | |
time.sleep(seconds) | |
return seconds |
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 aiohttp | |
from aiohttp import web | |
from http import HTTPStatus | |
from typing import AsyncGenerator | |
from dataclasses import dataclass | |
@dataclass | |
class Config: | |
timeout: int |
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
FROM alpine:3.9 AS build | |
WORKDIR /opt/app | |
# Install Python and external dependencies, including headers and GCC | |
RUN apk add --no-cache python3 python3-dev py3-pip libffi libffi-dev musl-dev gcc | |
# Install Pipenv | |
RUN pip3 install pipenv | |
# Create a virtual environment and activate it |
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
[ | |
{ "key": "ctrl+`", "command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus" }, | |
{ "key": "ctrl+`", "command": "workbench.action.terminal.focus", "when": "!terminalFocus" }, | |
] |
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
""" | |
Split large polygons into smaller parts for faster intersections | |
https://snorfalorpagus.net/blog/2016/03/13/splitting-large-polygons-for-faster-intersections/ | |
""" | |
##Input=vector | |
##Threshold=number 500.0 | |
##Recursion=number 250 | |
##Output=output vector |
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
var fs = require("fs"); | |
var d3 = require("d3"); | |
var jsdom = require("jsdom/lib/old-api"); | |
var svg2png = require("svg2png") | |
var width = 400; | |
var height = 300; | |
jsdom.env({ | |
html:'', |
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 fiona | |
from shapely.geometry import shape, mapping | |
import multiprocessing | |
import time | |
import functools | |
import copy | |
def factory(f, chunksize=50): | |
def wrapped(features, **kwargs): | |
pool = kwargs.pop("pool", 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
import RPi.GPIO as GPIO | |
import threading | |
GPIO.setmode(GPIO.BCM) | |
class RotaryEncoder: | |
def __init__(self, pin_a, pin_b): | |
self.pin_a = pin_a | |
self.pin_b = pin_b |
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/bash | |
# quit immediately on error | |
set -e | |
# install miniconda | |
rm -rf /opt/miniconda3 | |
mkdir -p /opt/miniconda3 | |
ln -f -s /opt/miniconda3 ~/miniconda3 | |
CONDA_SCRIPT="Miniconda3-latest-Linux-x86_64.sh" |
NewerOlder