Skip to content

Instantly share code, notes, and snippets.

Avatar

Trung Lê runlevel5

View GitHub Profile
@runlevel5
runlevel5 / setup_containerd_for_k8s.sh
Last active Jul 27, 2020
Setup containerd for K8S on Alpine Linux
View setup_containerd_for_k8s.sh
#!/bin/bash
set -e
## CRI containrd
## CNI flannel
# Alpine Edge only! Let's hope alpine 3.13 or 3.14 would have k8s in main tree
echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories
echo http://dl-cdn.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories
@runlevel5
runlevel5 / k8s_metrics_server.md
Last active Jun 16, 2020
Kubernetes Metrics Server (ppc64le)
View k8s_metrics_server.md
  1. SSH into master node
  2. Modify spec.containers.command in /etc/kubernetes/manifests/kube-apiserver.yaml to have - --enable-aggregator-routing=true flag if you do not run kube-proxy on a host running the API server
  3. Fetch manifest file https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.3.6/components.yaml
  4. Search and replace amd64 with ppc64le with command: sed -i 's/amd64/ppc64le/g' components.yaml
  5. Start the metric servers with kubectl apply -f components.yaml
@runlevel5
runlevel5 / k8s.md
Last active Jun 4, 2020
K8S Short cut
View k8s.md

Get pods by selectors

kubectl get pods --selector <key>=<value>

Count pods by selectors

kubectl get pods --selector <key>=<value> --no-headers=true | wc -l

How to taint a node

@runlevel5
runlevel5 / # binutils - 2020-05-26_11-05-42.txt
Created May 26, 2020
binutils on 3.10.0-1127.el7.ppc64le - Homebrew build logs
View # binutils - 2020-05-26_11-05-42.txt
Homebrew build logs for binutils on 3.10.0-1127.el7.ppc64le
Build date: 2020-05-26 11:05:42
View how_to_set_tiled_wallpaper_with_gnome3.md

How to change GNOME background settings:

use dconf-editor or gsettings to change following properties:

  • org.gnome.desktop.background.picture-uri file:///home/tle/Pictures/pattern4.png
  • org.gnome.desktop.background.picture-options 'wallpaper'
  • org.gnome.desktop.background.primary-color #3c6eb4
  • org.gnome.desktop.background.secondary-color #294172

How to create wallpaper profile?

View build_static_ruby_on_debian.md

Debian buster ppc64el

portable libyaml

cd /tmp
wget https://github.com/yaml/libyaml/archive/dist-0.2.2.tar.gz
tar xzvf dist-0.2.2.tar.gz
cd libyaml-dist-0.2.2
mkdir -p $HOME/.linuxbrew/Homebrew/Cellar/portable-libyaml/0.2.2
./configure --enable-static --disable-shared --disable-dependency-tracking --prefix=$HOME/.linuxbrew/Homebrew/Cellar/portable-libyaml/0.2.2
@runlevel5
runlevel5 / gl_vk_chopper_build_fedora32_ppc64le.log
Last active Feb 22, 2020
A full snippet on how to build gl_vk_chopper with Fedora 32 (ppc64le)
View gl_vk_chopper_build_fedora32_ppc64le.log
$ cat /etc/os-release
NAME=Fedora
VERSION="31 (Server Edition)"
ID=fedora
VERSION_ID=31
VERSION_CODENAME=""
PLATFORM_ID="platform:f31"
PRETTY_NAME="Fedora 31 (Server Edition)"
ANSI_COLOR="0;34"
LOGO=fedora-logo-icon
View devilutionX_cmake.md

ERROR LOG

Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /home/tle/src/devilutionX/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake cmTC_ce964/fast && /usr/bin/gmake -f CMakeFiles/cmTC_ce964.dir/build.make CMakeFiles/cmTC_ce964.dir/build
gmake[1]: Entering directory '/home/tle/src/devilutionX/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_ce964.dir/src.c.o
/usr/bin/cc   -DCMAKE_HAVE_LIBC_PTHREAD   -o CMakeFiles/cmTC_ce964.dir/src.c.o   -c /home/tle/src/devilutionX/build/CMakeFiles/CMakeTmp/src.c
@runlevel5
runlevel5 / elasticsearch7.md
Last active Nov 12, 2019
Elasticsearch 7 cheat sheet
View elasticsearch7.md

How to combine many queries together in query? Simply use bool boolean with must

{
  "query: {
    "bool": {
      "must": [
        { <query 1> },
        { <query 2> }
      ]
@runlevel5
runlevel5 / nginx_njs_environment_variables.md
Last active Jun 14, 2020
Using njs to fetch environment variables
View nginx_njs_environment_variables.md

There are many ways to parse in variable into the nginx config file. Some uses set_by_lua which is offered by lua-nginx-module. Some use envstubst to populate varilabes into a template file.

Today I am going to show you how to do that with njs the JS scripting engine for nginx.

## /etc/nginx/fetch_env.js
function fetch_upstream_host(r) {
  return process.env.UPSTREAM_HOST;
You can’t perform that action at this time.