Skip to content

Instantly share code, notes, and snippets.

View 524c's full-sized avatar

Roger Lucas 524c

View GitHub Profile
@524c
524c / kubectl-delete_all
Created January 28, 2023 14:00 — forked from superbrothers/kubectl-delete_all
Kubernetes: Delete all objects in the namespace
kubectl delete "$(kubectl api-resources --namespaced=true --verbs=delete -o name | tr "\n" "," | sed -e 's/,$//')" --all
@524c
524c / k3s-cluster.md
Created January 27, 2023 02:18 — forked from kopwei/k3s-cluster.md
K3s and Rancher on Raspberry Pi 4 Cluster

Deploy K3s and Rancher on Raspberry Pi 4 cluster

Today I tried to setup a small Kubernetes cluster on top of 3 Raspberry Pi 4 (4GB Memory). Here is the steps to install the cluster.

IMG_3817

Preparation

I have 3 Raspberry Pi 4 stacked with PoE headers and connected to a PoE switch at home. The are connected to Internet through a home router. All Pis are equipped with a 64GB Samsung SDXC card flushed with Ubuntu 20.04 image.

@524c
524c / RASPBERRY_PI_4.md
Created November 2, 2022 18:22 — forked from lucaguada/RASPBERRY_PI_4.md
Steps to fully install Ubuntu Server and MiniKube on Raspberry Pi 4 (wip)

How to install Ubuntu Server and Minikube on Raspberry Pi 4 4GB+ (recommended)

Disclaimer: this step-by-step GIST has been created with no guarantees, I may have missed some steps because of distraction or chiptune improvised on-chair-dancing, so be patient and let me know if I must add or fix something.

This is the way for living long and prospering!

Download Raspberry Pi Imager

Download and install Raspberry Imager: https://www.raspberrypi.org/software/

@524c
524c / hooks.js
Created October 4, 2022 14:21 — forked from acoyfellow/hooks.js
hooks.js CSP example
// https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
// https://scotthelme.co.uk/content-security-policy-an-introduction/
// scanner: https://securityheaders.com/
const rootDomain = `your-domain.com`; // or your server IP for dev
const directives = {
'img-src': [
"*",
"'self'",
@524c
524c / semantic-commit-messages.md
Created October 4, 2022 01:09 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

// Core assets
let coreAssets = [];
// On install, cache core assets
self.addEventListener('install', function (event) {
// Cache core assets
event.waitUntil(caches.open('app').then(function (cache) {
for (let asset of coreAssets) {
cache.add(new Request(asset));
@524c
524c / IndexedDB101.js
Created September 24, 2022 19:51 — forked from JamesMessinger/IndexedDB101.js
Very Simple IndexedDB Example
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
// Open (or create) the database
var open = indexedDB.open("MyDatabase", 1);
// Create the schema
open.onupgradeneeded = function() {
var db = open.result;
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"});
@524c
524c / node-sass.md
Created April 12, 2022 00:51 — forked from tandavala/node-sass.md
Como usar sass com node js

node-sass

Sass é uma linguagem de script que é interpretada ou compilada em Cascading Style Sheets (CSS). e neste GIST estarei demonstrando como usar sass com node js.

Primeiro passo

Iniciar um projecto do zero com a framework express

mkdir node_sass
@524c
524c / a-qemu-install-debian-arm64.sh
Created February 16, 2022 14:48 — forked from penglei/a-qemu-install-debian-arm64.sh
run qemu-aarch64 on macOS
#!/bin/bash
#qemu-img create -f qcow2 disk.qcow2 20G
#qemu-img create -f qcow2 varstore.img 128M
debian_iso=debian-9.6.0-arm64-xfce-CD-1.iso
qemu-system-aarch64 -smp cpus=6 -M virt -cpu max -m 2G -nographic \
-drive file=QEMU_EFI.img,if=pflash,format=raw \
-drive file=varstore.img,if=pflash \
-drive file=disk.qcow2,if=virtio \
-drive file=$debian_iso,if=virtio,format=raw
@524c
524c / gist:de362864268c650b42d2b244ee55da04
Created February 6, 2022 23:36 — forked from tingleshao/gist:cae2a764c60e3d002c68bb7f779489c4
ffmpeg compress with certain bitrate and resolution
ffmpeg -i jellyfish-120-mbps-4k-uhd-h264.mkv -c:v libx264 -profile:v main -vf scale=1920:1080 -b:v 50000k -an -tune fastdecode -coder 0 -flags -loop -g 30 -bf 0 -t 10 jellyfish-hd-50mbps_main_nosound_fast_short.mp4