Skip to content

Instantly share code, notes, and snippets.

Avatar
♨️
❨╯°□°❩╯︵┸━┸

mdouchement mdouchement

♨️
❨╯°□°❩╯︵┸━┸
View GitHub Profile
@mdouchement
mdouchement / steam-link.md
Last active Apr 12, 2022
Steam Link SSH & how to disable Bluetooth
View steam-link.md
@mdouchement
mdouchement / lehmer.go
Last active Sep 11, 2020
Lehmer random bytes slice generator
View lehmer.go
package main
import (
"fmt"
"time"
)
func main() {
seed := uint64(time.Now().UnixNano())
p := make([]byte, 128)
@mdouchement
mdouchement / Dockerfile
Created Oct 6, 2019
Custom Dockerfile for github.com/root-gg/plik
View Dockerfile
# build stage
FROM golang:1.13-alpine as build-env
MAINTAINER mdouchement
# Set the locale
ENV LANG c.UTF-8
# Install build dependencies
RUN apk upgrade
RUN apk add --update --no-cache \
@mdouchement
mdouchement / gvm_disable_gopath_handling.go
Last active Sep 25, 2018
Disable GVM GOPATH handling
View gvm_disable_gopath_handling.go
// This Go script will disable annoying GVM GOPATH management.
// Based on https://github.com/e-nikolov/gvm repository
//
// MIT License
package main
import (
"bytes"
"fmt"
@mdouchement
mdouchement / camelcase.go
Created Nov 16, 2017
Golang camelcase / camelize
View camelcase.go
package main
import (
"fmt"
"unicode"
)
func main() {
for _, v := range []string{"target_prob1", "target_prob_1", "_target_prob_1", "target_prob_1_"} {
fmt.Printf("%s => %s\n", v, ToCamel(v))
@mdouchement
mdouchement / .gitrc.sh
Last active Dec 19, 2018
Git aliases from ZSH (without zsh)
View .gitrc.sh
alias gco='git checkout'
alias gb='git branch'
alias gd='git diff'
alias glgg='git log --graph --max-count=10'
alias glgga='git log --graph --decorate --all'
alias gst='git status'
alias gss='git status --short'
alias ga='git add'
alias gc='git commit'
alias ggpull='git pull origin $(git rev-parse --abbrev-ref HEAD)'
@mdouchement
mdouchement / gzip_bug.go
Last active Jun 19, 2017
Golang gzip reader does not returns the right error.
View gzip_bug.go
package main
import (
"bytes"
"compress/gzip"
"errors"
"fmt"
"io"
)
@mdouchement
mdouchement / go.md
Last active Jan 25, 2017
Useful Golang packages
View go.md

Static Build

CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' *.go

Objects

  • structs
    • Various utilities to work with Go (Golang) structs.
    • map[string]interface{} struct conversion.
  • github.com/fatih/structs
@mdouchement
mdouchement / rate_limiter.go
Created Jul 10, 2016
Goroutine rate limiter
View rate_limiter.go
package main
import (
"fmt"
"sync"
"time"
)
// limiter is a counting semaphore for limiting concurrency in action function.
var limiter = make(chan struct{}, 4)
View diskv_serializer.go
package main
import (
"bytes"
"encoding/gob"
"fmt"
"github.com/peterbourgon/diskv"
)