Skip to content

Instantly share code, notes, and snippets.

@lalyos
lalyos / .0README.md
Last active December 14, 2023 13:38
KUBECONFIG helper scripts - magic

Install

Add this to you ~/.bashrc

if [ -f ~/.kube/.kube-config.sh ]; then 
  source ~/.kube/.kube-config.sh
else 
  curl -sLo ~/.kube/.kube-config.sh https://gist.githubusercontent.com/lalyos/f851fd3273fead83146eeca6822a9604/raw/.kube-config.sh
  source ~/.kube/.kube-config.sh
fi
@lalyos
lalyos / 00-k3s-airgap-images.sh
Last active October 4, 2023 19:47
k3s with airgap image prewarmed
mkdir -p /var/lib/rancher/k3s/agent/images/
VERSION_K3S=$(curl -w '%{url_effective}' -L -s -S https://update.k3s.io/v1-release/channels/stable -o /dev/null | sed -e 's|.*/||')
curl -sL -o /var/lib/rancher/k3s/agent/images/airgap-images.tar https://github.com/k3s-io/k3s/releases/download/${VERSION_K3S}/k3s-airgap-images-amd64.tar
services:
backend:
image: web:v7
build:
context: https://github.com/lalyos/docker-lufi-2023-09-26.git
tags:
- lalyos/web
- ttl.sh/web
environment:
- TITLE=Dinner [dev]
@lalyos
lalyos / compose.yaml
Last active September 15, 2023 08:42
services:
coffee:
image: lalyos/12factor
ports:
- 80
environment:
- TITLE=Coffebreak LEVEL 2.
- COLOR=gray
backend:
image: lalyos/12factor
@lalyos
lalyos / main.go
Last active September 11, 2023 17:44
goplay example
package greet
import (
"fmt"
)
func Greet() {
fmt.Println("Greating from golpay package [gist] ... v1.3")
}
@lalyos
lalyos / README.md
Last active October 19, 2022 15:39
Recording bash's standard out

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

Install

curl -Lo /usr/local/bin/cybash https://gist.githubusercontent.com/lalyos/94cef8ca8bb3087387312f7f3e775e3b/raw/cybash
chmod +x /usr/local/bin/cybash

Usage

@lalyos
lalyos / Dockerfile
Last active October 19, 2022 05:50
Test figlets
FROM alpine
RUN apk add -X http://dl-cdn.alpinelinux.org/alpine/edge/testing lolcat curl
CMD curl -sL https://gist.githubusercontent.com/lalyos/99341041e6b513a05ac945c897ef518e/raw/network.txt | lolcat
@lalyos
lalyos / README.md
Last active September 30, 2022 13:32
LZ-string decoder in go flems.io

LZ-string decoder in go

I was playing with https://flems.io/ and wondered how it stores data.

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

Example link: http://flems.io

Usage

@lalyos
lalyos / index.html
Created March 28, 2022 10:17
JS Countdown Timer
<div id="app"></div>
@lalyos
lalyos / index.pug
Created March 27, 2022 19:21
Quick pure CSS counter
- let d = 100, o = -.5*d;
- let sw = .1*d, r = .5*(d - sw);
- let len = 2*Math.PI*r;
.countdown
svg(viewBox=[o, o, d, d].join(' ') stroke-width=sw)
circle(r=r)
circle(r=r stroke-dasharray=len stroke-dashoffset=`${len}px`)