Skip to content

Instantly share code, notes, and snippets.

View hazcod's full-sized avatar

Niels Hofmans hazcod

View GitHub Profile
@hazcod
hazcod / gumball.sh
Created October 3, 2019 06:50
Download Gumball dutch episodes.
#!/bin/sh
youtube-dl --match-title 'Volledige\sAflevering' \
--output "~/Desktop/%(title)s.%(ext)s" \
https://www.youtube.com/playlist?list=PL-AMfRCN-wkrIC7mps3rmJJU1PmcDY15X
locals {
instanceTcpPorts = ["${var.ssh_port}", 80, 433, 7946]
instanceUdpPorts = [7946, 4789]
managerTcpPorts = ["${var.ssh_port}", 80, 433, 2377, 7946]
managerUdpPorts = [7946, 4789]
}
resource "scaleway_security_group" "swarm_instance" {
name = "swarm_instances"
@hazcod
hazcod / cloudSettings
Last active March 27, 2020 08:59
My VS Code preferences.
{"lastUpload":"2020-01-20T22:00:22.291Z","extensionVersion":"v3.4.3"}
@hazcod
hazcod / cloudbuild.yaml
Last active May 13, 2020 11:27
Clean container registry images in Google Cloud Build step.
substitutions:
_IMG_KEEP: "3"
steps:
- name: 'gcr.io/cloud-builders/gcloud-slim'
entrypoint: 'bash'
args:
- '-c'
@hazcod
hazcod / go-alpine-protobuf.Dockerfile
Last active August 5, 2022 16:52
Use protobuf on golang alpine Docker image.
FROM golang:alpine
RUN apk add --no-cache protobuf git \
&& go get github.com/golang/protobuf/protoc-gen-go \
&& cp /go/bin/protoc-gen-go /usr/bin/
# e.g. find proto -type f -iname '*.proto' -exec protoc -I proto/ --go_out go/ {} \;
@hazcod
hazcod / remove-map-refs.sh
Last active May 13, 2019 08:46
Remove mapping file references using (bsd) sed and find.
find css js -type f \( -iname '*.css' -o -iname '*.js' \) -exec sed -i '' -e 's/sourceMappingURL=[^ ]*\.map//g' {} +
@hazcod
hazcod / genpass.sh
Created February 5, 2019 07:35
Bash snippet to generate a 32-character password with strong entropy.
#!/usr/bin/env sh
LC_ALL=C tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' < /dev/urandom | head -c 32 ; echo
@hazcod
hazcod / btt-work.bttpreset
Last active March 27, 2020 08:59
My BetterTouchTool TouchBar config.
{
"BTTPresetName" : "master",
"BTTGeneralSettings" : {
"BTTPathSampleSize" : 100,
"BTTCMOnTop" : true,
"BTTForceForceClickPressure2F" : 700,
"BSTLeftHalfBlock" : true,
"BTTMinDrawingMovement" : 2,
"BTTTouchBarMouseModeClickBlock" : true,
"BSTRightHalfBlock" : true,
@hazcod
hazcod / feature-policy
Created August 24, 2018 07:00
Full Feature-Policy header
Feature-Policy "accelerometer 'none'; ambient-light-sensor 'none'; animations 'none'; autoplay 'none'; camera 'none'; encrypted-media 'none'; fullscreen 'none'; geolocation 'none'; gyroscope 'none'; image-compression 'none'; legacy-image-formats 'none'; magnetometer 'none'; max-downscaling-image 'none'; microphone 'none'; midi 'none'; payment 'none'; picture-in-picture 'none'; speaker 'none'; sync-xhr 'none'; unsized-media 'none'; usb 'none'; vertical-scroll 'none'; vr 'none'";
@hazcod
hazcod / logger.go
Last active September 22, 2021 14:27
Simple logger that listens for UNIX datagram message and prints them to stdout. We don't like syslog-ng in our postfix container!
package main
import (
"bufio"
"net"
"os"
"syscall"
)
func println(msg string) {