Skip to content

Instantly share code, notes, and snippets.

@lalyos
lalyos / README.md
Last active September 1, 2025 21:40
install golang to ubuntu/debian one-linet

Install latest golang

curl -Ls http://bit.ly/go_installer | bash

Overview

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

@lalyos
lalyos / README.md
Last active June 26, 2025 10:23
k8s with curl
curl -s -k \
  --cert ~/.minikube/client.p12 \
  --key  ~/.minikube/client.key \
  --pass tcuser \
  https://192.168.64.8:8443/api/v1/pods \
    |jq '.items[].metadata.name'
@lalyos
lalyos / 00-k8s-prompt.md
Last active March 31, 2025 15:03
simple shell based prompt generated with promptline.vim

Sometimes a very simple prompt is useful - like creating documentation, or github issues. In those cases its still important to be able to tell the k8s context/ns

white [ctx/ns]

PS1='[$(kubectl config view --minify -o jsonpath="{.contexts[0].name}:{.contexts[0].context.namespace}")]$ '

orange [ns]

@lalyos
lalyos / sshpass.rb
Last active June 1, 2024 00:14
brew install sshpass
require 'formula'
class Sshpass < Formula
url 'http://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.05.tar.gz'
homepage 'http://sourceforge.net/projects/sshpass'
sha256 'c3f78752a68a0c3f62efb3332cceea0c8a1f04f7cf6b46e00ec0c3000bc8483e'
def install
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
@lalyos
lalyos / etcd-list-keys.md
Last active April 26, 2024 16:14
k8s etcd list keys

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

One-liner

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
lalyos / Dockerfile
Last active April 8, 2024 19:31
Dockerfile failing on server, but builds locally
FROM tianon/centos
MAINTAINER SequenceIQ
# install dev tools
RUN yum install -y openssh-server openssh-clients
# passwordless ssh
RUN ssh-keygen -q -N "" -t dsa -f /etc/ssh/ssh_host_dsa_key
RUN ssh-keygen -q -N "" -t rsa -f /etc/ssh/ssh_host_rsa_key
RUN ssh-keygen -q -N "" -t rsa -f /root/.ssh/id_rsa
@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 / README.md
Last active October 13, 2023 19:25
bash script skeleton following https://github.com/progrium/bashstyle

To start a new script use this one-liner:

curl -Lo newscript.sh http://j.mp/bash-skeleton
@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