Skip to content

Instantly share code, notes, and snippets.

View hazcod's full-sized avatar

Niels Hofmans hazcod

View GitHub Profile
@hazcod
hazcod / telenet-modem-firewall.txt
Created March 26, 2020 14:54
Telenet modem firewall ruleset.
# Generated by iptables-save v1.4.21 on Sun Jan 19 08:14:54 2020
*raw
:PREROUTING ACCEPT [17478:786616]
:OUTPUT ACCEPT [15285:6842393]
COMMIT
# Completed on Sun Jan 19 08:14:54 2020
# Generated by iptables-save v1.4.21 on Sun Jan 19 08:14:54 2020
*nat
:PREROUTING ACCEPT [412:43501]
:INPUT ACCEPT [54:3686]
@hazcod
hazcod / github-archive-org.sh
Created November 28, 2019 10:47
Clone all your organization repositories on GitHub.
#!/usr/bin/env bash
# will ask for your personal access token
GH_USER=""
GH_ORG=""
curl -u "${GH_USERNAME}" -s "https://api.github.com/orgs/${GH_ORG}/repos?per_page=200" | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
@hazcod
hazcod / wgcf.sh
Created October 16, 2019 06:10
Connect to Cloudflare Warp from macOS.
#!/usr/bin/env bash
set -euo pipefail
shopt -s inherit_errexit 2>/dev/null || true
# this script will connect macOS to Cloudflare Warp using Wireguard
# note: this is *absolutely not* an official client from Cloudflare
# Copyright (C) 2019 Jay Freeman (saurik)
# Zero Clause BSD license {{{
@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