Skip to content

Instantly share code, notes, and snippets.

View bzub's full-sized avatar

bzub bzub

View GitHub Profile
@rawc0der
rawc0der / crd2jsonschema.sh
Last active April 18, 2024 14:43
Extract openapi JSON schema from Kubernetes CRD manifest
#!/bin/bash
# Small utility function based on yq to extract openAPIV3Schema from CRD
# example: crd2jsonschema.sh ./crd-alertmanager.yaml
set -e
function crd2jsonschema() {
set -e
local xkgroup="x-kubernetes-group-version-kind"
local document="$1"
local openAPIV3Schema=$(mktemp -u)
@ernoaapa
ernoaapa / list-failing-pods.sh
Last active June 19, 2024 10:50
Script to list all Kubernetes Pods what are NOT ready
#!/bin/sh
#
# Print Pods which are Pending or not Ready for some reaosn
#
kubectl get pods --all-namespaces -o go-template='{{ range $item := .items }}{{ range .status.conditions }}{{ if (or (and (eq .type "PodScheduled") (eq .status "False")) (and (eq .type "Ready") (eq .status "False"))) }}{{ $item.metadata.name}} {{ end }}{{ end }}{{ end }}'
@rohshall
rohshall / bspwmrc
Last active November 8, 2022 23:40 — forked from jinyeow/bspwmrc
Config files related to bspwm and panel (lemonbar)
#! /bin/sh
xrandr.sh
sxhkd &
xcompmgr &
$HOME/bin/panel &
bspc monitor LVDS-1 -d 1 2 3 4 5
bspc monitor HDMI-2 -d 6 7 8 9 0
@bcardiff
bcardiff / list-deps.cr
Last active May 29, 2024 17:37
List binary dependencies to build a minimal docker image from scratch
unless ARGV.size > 0
puts " Missing executable file argument"
puts " Usage (in a Dockerfile)"
puts " RUN crystal run ./path/to/list-deps.cr -- ./bin/executable"
exit 1
end
executable = File.expand_path(ARGV[0])
unless File.exists?(executable)
@hervenicol
hervenicol / run.tpl
Last active May 12, 2023 14:20 — forked from efrecon/run.tpl
`docker inspect` template to regenerate the `docker run` command that created a container
docker run \
--name={{.Name}} \
{{range $e := .Config.Env}}--env={{printf "%q" $e}} \
{{end}}{{range $p, $conf := .NetworkSettings.Ports}}{{with $conf}}-p {{(index $conf 0).HostIp}}:{{(index $conf 0).HostPort}}:{{$p}} \
{{end}}{{end}}{{range $n, $conf := .NetworkSettings.Networks}}{{with $conf}}--network {{printf "%q" $n}} \
{{range $conf.Aliases}}--network-alias {{printf "%q" .}} {{end}} \
{{end}}{{end}}{{range $v := .HostConfig.VolumesFrom}}--volumes-from={{printf "%q" .}} \
{{end}}{{range $v := .HostConfig.Binds}}--volume={{printf "%q" .}} \
{{end}}{{range $l, $v := .Config.Labels}}--label {{printf "%q" $l}}={{printf "%q" $v}} \
{{end}}{{range $v := .HostConfig.CapAdd}}--cap-add {{printf "%q" .}} \
@dm0-
dm0- / kernel-small.md
Last active July 30, 2019 19:53
Build a modified CoreOS kernel (no initramfs modules; X260 driver notes)

Download and start the CoreOS development image in a container. Make sure to bind writable directories over the kernel's build and install paths.

wget 'http://alpha.release.core-os.net/amd64-usr/current/coreos_developer_container.bin.bz2'
bzcat coreos_developer_container.bin.bz2 > coreos_developer_container.bin
mkdir boot modules src
sudo systemd-nspawn \
    --bind="$PWD/boot:/boot" \
    --bind="$PWD/modules:/lib/modules" \

--bind="$PWD/src:/usr/src" \

@jinyeow
jinyeow / bspwmrc
Last active November 7, 2022 13:30
Config files related to bspwm and panel (lemonbar)
#!/bin/zsh
ws1= # main
ws2= # web
ws3= # mail
ws4= # code
ws5= # math [infinity]  (term icon)
ws6= # media
ws7= # misc  (9 squares icon)
ws8= # notes/docs  (pdf icon)
@tobert
tobert / portacluster-arch-toolbox.sh
Created March 31, 2015 00:44
Quick & (very) dirty Arch Linux toolbox for CoreOS
#!/bin/sh
# /dev/sda3 is 200GB of XFS mounted on /srv
mkdir /srv/arch64
# my Arch install image is just a tarball of the root fs with all tools pre-installed
curl 192.168.10.10/installer/arch-x64-20150330.tar.gz |sudo tar -C /srv/arch64 -xzvf -
# start the Arch image the same way CoreOS's 'toolbox' script does
systemd-nspawn --directory=/srv/arch64 --capability=all --share-system --bind=/:/media/root --bind=/usr:/media/root/usr --user=root
@jbeda
jbeda / gist:2cae7dd22a453c3caa94
Last active November 7, 2020 18:26
URLs for kubernetes release artifacts
$ gsutil ls -R gs://kubernetes-release/release/v0.5.4 | sed 's|gs://kubernetes-release|https://storage.googleapis.com/kubernetes-release|; /^.*:$/d; /^$/d'
https://storage.googleapis.com/kubernetes-release/release/v0.5.4/kubernetes-client-darwin-386.tar.gz
https://storage.googleapis.com/kubernetes-release/release/v0.5.4/kubernetes-client-darwin-amd64.tar.gz
https://storage.googleapis.com/kubernetes-release/release/v0.5.4/kubernetes-client-linux-386.tar.gz
https://storage.googleapis.com/kubernetes-release/release/v0.5.4/kubernetes-client-linux-amd64.tar.gz
https://storage.googleapis.com/kubernetes-release/release/v0.5.4/kubernetes-client-linux-arm.tar.gz
https://storage.googleapis.com/kubernetes-release/release/v0.5.4/kubernetes-salt.tar.gz
https://storage.googleapis.com/kubernetes-release/release/v0.5.4/kubernetes-server-linux-amd64.tar.gz
https://storage.googleapis.com/kubernetes-release/release/v0.5.4/kubernetes.tar.gz
https://storage.googleapis.com/kubernetes-release/release/v0.5.4/bin/darwin/386/kubecfg
@mainframe
mainframe / on-dell-omsetup.sh
Created May 27, 2013 21:12
Setup Dell OpenManage software and management service
#!/bin/bash
# Copyright (C) 2013, OpenNode LLC. All rights reserved.
# Email: info@opennodecloud.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,