Skip to content

Instantly share code, notes, and snippets.

View samuelb's full-sized avatar

Samuel Barabas samuelb

  • Switzerland
View GitHub Profile
@samuelb
samuelb / Dockerfile
Last active February 8, 2022 20:46
Build static linked golang programm and put it into an empty docker container
FROM golang:1.17 as builder
WORKDIR /go/src/app
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY main.go .
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags "-w -s" -o app
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
@samuelb
samuelb / 70-persistent-net.rules
Last active October 15, 2020 15:20
70-persistent-net.rules
# add to /etc/udev/rules.d/70-persistent-net.rules
# replace xx:xx:xx:xx:xx:xx with actual mac address and adjust the name (eth0). repeat line for every interface.
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
@samuelb
samuelb / SearchFile.java
Created November 1, 2019 10:07
Recursive search a file with Java
import java.io.File;
import java.util.LinkedList;
import java.util.List;
public class SearchFile {
public static void main(String[] args) {
// Liste aller Funde
LinkedList<String> results = new LinkedList<>();
@samuelb
samuelb / kubewait.py
Last active October 1, 2019 07:33
PoC - Wait for helm `install/update` deployments to be finished. Takes `helm template ...` from stdin.
#!/usr/bin/env python3
""" Usage: helm template ... | python thisscript.py """
import sys
import yaml
import subprocess
docs = yaml.load_all(sys.stdin, Loader=yaml.Loader)
# get all objects names of kind Deployment, DaemonSet, StatefulSet
for doc in docs:
autodetach on # default: on
crlf off # default: off
deflogin off # default: on
hardcopy_append on # default: off
startup_message off # default: on
vbell on # default: ???
termcapinfo xterm ti@:te@
defscrollback 1000 # default: 100
caption always "%{gk}%?%-Lw%?%{Gk}%n*%f %t%?(%u)%?%{gk}%?%+Lw%? %82=%{gk}%M %d %92=%{gk}%c%="
sorendition kG # black on bold green
reaktorbeamer() {
xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
xrandr --addmode VGA1 1920x1080_60.00
xrandr --output LVDS1 --mode 1366x768 --scale 1x1 --output VGA1 --mode 1920x1080_60.00 --scale 0.7x0.7
}
# scale and resolution of LVDS might need to be adjusted
@samuelb
samuelb / .xmodmaprc
Created February 3, 2018 22:11
xmodmap config
! remove CapsLock, as nobody needs it
remove Lock = Caps_Lock
! reconfigure CapsLock as switch, s.t. it activates
! umlauts on a, o, u, s
keycode 66 = Mode_switch
keycode 26 = e E EuroSign cent
keycode 30 = u U udiaeresis Udiaeresis
keycode 32 = o O odiaeresis Odiaeresis
keycode 38 = a A adiaeresis Adiaeresis
keycode 39 = s S ssharp
@samuelb
samuelb / ip6tables.rules
Created December 26, 2017 23:12
/etc/iptables/...
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -m rt --rt-type 0 -j DROP
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -m conntrack --ctstate INVALID -j DROP
-A INPUT -p ipv6-icmp -m icmp6 --icmpv6-type 1 -j ACCEPT
-A INPUT -p ipv6-icmp -m icmp6 --icmpv6-type 2 -j ACCEPT
1. Test 123
This some quite
````
make
````
And this?
```
make install
" ~/.config/nvim/init.vim
"
" After add / remove Plugins, run :PlugInstall / :PlugClean
if has('nvim')
let $VIMHOME = '~/.config/nvim'
else
let $VIMHOME = '~/.vim'
endif