Skip to content

Instantly share code, notes, and snippets.

View bernardotorres's full-sized avatar

Bernardo Torres bernardotorres

  • NewStore Inc.
  • Berlin
View GitHub Profile
@fabiojmendes
fabiojmendes / wg0.conf
Created December 19, 2022 19:07
Wireguard vpn nat proxy
# ---------- Server Config ----------
# vim: ft=conf
#
# Make sure ip forwarding is enabled
# net.ipv4.ip_forward=1
# net.ipv6.conf.all.forwarding=1
[Interface]
# IPV4 CIDR
Address = 10.10.0.1/24
@kennwhite
kennwhite / 1944_OSS_Simple_Sabotage_Field_Manual.md
Last active April 5, 2024 02:51
1944 OSS Simple Sabotage Field Manual
@JoaoGFarias
JoaoGFarias / data.csv
Created August 1, 2015 16:28
Projetando as contas parceladas
Loja 1 07/06 24.99
@drgarcia1986
drgarcia1986 / schools_async.py
Created June 29, 2015 21:59
Escolas, em funcionamento, sem água, energia e esgoto, mostrando alguns detalhes (versão asyncio) (baseado em https://gist.github.com/fmasanori/4d6b7ea38a28681a513a)
import asyncio
import json
import aiohttp
SCHOOL_URL_FMT = 'http://educacao.dadosabertosbr.com/api/escola/{}'
SEARCH_SCHOOL_URL = (
'http://educacao.dadosabertosbr.com/api/escolas/buscaavancada?'
'situacaoFuncionamento=1&energiaInexistente=on&aguaInexistente=on&'
@rusllonrails
rusllonrails / UBUNTU DOCKER FIG ERROR
Created August 14, 2014 12:16
UBUNTU DOCKER FIG ERROR
FIX FOR: Couldn't connect to Docker daemon at http+unix://var/run/docker.sock - is it running?
Change the DOCKER_OPTS in /etc/default/docker to:
DOCKER_OPTS="-H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock"
Ruslan Khamidullin [1:57 PM] netstat -ant |grep 4243
tcp 0 0 127.0.0.1:4243 0.0.0.0:* LISTEN
Ruslan Khamidullin [1:57 PM] export DOCKER_HOST=tcp://localhost:4243
@why-not
why-not / gist:4582705
Last active February 1, 2024 00:44
Pandas recipe. I find pandas indexing counter intuitive, perhaps my intuitions were shaped by many years in the imperative world. I am collecting some recipes to do things quickly in pandas & to jog my memory.
"""making a dataframe"""
df = pd.DataFrame([[1, 2], [3, 4]], columns=list('AB'))
"""quick way to create an interesting data frame to try things out"""
df = pd.DataFrame(np.random.randn(5, 4), columns=['a', 'b', 'c', 'd'])
"""convert a dictionary into a DataFrame"""
"""make the keys into columns"""
df = pd.DataFrame(dic, index=[0])
@devn
devn / state-is-a-fold.clj
Created June 21, 2011 00:16 — forked from ordnungswidrig/state-is-a-fold.clj
State is a fold over events
(ns state-is-a-fold
(:use clojure.test))
;;; After all, state is a fold of events. For example let's say the events are a sequence of numbers
;;; and we are folding by addition:
(deftest simple
(let [events [1 5 2 4 3]
state (reduce + events)]
(is (= 15 state))))