dotfiles with notes

2024 Shawn's whole new workflow

asciinema CLI demo

Why combind dotfiles with document

Write documents help me and maybe others, but I'm too lazy. I thought combind two of them are convince for maintain. Since I might the files across my machines, I could write them easier.

files / env-configs for cross-machines

I had serial machines like classic laptop (thinkpad), detachable chromebook (asus cm3), e-ink (boox note), samsung (DEX), pixel 7a, cloud-vm, dev-machine, mac ...

Although, most of them are linux and my major env is terminal but they are very different.

An easy way to configure or update all my terminal envs would help me a lots.

Switch to whole new toolset

Rust related toolsets are so powerful, such as fish / zelllij / helix / wezterm. However, switch from orignal work flows to setup lots of machines are quite painful.

No just dotfiles

Likely, I found rotz to maintain my dotfiles. Then I realized it is supur match with all drop-in sytles files. I'm planning not just keep config file but also documents about howto use them.

hacking

This repo is quite personal, if you have interesting about it. Welcome to fork or tell me how to improve the quality.

This book is built by mdbook.

git clone git@github.com:shawn111/dotfiles.git

cd dotfiles

mdbook build

rotz

❯ rotz init Created config file at /home/shawn/.config/rotz/config.yaml

Initializing repo in "/home/shawn/.dotfiles"

Initialized empty Git repository in /var/home/shawn/.dotfiles/.git/

sops

git filter https://devops.datenkollektiv.de/using-sops-with-age-and-git-like-a-pro.html

exmaple


theme: override: footer: style: template center: "Enable Linux Power with Android" right: "{current_slide} / {total_slides}"


Andriod

Android is a kind of Linux with google magic

  • termux - an Android terminal emulator and Linux environment app
  • scrcpy - "screen copy" mirrors Android devices
    • scrcpy desktop
  • waydriod - android container

https://gs.statcounter.com/os-market-share

https://gs.statcounter.com/os-market-share


Android parts

  • Android 啟動過程 - init 進程 https://hackmd.io/pJpAeKAeRea0VIW3oI-mXw?view
    • https://hackmd.io/@AlienHackMd/BkvyAzNf9
  • The Generic Kernel Image (GKI) project
    • kernel module interface (KMI)
  • bionic libc (native part) - ndk
    • BSD license / Small size / Speed
  • android runtime (java part) - sdk
  • adb (android debug bridge) shell

termux

https://pbs.twimg.com/media/EeDRB0aX0AMj5kh

  • termux-emulator
    • with function key keyboard
    • as desktop via scrcpy
  • Linux environment
    • as personal edge server
      • with multi-sensors / phone functions
        • termux-api
      • androud call termux
        • termux-tasker
      • near 24/7 online
    • powerful device
      • gpu https://blog.csdn.net/Billhe_zju/article/details/122706171
    • docker / podman container (not real ready)
      • run in qemu
      • podman machine (not yet)
      • native docker/podman/lxc (need root)
      • (-) as kubeedge node
  • install from github or f-driod (*)

Termux Google Play

https://wiki.termux.com/wiki/Termux_Google_Play https://github.com/termux/termux-app/issues/1072

  • If Termux application was built with target SDK level "29" (Android 10) or higher, it will be eligible for SELinux restriction of execve() system call on data files.
  • That makes impossible to run package executables such as "apt", "bash" and others located in the application's writable directory such as $PREFIX.

termux application (main parts)

  • single user
  • native (bionic libc)
  • terminal-emulator
  • terminal-shared
    • shell
    • socket
    • am (Activity Manager)
    • notification
  • limited kernel function (w/o root)
  • termux file system layout
    • https://github.com/termux/termux-packages/wiki/Termux-file-system-layout

Termux Addons

https://wiki.termux.com/wiki/Addons

  • Termux:API
    • Access Android and Chrome hardware features.
  • Termux:Boot
    • Run script(s) when your device boots.
  • Termux:Float
    • Run Termux in a floating window.
  • Termux:Styling
    • Have color schemes and powerline-ready fonts customize the appearance of the Termux terminal.
  • Termux:Tasker
    • An easy way to call Termux executables from Tasker and compatible apps.
  • Termux:Widget
    • Start small scriptlets from the home screen.

termux fs layout

- Root directory/data/data/com.termux/files/usr ${TERMUX_PREFIX}
${TERMUX_PREFIX}/binExecutables used by shell. Combines /bin, /sbin, /usr/bin, /usr/sbin.*
${TERMUX_PREFIX}/etcConfiguration files.
${TERMUX_PREFIX}/includeheaders
${TERMUX_PREFIX}/libShared objects (libraries)
${TERMUX_PREFIX}/libexecExecutables which should not be run by user directly.
${TERMUX_PREFIX}/optInstallation root for sideloaded packages.
${TERMUX_PREFIX}/shareNon-executable runtime data and documentation.
${TERMUX_PREFIX}/tmpTemporary files. Combines /tmp and /var/tmp. Can be freely modified by user.
${TERMUX_PREFIX}/varsuch as caches and databases. Can be modified by user, but with additional care.
${TERMUX_PREFIX}/var/runLock, PID, sockets and other temporary files created by daemons. Replaces /run.
- Home directory/data/data/com.termux/files/home ${HOME}

