Skip to content

Instantly share code, notes, and snippets.

@nullhack
nullhack / docker-compose.yml
Last active May 20, 2021 12:07
Example of docker compose with traefik, https enabled, basicauth, redis and postgres via tcp and load balance
version: "3.3"
services:
traefik:
image: "traefik:v2.4"
container_name: "traefik"
command:
- "--providers.docker.endpoint=unix:///var/run/docker.sock"
- "--providers.docker=true"
@nullhack
nullhack / postOffice.py
Last active November 2, 2016 16:57
Simulates a post office
"""Licensed under GPLv3 <http://www.gnu.org/licenses/>.
Authors:
Eric Lopes
"""
import random
import sys
class PostOffice:
def __init__(self):
@nullhack
nullhack / digits.py
Created November 2, 2016 12:15
How many 18-digit number is there such that no digit occurs more than 3 times. All numbers start with a non-zero digit.
"""Licensed under GPLv3 <http://www.gnu.org/licenses/>.
Authors:
Santiago Alessandri
Eric Lopes
"""
helpTable = {
(1, 5) : 5,
(1, 4) : 6,
(1, 3) : 7,
(1, 2) : 8,
@nullhack
nullhack / weather.py
Last active November 2, 2016 12:30
Compute the stationary values for W
"""Licensed under GPLv3 <http://www.gnu.org/licenses/>.
Authors:
Eric Lopes
"""
import scipy.linalg
import numpy
W = numpy.matrix(
[[0.4 ,0.4 ,0.2 ,0.0],
[0.2 ,0.2 ,0.3 ,0.3],
@nullhack
nullhack / MaxFrom3Rolls.py
Last active November 2, 2016 12:30
Best reward from 3 rolls using Monte Carlo Experiment
"""Licensed under GPLv3 <http://www.gnu.org/licenses/>.
Authors:
Eric Lopes
"""
import random
def roll(x=[6,6]):
for i in range(2):
v=random.randint(1,6)
if v>=x[i]: return v
v=random.randint(1,6)
@nullhack
nullhack / English Grammar.md
Last active October 26, 2016 12:58
This file is a transcription of internet content about english grammar for study purposes
@nullhack
nullhack / bobp-python.md
Created September 30, 2016 19:37 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens

The Bitcoin Blockchain

The blockchain provides Bitcoin's ledger, a timestamped record of all confirmed transactions. Under normal conditions, a new block of transactions is added to the blockchain approximately every 10 minutes and historic blocks are left unchanged.

This document will describe for developers this normal operating