Skip to content

Instantly share code, notes, and snippets.

Avatar
🐳
petting containers 😎

crazyoptimist crazyoptimist

🐳
petting containers 😎
View GitHub Profile
@crazyoptimist
crazyoptimist / debounce.ts
Created Jul 5, 2022
Debounce Wrapper in Typescript
View debounce.ts
export function debounce<T extends unknown[], U>(
callback: (...args: T) => U,
wait: number,
): (...args: T) => void {
let timer: NodeJS.Timeout | undefined = undefined
return (...args: T): void => {
if (timer) {
clearTimeout(timer)
}
@crazyoptimist
crazyoptimist / install-kubeadmin.sh
Created Apr 22, 2022
Install kubeadmin on debian based OS
View install-kubeadmin.sh
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
@crazyoptimist
crazyoptimist / install-containerd.sh
Last active Apr 22, 2022
Install containerd on debian based OS
View install-containerd.sh
cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf
overlay
br_netfilter
EOF
sudo modprobe overlay
sudo modprobe br_netfilter
# Setup required sysctl params, these persist across reboots.
cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
@crazyoptimist
crazyoptimist / values_pointers.go
Created Mar 30, 2022 — forked from josephspurrier/values_pointers.go
Golang - Asterisk and Ampersand Cheatsheet
View values_pointers.go
/*
********************************************************************************
Golang - Asterisk and Ampersand Cheatsheet
********************************************************************************
Also available at: https://play.golang.org/p/lNpnS9j1ma
Allowed:
--------
p := Person{"Steve", 28} stores the value
@crazyoptimist
crazyoptimist / serve.go
Created Sep 14, 2021 — forked from paulmach/serve.go
Simple Static File Server in Go
View serve.go
/*
Serve is a very simple static file server in go
Usage:
-p="8100": port to serve on
-d=".": the directory of static files to host
Navigating to http://localhost:8100 will display the index.html or directory
listing file.
*/
package main
@crazyoptimist
crazyoptimist / linux-cheatsheet.md
Last active Jul 26, 2022
crazyoptimist's linux cheatsheet
View linux-cheatsheet.md

Run it again as root

sudo !!

Re-type the last argument

Alt+.

Search for a command I ran before

Ctrl+R

Go back to your home directory

cd

Go back to the last directory

cd -

@crazyoptimist
crazyoptimist / keybase.md
Last active Jul 6, 2021
Identify myself
View keybase.md

Keybase proof

I hereby claim:

  • I am crazyoptimist on github.
  • I am crazyoptimist (https://keybase.io/crazyoptimist) on keybase.
  • I have a public key ASBOZYQELQh5OPS5QSfheyAb-tMCaiQm-EhlAuHJncxPMQo

To claim this, I am signing this object:

@crazyoptimist
crazyoptimist / vim-install-note.md
Created Apr 25, 2021
Install Vim From the Source on Fedora/CentOS
View vim-install-note.md

Installing Vim by building from the source needs bunch of dependancies.

Setup essential build environment

yum -y groupinstall "Development Tools"
yum -y install ncurses-devel git-core

Get the source

View docker-compose.yaml
version: "3.9"
services:
redis:
image: redis:6
container_name: redis
command: "redis-server --loglevel warning"
volumes:
- ./redis_data:/data/
ports:
- "6379:6379"
@crazyoptimist
crazyoptimist / docker-compose.yaml
Last active Mar 3, 2021
Redis Management Via Web GUI
View docker-compose.yaml
version: '3'
services:
redis-commander:
container_name: redis-commander
image: rediscommander/redis-commander:latest
restart: always
environment:
- REDIS_HOST=172.17.0.1
- REDIS_PORT=6379
- REDIS_DB=1 # any name you like to give your redis database