termux packages

  • format - binary deb packages
    • package manager: pkg / apt
  • single source repo: https://github.com/termux/termux-packages
  • native (bionic libc)
  • repos / mirrors:
    • termux
    • termux-root
    • termux-x11
    • tut (others)

edge server

  • termux-service / runit
    • https://github.com/termux/termux-services
    • SVDIR: /data/data/com.termux/files/usr/var/service
    • $ tail -f ../usr/var/log/sv/sshd/current
  • termux-boot
    • https://github.com/termux/termux-boot
    • allowing programs to be run at boot.
  • termux-wake-lock

termux useful services

  • ngrok - Ingress Platform
  • ssh
    • single user / id
    • disbale password login
  • openvpn (via android app)

cli / tui - old school but awesome

  • colorful
  • auto complete
  • animation
  • cli / tui framework
  • http config

termux-setup-storage

https://wiki.termux.com/wiki/Internal_and_external_storage

Executing termux-setup-storage ensures:

That permission to shared storage is granted to Termux when running on Android 6.0 or later. That an app-private folder on external storage is created (if external storage exists). That a folder $HOME/storage is created.


proot: An chroot-like implementation using ptrace.

  • General usage information
    • unset LD_PRELOAD - Termux-exec, execve() hook, conflicts with PRoot.
    • -r ./rootfs - option to specify the rootfs where Linux distribution was installed.
    • -0 - tells PRoot to simulate a root user which expected to be always available in Linux distributions. This option will allow you to use package manager.
    • -b /dev -b /proc -b /sys - make file systems at /dev, /proc, /sys appear in the rootfs. These 3 bindings are important and used by variety of utilities.
    • /bin/sh - a program that should be executed inside the rootfs. Typically a shell.

  • other forks
    • AnLinux
    • UserLand

proot-disto git@github.com:termux/proot-distro.git

proot-distro install debian
proot-distro login debian

