Skip to content

Instantly share code, notes, and snippets.

View christian-korneck's full-sized avatar
💭
I may be slow to respond.

Christian Korneck christian-korneck

💭
I may be slow to respond.
View GitHub Profile
```
sleep() {
if [[ $@ == "infinity" ]]; then
while true
do
/bin/sleep 1
done
else
/bin/sleep "$@"
fi
@christian-korneck
christian-korneck / gist:aa632ad1c9880c402be496c640cd1562
Created February 18, 2021 10:33
golang - dummy heap allocation to prevent GC below target
```
// Create a large heap allocation of 10 GiB
// to prevent garbage collection gets
// triggered before the amount of heap
// allocation is reached
ballast := make([]byte, 10<<30)
```
@christian-korneck
christian-korneck / gist:e9fb8cbe0796db6653223bb060cb55d1
Created February 16, 2021 19:19
openssh private key to rsa private key
```
pushd $HOME/.ssh
cp -p id_rsa id_rsa.pem
ssh-keygen -p -N "" -m pem -f id_rsa.pem #replaces file
popd
```
@christian-korneck
christian-korneck / README.md
Last active February 3, 2021 12:23
meetup notes

commands from my meetup session Jan 2021

uptime #load avg
dmesg -T | tail #kernel msgs
vmstat -Sm 1 #mem in MB
vmstat -Sm 1 -d 1 #disk in MB
mpstat -P ALL 1 #cpus
pidstat -t 1 #procs with threads
iostat -xy 1 #disk queue length, etc
@christian-korneck
christian-korneck / Dockerfile
Created January 9, 2021 12:03
build/install archlinux AUR package in a container
FROM archlinux
RUN pacman -Sy --noconfirm git go base-devel docker
# makepkg needs to run under an unprived user and sudo out
RUN useradd -m -G wheel -s /bin/sh worker
RUN echo "ALL ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/tempbuild
USER worker
RUN cd $HOME && git clone https://aur.archlinux.org/docker-pushrm.git
RUN cd $HOME/docker-pushrm && makepkg -si --noconfirm
USER root
RUN rm /etc/sudoers.d/tempbuild
@christian-korneck
christian-korneck / README.md
Last active December 7, 2020 14:41
chrome enable reader mode

chrome://flags/#enable-reader-mode

@christian-korneck
christian-korneck / fix.sh
Created December 7, 2020 11:59
fix vscode laggy terminal in macos 11 big sur
codesign --remove-signature "/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Renderer).app"

Public WIFI login from the terminal

These are curl examples for confirming the captive portal login page of some public WIFI Hotspots.

Telekom

SSID: Telekom

alias telekom='onlinestatus=; onlinestatus=$(curl --silent --data-binary "{\"rememberMe\":false}" "https://hotspot.t-mobile.net/wlan/rest/freeLogin" | jq -r ".user.wlanLoginStatus"); if [ "$onlinestatus" != "online" ]; then echo error; else echo online; fi; onlinestatus='
@christian-korneck
christian-korneck / octokey
Last active April 25, 2024 09:40
octokey (.bashrc)
function octokey () {
if [ "${1}" == "" ]; then echo -e "Get a github user's ssh key(s). \nUsage: octokey github_username [all | key_index]" && return 1; fi
case "${2}" in
"")
local key_index=0
;;
a)
local key_index='' #jq wildcard
;;
all)
@christian-korneck
christian-korneck / docker_creds.bash
Created March 13, 2020 23:15
get docker desktop credentials
#!/bin/bash
docker-credential-desktop list | \
jq -r 'to_entries[].key' | \
while read; do
docker-credential-desktop get <<<"$REPLY";
done