Skip to content

Instantly share code, notes, and snippets.

View egourlao's full-sized avatar

eric gourlaouen egourlao

View GitHub Profile
@egourlao
egourlao / .gitconfig
Created February 11, 2019 15:49
Dotfiles
[core]
user = Eric Gourlaouen
email = eric@thethingsnetwork.org
[user]
name = Eric Gourlaouen
email = gourlaoueneric@gmail.com
signingkey = 9B8D189E16C7D0183C8A6C27A1368F9ED8110BFD
[color]
@egourlao
egourlao / keybase.md
Created November 30, 2018 09:38
keybase.md

Keybase proof

I hereby claim:

  • I am egourlao on github.
  • I am ericgo (https://keybase.io/ericgo) on keybase.
  • I have a public key ASDw4bzfSZ_RM-qJamfwoiH7-l3SG_fYd8ik0u9vKNGKfAo

To claim this, I am signing this object:

@egourlao
egourlao / go_coverage.sh
Created September 11, 2018 14:40
Show test coverage of the current Go package in the browser
#!/usr/bin/env bash
set -e
go test -coverprofile=cover.out
go tool cover -html=cover.out -o coverage.html
open coverage.html
@egourlao
egourlao / checklist.md
Last active September 10, 2018 13:22
Code review-ready code

Checking if your code is code review-ready

New repositories

  • Check that the license is present on every file
    • You can also add a license-verifying helper

Comments

  • Check the every comment is valid
@egourlao
egourlao / example.py
Created August 12, 2018 12:56
Using `iter` to detect sentinel values in Python
#!/usr/bin/env python3
list = [1, 2, 3, 4]
i = 0
def read_list():
global i
v = list[i]
i = i + 1
return v
@egourlao
egourlao / context_manager_example.py
Created August 11, 2018 16:28
Context Manager example in Python
#!/usr/bin/env python3
class Indenter:
def __init__(self):
self.counter = 1
def __enter__(self):
return self
def __exit__(self, type, value, traceback):
return
def print(self, msg):
@egourlao
egourlao / tcpserv.go
Last active June 8, 2018 09:11
TCP server Go snippet
package main
import (
"io"
"log"
"net"
"os"
)
func main() {

Keybase proof

I hereby claim:

  • I am dotpy3 on github.
  • I am ericgo (https://keybase.io/ericgo) on keybase.
  • I have a public key ASBUaM5cNmoJHfcxQ0MhRzM0kyA9kPDxj8CYRLK0kVGVego

To claim this, I am signing this object:

@egourlao
egourlao / queue.go
Last active March 26, 2017 19:56
A simple go Queue implementation
type Queue []int
func (q *Queue) Enqueue(i int) {
queue := append(*q, i)
*q = queue
}
func (q *Queue) Dequeue() (int, bool) {
if len(*q) == 0 {
return 0, false