`

  • ubuntu / redhat
  • nix

qemu

qemu-system-aarch64-headless


termux api

  • termux-sms-send

$ termux-battery-status

{
  "health": "GOOD",
  "percentage": 27,
  "plugged": "UNPLUGGED",
  "status": "DISCHARGING",
  "temperature": 35.099998474121094,
  "current": -1780000
}

GUI

Termux:GUI

  • Official
    • Python
    • C/C++
    • Bash
  • Community
    • Rust

https://github.com/termux/termux-gui

  • enables command line programs to use the native android GUI.

Termux:x11

  • A Termux X11 server add-on app.

https://github.com/termux/termux-x11


termux am

  • https://github.com/termux/TermuxAm
  • https://github.com/termux/termux-am-socket

build app in termux

https://sdrausty.github.io/docsBuildAPKs/ https://gist.github.com/tmatz/817bf03433e059bf89c63dc33f286ccb

https://wiki.termux.com/wiki/Development_Environments


termux-rust / android rust

Tier 2 with Host Tools

Tier 2 without Host Tools

  • aarch64-linux-android
  • x86_64-linux-android

https://doc.rust-lang.org/nightly/rustc/platform-support.html https://doc.rust-lang.org/nightly/rustc/platform-support/android.html https://www.youtube.com/watch?v=gUz4thxBuTs https://android.googlesource.com/toolchain/android_rust/


termux-docker

  • kind of
docker run -it termux/termux-docker:latest
docker run --rm --privileged aptman/qus -s -- -p aarch64 arm
docker run -it --privileged termux/termux-docker:aarch64

https://github.com/termux/termux-docker/blob/master/Dockerfile

FROM scratch AS bootstrap
...
ADD https://github.com/termux/termux-packages/releases/download/bootstrap-$BOOTSTRAP_VERSION/bootstrap-$BOOTSTRAP_ARCH.zip /bootstrap.zip


scrcpy

  • audio forwarding (Android 11+)
  • recording
  • mirroring with Android device screen off
  • copy-paste in both directions
  • configurable quality
  • camera mirroring (Android 12+)
  • mirroring as a webcam (V4L2) (Linux-only)
  • physical keyboard and mouse simulation (HID)
  • OTG mode
  • and more…

android desktop

  • samsung dex / moto ready for

    • Linux on DeX (dead)
  • desktop mode / android 15

  • desktop launcher

    • Taskbar
    • https://github.com/axel358/smartdock

scrcpy-desktop

  • https://github.com/nikp123/scrcpy-desktop

  • adb shell settings put global overlay_display_devices $TARGET_DISPLAY_MODE

  • scrcpy --display-id $display -w -S -K &


waydroid

  • Waydroid uses Linux namespaces to run a full Android system in a container (LXC) on any GNU/Linux-based platform.
  • The Android inside the container has direct access to the needed hardware.


Happy Hacking All Your Linux Devices

Thank you


scrcpy

scrcpy-desktop

https://github.com/nikp123/scrcpy-desktop

scrcpy-tablet-mode

phone side

  • enable desktop mode
  • install taskbar

desktop side

  • run scrcpy-desktop/startscreen.sh
  • scrcpy --list-displays
    • --display-id=0 (1080x2400) [phone]
    • --display-id=13 (1920x1080) [tablet]
    • --display-id=14 (1080x2400) [phone-mirror]
  • scrcpy --display-id=13

theme: override: footer: style: template center: "Enable Linux Power with Android" right: "{current_slide} / {total_slides}"


Outline

  • termux - an Android terminal emulator and Linux environment app
  • scrcpy - "screen copy" mirrors Android devices
    • scrcpy desktop

Android is Linux-based

  • Android 啟動過程 - init 進程 https://hackmd.io/pJpAeKAeRea0VIW3oI-mXw?view
    • https://hackmd.io/@AlienHackMd/BkvyAzNf9
  • The Generic Kernel Image (GKI) project
    • kernel module interface (KMI)
  • bionic libc (native part) - ndk
    • BSD license / Small size / Speed
  • android runtime (java part) - sdk
  • adb (android debug bridge) shell

termux application (main parts)

  • native (bionic libc)
  • single user

termux packages

  • native (bionic libc)
  • termux file system layout
    • https://github.com/termux/termux-packages/wiki/Termux-file-system-layout

proot


supprot distros


other repos

  • tut
  • termux-root
  • termux-x11

termux api

  • termux-sms-send

other plugins

  • Termux:API
  • Termux:Boot
  • Termux:Float
  • Termux:Tasker

build app in termux

https://sdrausty.github.io/docsBuildAPKs/ https://gist.github.com/tmatz/817bf03433e059bf89c63dc33f286ccb

termux-setup-storage

termux- services / runit

  pkg install termux-services

ssh

https://blog.csdn.net/Billhe_zju/article/details/122706171

termux-docker


theme: override: footer: style: template center: "Enable Linux Power with Android" right: "{current_slide} / {total_slides}"


Outline

  • termux - an Android terminal emulator and Linux environment app
  • scrcpy - "screen copy" mirrors Android devices
    • scrcpy desktop

Android is Linux-based

  • Android 啟動過程 - init 進程 https://hackmd.io/pJpAeKAeRea0VIW3oI-mXw?view
    • https://hackmd.io/@AlienHackMd/BkvyAzNf9
  • The Generic Kernel Image (GKI) project
    • kernel module interface (KMI)
  • bionic libc (native part) - ndk
    • BSD license / Small size / Speed
  • android runtime (java part) - sdk
  • adb (android debug bridge) shell

termux application (main parts)

  • single user

termux packages

  • native (bionic libc)
  • termux file system layout
    • https://github.com/termux/termux-packages/wiki/Termux-file-system-layout

proot


supprot distros


other repos

  • tut
  • termux-root
  • termux-x11

termux api

  • termux-sms-send

other plugins

  • Termux:API
  • Termux:Boot
  • Termux:Float
  • Termux:Tasker

build app in termux

https://sdrausty.github.io/docsBuildAPKs/ https://gist.github.com/tmatz/817bf03433e059bf89c63dc33f286ccb

termux-setup-storage

termux- services / runit

  pkg install termux-services

ssh

https://blog.csdn.net/Billhe_zju/article/details/122706171

termux-docker


options: implicit_slide_ends: true

title: Kubernetes meets Rust author: Shawn Wang @ Netdb Tech Talks 2403

#


kubernetes

Kubernetes meets Rust

Outline

  • What is Kubernetes?
    • Some Rust Kubernetes utilities
  • Why Rust is good for Kubernetes? (kube.rs)
  • Rust for other parts of Kubernetes.

source

  • https://gist.github.com/shawn111/ebebfcf7e0bbd4a7ac9e17adefd625cc
  • presenterm

What is Container

Linux Container

  • chroot
  • cgroup
  • namespaces
  • capabilities
  • seccomp
  • AppArmour / SELinux

OCI Open Container Initiative

  • runtime
    • runc
  • image
  • distribution

kubernetes overview

  • k8s - container orchestration engine

    • automating deployment / scaling
    • management containerized applications
  • Kubernetes is written in the Go language.

    • Unlike Borg, which was written in C++
    • announced in June, 2014 and version 1.0 was released on July 21, 2015
  • relatation with Docker

    • OCI Established in June 2015 by Docker
    • v1.24 in May 2022, the "dockershim" has been removed entirely
  • Linux foundation < CNCF < kubernetes

Componenents

Admin

  • kubectl
  • others
    • helm
    • kdash / k9s

Control Plane (master)

  • kube-scheduler - assigns Pods to Nodes
  • kube-controller-manager
  • etcd
  • kube-api

Node

  • kubelet - kube agent
    • cri Container Runtime Interface
      • contianerd
      • cri-o
    • cni Container Network Interface
    • csi Container Storage Interface
  • kube-proxy

Overview

      ┌─────────────────────────┐ ┌────┬────────────┐
      │   ┌────┐  Control Plan  │ │Node│kube-proxy┌─┴─────┐
      │   │etcd│                │ │   ┌┴──────┬─┬─│Network│
─────┐│   └────┘    ┌───────┐   │ │   │kubelet│ │ └────.──┘
Admin├┼─────────────►  Api  ◄───┼┐└───┴──┬────┴─┘    .. 
kubectl             └───────┘   │└────┬──┴┐       ┌─.───
─────┘│   ┌────────────────┐    │ ┌───┴──┐│       │Users
      │   │ kube-scheduler │    │ │ Node ││       └─────
      │┌──┴────────────────┴───┐│ └───┬──┴┴──┐
      ││kube-controller-manager││     │ Node │
      └┴───────────────────────┴┘     └──────┘

k8s quick start

  • prepare docker or podman
    • apt install podman
  • kind
    • kind create cluster
  • kubectl
  • prepare kubecfg
    • $KUBECONFIG
    • kubectl config view
    • kubectl config view --raw
kind create cluster
podman ps
podman exec -it  kind-control-plane  bash
kubectl get pods -A

Inside kind-control-plane

containerd cli

ctr -n k8s.io containers list

cri-tools

crictl ps

nerdctl

  • on the way,
nerdctl ps

API / Objects In Kubernetes

  • Object spec and status

  • API / Resource

  • API Group

  • watch

  • kubectl / restful

❯ k get pod nginx-0 -o yaml
apiVersion: v1
kind: Pod
metadata:
  labels:
    app: nginx
  name: nginx-0
  namespace: default
spec:
  containers:
  - image: nginx:1.16.1
status:
  conditions:
...

Example of Operator/Controller

application

controller

reconciler

CRD Custom Resource Definitions

                    ┌──────────┐
               ┌────┤controller├──────┐
               │    └────▲─────┘      │
               │         │      schedule object
             watch    result          │
┌────────┐     │         │       ┌────▼─────┐
│kubectl │     │         └───────┤reconciler│
└───┬────┘     │                 └────┬─────┘
    │          │                   update
    │     ┌────▼────┐                 │
    └─────►kube api ◄─────────────────┘
          └─────────┘

Why Rust

  • Concurrency
  • No garbage collection.
  • memory safe
  • performance
  • cli (Rust-CLI wg)
  • Easy distribution
    • cargo install / binstall
  • Document / resources
    • mdbook
    • crates.io / docs.rs / lib.rs
  • kube.rs
  • kernel / M$ / ... love rust
  • ...

kube.rs

  • core Rust ecosystem for building applications against Kubernetes.
  • accepted to CNCF on November 16, 2021 at the Sandbox maturity level ...

kube

  • 5 crates

kube-core

Core traits and types necessary for interacting with the kubernetes API.

kube-derive < kube-core

for managing Custom Resource Definitions

kube-client < kube-core

kube::client and kube::config modules.

kube-runtime < kube-client

Common components for building Kubernetes operators


KDash

 KDash - A simple Kubernetes dashboard    v0.6.0 with ♥ in Rust  
┌───────────────────────────────────────────────────────────────┐
│ Active Context <A>│All Contexts <C>│Utilization <U><←→> switch│
└───────────────────────────────────────────────────────────────┘
┌ Namespaces <n> (all: <a>) ────────┐┌ Context┐┌ CLI Info (filte┐
│   Name                   Status   ││CPU:    ││kubectl  v1.29.0│
│=> kube-insider           Active   ││0% ━━━━━││kubectl  v1.29.1│
└───────────────────────────────────┘└────────┘└────────────────┘
┌ Resources ────────────────────────────────────────────────────┐
│ Pods <1>│ Services <2>│ Nodes <3>│ ConfigMaps <4>│ StatefulSe │
│                                                               │
│       ┌ Select Resource ───────────────────────────────┐      │
│       │   ResourceQuota                                │      │
│       │=> Tunnel                                       │      │
│       │   ValidatingWebhookConfiguration               │      │
│       └────────────────────────────────────────────────┘      │
└───────────────────────────────────────────────────────────────┘

k8s-insider - an operator help to access you kubernetes cluster network

k8s-insider install --pod-cidr 10.244.0.0/16
k8s-insider create network
k8s-insider connect

## remove dns
resolvconf -d insider0 -m 0 -x
❯ kubectl get networks.k8s-insider.dev -A
NAMESPACE      NAME      AGE
kube-insider   default   6h51m

❯ kubectl get tunnels.k8s-insider.dev -A
NAMESPACE      NAME              AGE
kube-insider   default-bjk40r   6h49m
kubectl get services -n kube-insider
NAME     TYPE     CLUSTER-IP   EXTERNAL-IP PORT(S)        AGE
k8s-... NodePort  10.96.153.40 <none>      1234:31237/UDP 54m

my shell env for k8s

  • fish
    • starship - cross shell prompt
    • kubie kbs kubesess
  • kdash
  • k8s-insider

sidecar

  • Linkerd linkerd2 (Linkerd is a service mesh for Kubernetes.)
    • https://github.com/olix0r/kubert
    • CNCF 2023: Alex Leong, Five Years of Cloud Native Rust.
  • Istio ztunnel

service operators

  • Stackable https://github.com/orgs/stackabletech/repositories
  • Tembo Stacks: Making Postgres the Everything Database https://tembo.io/

krustlet/krator

Leveraging State Machines to Build Operators in Rust - Kevin Flansburg, Moose Consulting

utils

  • mirrord https://mirrord.dev/
  • kubectl plugins
    • kubectl-watch
    • krew-wasm Qovery - Enable Developers Self-Service: Terraform, Helm, Kubectl, and Docker Shulker - The modern way of putting Minecraft in boxes

  • container related projects
    • youki
    • https://github.com/containers/conmon-rs (podman)
  • wasmtime
  • rust-vmm

helm related

conmon-rs

metrics

metrics -> prometheus telemetry -> OpenTelemetry

sidecar

  • Linkerd

kubectl plugins

Rust for other parts of Kubernetes.

  • container / vmm
  • wasm

k8sfwd k8s-insider

kubetui kdash kubectl-view-allocations

kubeconfig-bikeshed / kbs kubesess kubie

krew-wasm krew-wasm-plugin-sdk-rust

ksnotify

kind

kubectl

Add Edit link

  • https://github.com/rust-lang/mdBook/issues/1236

autosummary

https://github.com/FauconFan/mdbook-cmdrun?tab=readme-ov-file

Title

Slides only information

  • is
  • found
  • here

Web only information

Would be found here

mdslides

https://github.com/ferrous-systems/mdslides/


theme: override: footer: style: template center: "Introduction to footer styling" right: "{current_slide} / {total_slides}"


Open Source and Linux Desktop

Open Source for your "Computers"


About Me - Shawn Wang

  • 3 years EFI in Quanta Inc.

  • 5 years OEM / Infra in Canonial

  • 6 years distro in EasyStack

  • KaLUG - Kaohsiung Linux User Group


Open Source Era

https://gitnux.org/open-source-software-statistics/

  • 78% of businesses are using open-source software.
  • Over 70% of developers said that working on open-source software projects helped improve their skills.
  • More than 90% of developers rely on open-source components in their proprietary applications.
  • 96% of applications have at least one open-source component.
  • Open-source maintains a 33% lower organizational cost in the long run compared to proprietary software.

My opinions how open source dominate the world:

  • linux / container / ...
  • git / github / ...
  • big company join - google / M$ / Apple / Facebook / IBM / ...

A World Without Linux

Linux Foundation 2015

https://149366088.v2.pressablecdn.com/wp-content/uploads/2015/10/linux-animated-series.jpg

By W3Cook's analysis of Alexa's data, 96.3 percent of the top 1 million web servers are running Linux. The remainder is split between Windows, 1.9 percent, and FreeBSD, 1.8 percent. (2015)


recent security issues

  • xz, ssh backdoor
    • Backdoor found in widely used Linux utility targets encrypted SSH connections
  • rust, windows cmd
    • https://www.theregister.com/2024/04/10/rust_critical_vulnerability_windows/

Why Open Source ?

  • price
  • not just customize, you can patch / fork it
  • even leak of documents, go for source code directly
  • your own upgrade strategy
  • easy to get packages / repos

personal or small company

  • as career records
    • https://openprofile.dev/ / github / ...
  • let people help you improve your code
  • public repos can have more free resource (CI/CD / pages / repos)

big company examples

  • RHEL / Canonical - support
  • gitlab / mattermost - core services
  • meta: systemd - not core services
  • mysql: Michael Widenius https://www.youtube.com/watch?v=krcKkiKBKms

What kind of Open Source good for you?

The Cathedral and the Bazaar (1999)

https://upload.wikimedia.org/wikipedia/en/c/c4/Cathedral-and-the-Bazaar-book-cover.jpg


Linux has a little over 4% (actually 4.03%) of the desktop OS market.

https://gs.statcounter.com/os-market-share/desktop/worldwide

  • Win
  • Mac OS / IOS
  • Linux / Android / ChromeOS
  • Other - BSD / ...

Microsoft has a majority market share

https://bugs.launchpad.net/bugs/1

  • 2004 created

  • 2013 marked fixed

  • Microsoft ♥ Linux https://www.microsoft.com/en-us/windows-server/blog/2015/05/06/microsoft-loves-linux/


Why has Linux failed in dominating desktops?

https://en.wikipedia.org/wiki/Criticism_of_desktop_Linux

  • Choice and fragmentation

    • upwards of 300 distributions
  • Third-party application development

  • (*) Cross-device like ipad + MacOS / android + chromebook

  • Ubuntu Edge (2013) / ubuntu touch

    • ubuntu gnome -> unity -> unity8 (17 failed) -> gnome

https://linuxgizmos.com/files/ubuntu_convergence5-sm.jpg


Why Linux is good as your PC OS?

  • Rich Open Source resources - linux / containers
  • Network native
    • ssh / tunnel

Not so good about

  • Many application like office
    • cloud version or android version
  • chinese input

others

  • Windows: WSL
  • Mac M1/M2/M3: Asahi Linux

Linux kernel

  • modules
  • eBPF
  • rust for linux
  • abi (application binary interface)
    • https://opensource.com/article/22/12/linux-abi
    • LTS - 6.6 / 6.1 / 5.15 / 5.10 / 5.4 / 4.19
    • dkms
    • RHEL kernel
      • 7.x 3.10 2014 (kernel-3.10.0-1160)
      • 8.x 4.18 2019
      • 9.x 5.14 2022

https://opensource.com/sites/default/files/2022-11/1cooperation.png


Linux Distro - packages and dependencies

  • binary package / repos
    • debian / Ubuntu (deb) / termux
    • REHL / CentOS
    • alpine
  • source based
    • gentoo
    • arch
  • Declarative builds and deployments.
    • Nix
    • guix
  • upstream packages

RHEL

  • Fedora / CentOS Stream / RHEL
    • Fedora - Rawhide / half year release, one year maintain
    • CentOS Stream - rolling preview
    • RHEL - 10 year maintain
  • others
    • RockyLinux / AlmaLinux
  • major / minor release

https://media.licdn.com/dms/image/D4D12AQGBjsyMD20pMA/article-inline_image-shrink_1500_2232/0/1688147280169?e=1718236800&v=beta&t=zKbOtKgo7xyAUwBnJyOsVf21HjNNNmEE9L0Y6M8MoYI


debian / ubuntu

  • debian
    • unstable
    • testing
    • stable (sid) - LTS 5 years , ELTS 10 years

ubuntu LTS

  • 2304 / 2310 / 2404 (LTS) / 2410 / 2504

Dependency hell

  • binary packages
  • library dependency

Nix

  • Nix is a purely functional package manager.
    • /nix/store/b6gvzjyb2pg0kjfwrjmg1vfhh54ad73z-firefox-33.1/

Nix pkgs

  • Multiple versions
  • Complete dependencies
  • Multi-user support
  • Atomic upgrades and rollbacks
  • Garbage collection
  • Functional package language
  • Transparent source/binary deployment
  • Nix Packages collection
  • Portability

NixOS

  • Declarative system configuration model
  • Reliable upgrades
  • Atomic upgrades
  • Rollbacks
  • Reproducible system configurations
  • Safe to test changes

Linux container

  • LXC (machine container)
  • docker / podman
  • flatpak / snap

GNU/Linux

GNU / Richard Stallman

  • shell
  • libc
  • gcc
  • gnome
  • hurd (*)

freedesktop

  • Xorg, Wayland Protocol, PulseAudio are all freedesktop project. Mesa a big part of Desktop Linux is also Freedesktop project.

Systemd

  • Linux is not Unix

  • not just pid 0

  • journalctl / udev / dbus

  • adopted by major distros

    • fedora / debian / ubuntu / arch / nix
  • non-systemd

    • android / ChromeOS / alpine / ...

Libc

  • glibc - most linux distro
  • musl - apline
  • bionic (android)
    • BSD-licensed
    • Small size
    • speed

LTS / release schedule

  • Ubuntu 5 years / 12+
  • RHEL 10 year

Debian Developer

  • Debian Organization
  • gpg
  • gpg party

There are basically two options:

  • Debian Maintainer (DM): This is the first step – as DM you can upload your own packages to the Debian archive (with some restrictions)
  • Debian Developer (DD): This is the traditional full membership role in Debian.

package vs image

  • deb
  • rpm
  • nix
  • snap

PackageKit


immutable / atomic

  • container (OCI) image
  • ostree
    • rpm-ostree
  • systemd
    • portable services
  • snap - squashfs

version & release cycle


Gui

gnome

  • GPL
  • gtk

kde

  • qt
  • KDE Slimbook
  • Plasma 6 (QT6)
  • Plasma mobile
  • KDE neon is a Linux distribution built on top of the latest Ubuntu LTS release

Cosmic

  • created by system76
  • rust

Andriod Desktop Mode

  • tablet
  • foldable devices

others

  • samsung dex
  • motorola ready for

console / cli / tui

old school but fashion and cool

  • light
  • remotable / scriptable / ssh
  • colorful / auto-complete

examples

  • fish
  • editor
  • zellij
  • history - atuin

web ui

  • config / maintain
  • monitor / health check
  • co-operate

Windows Subsystem for Linux (WSL)

https://github.com/microsoft/WSL2-Linux-Kernel

wine


ChromeOS

  • channels: stable / beta / dev

dev mode

  • cros
  • shell

crostini

  • base on LXD
  • https://chromium.googlesource.com/chromiumos/docs/+/master/crostini_developer_guide.md

Your next computer is not a computer, IPad?

Your next computer is in your pocket (?)

Adnroid - Termux

  • Termux app
  • termux-packages https://github.com/termux/termux-packages
    • Main deb https://packages.termux.dev/apt/termux-main/ stable main
    • Root deb https://packages.termux.dev/apt/termux-root/ root stable
    • X11 deb https://packages.termux.dev/apt/termux-x11/ x11 main

waydroid

  • uses Linux namespaces (user, pid, uts, net, mount, ipc) to run a full Android system in a container
  • provide Android applications on any GNU/Linux-based platform (arm, arm64, x86, x86_64).
  • The Android system inside the container has direct access to needed hardware through LXC and the binder interface.

images

  • System OTA: https://ota.waydro.id/system
  • Vendor OTA: https://ota.waydro.id/vendor

scrcpy

  • This application mirrors Android devices (video and audio) connected via USB or over TCP/IP, and allows to control the device with the keyboard and the mouse of the computer. It does not require any root access. It works on Linux, Windows and macOS.

cli

  • fish
    • atuin
  • helix
  • wezterm

Open hardware - from edge to cloud

phone

  • rootable
  • pixel

edge

  • open hardware
    • Arduino
    • Raspberry Pi (not really)

dsektop

  • System76 - uefi
  • puri.sm coreboot
  • framework - not open uefi
    • opensource ec
  • apple M1/M2/M3
    • Asahi-Fedora

system76

  • laptops / desktops / mini / servers / keyboards / components
    • System76 Open Firmware
      • coreboot / EDK2 / System76 Firmware Apps
    • System76 Open EC
      • Keyboard / Touchpad / Power Button
  • pop!_os

https://images.prismic.io/system76/dde270ac-5f7f-4356-ae56-3dc9cd27c311_homepage-section-features-oryxpro.jpg


framework 13 / 16

  • Replace any part / components
  • opensource ec

https://static.frame.work/gscjgiq4hmd1thfgfihwmcu1na9c


opensource native

  • comp lang
    • python / js / go / rust
  • git / git-ops
  • containter / kube
  • android

go lang as example

  • import "github.com/google/uuid"

rust as example

  • crates.rs
    • lib.rs
  • docs.rs
[dependencies]
my-secret-crate = { git = "ssh://git@gitlab.com/rpadovani/my-secret-crate.git", branch = "main" }

opensource organizations

  • Linux Foundation
    • Cloud Native Computing Foundation (CNCF) - kubernetes
  • OpenInfra Foundation / OpenStack Foundation
  • Apache Software Foundation

social media / chat / forum

  • github / gitlab
  • slack / irc / discord
    • cncf 104k / kubernetes 180k
  • youtube
    • meeting
  • dev.to

license

https://upload.wikimedia.org/wikipedia/commons/thumb/8/86/Open-source-license-chart.svg/1200px-Open-source-license-chart.svg.png

  • Strong copyleft licenses - GPL v2 / v3
  • Weak copyleft licenses - MIT / Apache / BSD / Mozilla / LGPL
  • Business Source License

SPDX / SBOM

  • https://github.com/awesomeSBOM/awesome-sbom

grype https://github.com/anchore/grype

  • A vulnerability scanner for container images and filesystems
    • Find vulnerabilities for major operating system packages
  • Find vulnerabilities for language-specific packages
  • OpenVEX

open source related projects

wikimedia

open textbook / open educational resources

Public Money, Public Code


taiwan open source conference

  • coscup - Conference for Open Source Coders, Users, and Promoters
  • SITCON - Students' Information Technology Conference
  • mopcon - Mobile Open Platform Conference

Happy Open Source

Thank you

openvpn

nmcli connection import type openvpn file bj-dc.ovpn

My awesome Rust CLI collection


Why Rust (from wg-cli)

  • Solid and quick
  • Easy distribution
    • source and binary
    • cross platform
    • cargo binstall
    • github action
  • Robust configuration
  • Manuals? done.
  • Data in, data out
    • talking to humans
    • talking to machines
  • Flexible logging

Why rust-cli for me?

  • a lot of resource
    • community
      • youtube / discord / zulipchat
  • 80% of my daily cli apps are rust
  • for learning rust

wezterm: Terminal Emulator / Multiplexer

  • cross platforms
  • Multiplex terminal panes, tabs and windows with native mouse and scrollback
    • on local / remotes
  • SSH client with native tabs
  • Connect to serial ports for embedded/Arduino work
  • Ligatures, Color Emoji and font fallback, with true color and dynamic color schemes.
    • https://github.com/tonsky/FiraCode#fira-code-monospaced-font-with-programming-ligatures
  • Kitty graphics support
  • Sixel graphics support

https://wezfurlong.org/wezterm/features.html#available-features

others: Alacritty

  • light

zellij: Terminal Multiplexer

pros:

  • multi-layout: floating / stacked https://zellij.dev/news/stacked-panes-swap-layouts/
  • wasm plugin: loading from web https://zellij.dev/news/session-resurrection-ui-components/
  • zellij as IDE: https://zellij.dev/news/config-command-layouts/
  • Multiple Cursors with colored: https://zellij.dev/news/multiplayer-sessions/
  • Sixel Support: https://zellij.dev/news/sixel-search-statusbar/

cons:

  • too many hotkey

fish (SHELL)

  • 3.x C++ + rust https://github.com/fish-shell/fish-shell/blob/master/doc_internal/fish-riir-plan.md

pros:

  • autosuggestion, history default enable
  • Web Interface for configuration: fish_config
  • fish plugins: fisher
    • tide https://github.com/IlanCosman/tide
  • light

cons:

  • not POSIX compliance

others: nushell


starship: cross shell prompt

  • Compatibility First: Use it everywhere!

    • powershell / zsh (Linux / MacOS / BSD / Windows)
  • Customizable

    • Every little detail is customizable to your liking, to make this prompt as minimal or feature-rich as you'd like it to be.
  • Advanced Support (depend shell functions)

    • TransientPrompt
    • pre-prompt and pre-execution

atuin: Sync, search and backup shell history with Atuin

  • global / dir / session scope
  • End-to-end encryption
  • Store extra context
    • working directory
    • exit code, and more!
  • stats
    • atuin stats last friday

helix: Kakoune / Neovim like editor

pros:

  • Vim-like modal editing
  • Multiple selections
  • Built-in language server support
  • Smart, incremental syntax highlighting and code editing via tree-sitter

cons:

  • lack plugins
    • An embeddable and extensible scheme dialect https://github.com/mattwparas/steel
    • wasm (been label won't fix)

comtrya: dotfiles manager

  • Configuration Management for Localhost
  • Run on any operating system
  • Provide a simple YAML interface to, potentially, complex tasks
    • file
    • command
    • package
    • service (not yet)

mydotfiles:

  • with mdbook
  • http://shawn111.github.io/dotfiles

others: rotz

  • focus on files (symlink / hardlink)
  • with install function

cargo binstall / install: app manager?

  • cargo-quickinstall
    • This will install pre-compiled versions of any binaries in the crate. If we don't have a pre-compiled version, it will fallback to cargo install automatically.
  • cargo-binstall
    • Binary installation for rust projects
    • github action

presenterm (md / slide)

  • Define your presentation in a single markdown file.
  • Images and animated gifs on terminals like kitty, iterm2, and wezterm.
  • Customizeable themes including colors, margins, layout (left/center aligned content), footer for every slide, etc. Several built-in themes can give your presentation the look you want without having to define your own.
  • Code highlighting for a wide list of programming languages.
  • Selective/dynamic code highlighting that only highlights portions of code at a time.
  • Column layouts.
  • LaTeX and typst formula rendering.
  • Introduction slide that displays the presentation title and your name.
  • Slide titles.
  • Shell code execution.
  • Export presentations to PDF.
  • Pause portions of your slides.
  • Custom key bindings.
  • Automatically reload your presentation every time it changes for a fast development loop.

mdcat


  • asciinema
    • 2.x python -> rust
  • agg (asciicast2gif)
  • autocast
    • Automatically generate an asciicast file for use with asciinema.

Note:

Here's how to use Nerd Fonts with agg:

Download one of the patched font sets from https://github.com/ryanoasis/nerd-fonts/releases/latest , e.g. JetBrainsMono.zip Unzip them into ~/.local/share/fonts (on Linux) or install with system font manager (macOS, Windows)

fc-cache -v -f Specify font family like this:

agg --font-family "JetBrainsMono Nerd Font Mono" demo.cast demo.gif


tracing console

tui-logger

https://github.com/gin66/tui-logger

  • systemctl-tui

fish

v3 (current) rust + c++ v4 (next) full rust

fish plugins

fisher

https://github.com/jorgebucaran/fisher

curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher

tide

fisher install IlanCosman/tide@v6

tide configure --auto --style=Rainbow --prompt_colors='True color' --show_time=No --rainbow_prompt_separators=Slanted --powerline_prompt_heads=Slanted --powerline_prompt_tails=Sharp --powerline_prompt_style='Two lines, character and frame' --prompt_connection=Solid --powerline_right_prompt_frame=Yes --prompt_connection_andor_frame_color=Darkest --prompt_spacing=Compact --icons='Many icons' --transient=Yes

ssh-agent

FIXME

tide bring too many files too hard to maintain.

wezterm

WezTerm is a powerful cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust

FIXME

ibus

zellij

I prefer status bar on top and change default as compact mode.

supur like

  • stacked layout - https://zellij.dev/news/stacked-panes-swap-layouts/
    • zellij edit - https://zellij.dev/documentation/zellij-edit
  • dump to editor - https://zellij.dev/news/edit-scrollback-compact/
  • wasm plugins

utility collection

asciinema

asciinema 3.0 switch to Rust.

https://github.com/asciinema/asciinema

It sitll required to build yourself.

cargo install --git https://github.com/asciinema/asciinema

Looking forward about binstall ready.

bore

https://github.com/ekzhang/bore/

cargo binstall bore

rotz - Fully cross platform dotfile manager and dev environment bootstrapper written in Rust.

  • defined links
  • handle install scripts - I used rotz to maintain drop-in files, but sometime still need env setup.
  • simple depends

others

chezmoi (go)

chezmoi add file

mackup (python)

dotman (go)

sheldon (rust)

for shell plugins