Skip to content

Instantly share code, notes, and snippets.

View nexus166's full-sized avatar
🌪️
🐧

nexus166

🌪️
🐧
  • Earth
View GitHub Profile
@nexus166
nexus166 / golang-tls.md
Last active March 9, 2019 19:51 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@nexus166
nexus166 / web-servers.md
Created March 16, 2019 15:19 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@nexus166
nexus166 / kubectl-root-in-host.sh
Last active May 24, 2019 05:12 — forked from jjo/kubectl-root-in-host-nopriv.sh
`privileged: true` + `nsenter`
#!/bin/sh
node=${1}
if [ -n "${node}" ]; then
shift
nodeName=$(kubectl get node ${node} -o template --template='{{index .metadata.labels "kubernetes.io/hostname"}}') || exit 1
nodeSelector='"nodeSelector": { "kubernetes.io/hostname": "'${nodeName:?}'" },'
podName=${USER+${USER}-}sudo-${node}
else
nodeSelector=""
podName=${USER+${USER}-}sudo
apiVersion: kubeadm.k8s.io/v1beta1
kind: ClusterConfiguration
kubernetesVersion: v1.14.3 # change according to kubeadm supported version
apiServer:
certSANs:
- 127.0.0.1
- cluster-api.example.com # change according to your requirements
extraArgs:
authorization-mode: Node,RBAC
feature-gates: "TTLAfterFinished=true"
@nexus166
nexus166 / emoji.go
Last active November 5, 2019 02:27 — forked from YamiOdymel/emoji.go
golang codepage emojis
package main
import (
"fmt"
"html"
)
func main() {
// Hexadecimal ranges from: http://unicode.myseosolution.de/
emoji := [][]int{
@nexus166
nexus166 / tpm2.0-fulldisk-decryption-at-boot.md
Created January 21, 2020 13:28 — forked from stengoes/tpm2.0-fulldisk-decryption-at-boot.md
Setup TPM2.0 for full disk decryption at boot

First step: install tpm2-tss, tpm2-tools and all its depedencies.

# Install dependencies
sudo apt-get update && sudo apt-get -y install autoconf autoconf-archive automake libtool pkg-config gcc libssl-dev libcurl4-gnutls-dev doxygen

# Install tpm2-tss
git clone https://github.com/tpm2-software/tpm2-tss.git
cd tpm2-tss
git checkout e05d28ec  # I used this particular commit
./bootstrap

Problem

In Arch Linux mkinitcpio -p linux

shows

Possibly missing firmware for module: aic94xx
 Possibly missing firmware for module: wd719x
@nexus166
nexus166 / sshd.go
Created February 23, 2020 17:07 — forked from jpillora/sshd.go
Go SSH server complete example - Read more here https://blog.gopheracademy.com/go-and-ssh/
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client:
@nexus166
nexus166 / fake-uname.c
Created March 18, 2020 16:39 — forked from DamnedFacts/fake-uname.c
Fake uname information in order to make tools, such as megacli, work: Gentoo-11 tmp # gcc -Wall -fPIC -c fake-uname.c Gentoo-11 tmp # gcc -Wall -shared -o libfake-uname.so fake-uname.o Now we get libfake-uname.so, use LD_PRELOAD=./libfake-uname.so to preload it, over uname from glibc: Gentoo-11 tmp # LD_PRELOAD=./libfake-uname.so LD_LIBRARY_PATH…
#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <stdio.h>
#include <string.h>
int uname(struct utsname *buf)