Skip to content

Instantly share code, notes, and snippets.

lalyos /
Last active March 27, 2023 10:40
k8s etcd list keys

You can demostrate how kubernetes stores everything in etcd (v3):


You can exec etcdctl rigth in the etc pod:

kubectl exec -it \
  -n kube-system etcd-minikube \
  -- sh -c 'ETCDCTL_CACERT=/var/lib/localkube/certs/etcd/ca.crt \
 ETCDCTL_CERT=/var/lib/localkube/certs/etcd/peer.crt \
lalyos /
Created November 21, 2014 20:43
script to save all docker image, and load them back
reload() {
source ${BASH_SOURCE[0]}
alias r=reload
get-image-field() {
local imageId=$1
local field=$2
: ${imageId:? reuired}
lalyos /
Last active February 28, 2023 03:38
proxy docker /var/run/docker.sock to port 2375 with socat

The new Docker daemon uses port: 2376 with TLS enable by default. Sometimes I want to play with curl on the old plain http port 2375. The trick is: use socat in a container to proxy the unix socket to a real port.

docker run -d \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --name docker-http \
  deb socat -d -d TCP-L:2375,fork UNIX:/var/run/docker.sock
lalyos /
Last active December 16, 2022 11:44
install golang to ubuntu/debian one-linet

Install latest golang

curl -Ls | bash


If you want to install golang, normally you are following the description on the official dowload page

lalyos /
Last active October 19, 2022 15:39
Recording bash's standard out

If you want to store all stdout while runing an interactive bash:


curl -Lo /usr/local/bin/cybash
chmod +x /usr/local/bin/cybash


lalyos / Dockerfile
Last active October 19, 2022 05:50
Test figlets
View Dockerfile
FROM alpine
RUN apk add -X lolcat curl
CMD curl -sL | lolcat
lalyos /
Last active September 30, 2022 13:32
LZ-string decoder in go

LZ-string decoder in go

I was playing with and wondered how it stores data.

  • locally it uses localstorage
  • but state is preserved in url (bookmarkable POC)

Example link:


lalyos /
Created November 13, 2014 11:41
sudo forever
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
lalyos / index.html
Created March 28, 2022 10:17
JS Countdown Timer
View index.html
<div id="app"></div>
lalyos / index.pug
Created March 27, 2022 19:21
Quick pure CSS counter
View index.pug
- let d = 100, o = -.5*d;
- let sw = .1*d, r = .5*(d - sw);
- let len = 2*Math.PI*r;
svg(viewBox=[o, o, d, d].join(' ') stroke-width=sw)
circle(r=r stroke-dasharray=len stroke-dashoffset=`${len}px`)