Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Istvan l1x

🏠
Working from home
View GitHub Profile
@l1x
l1x / motd.sh
Created Apr 5, 2021
Creating MOTD for unix / linux hosts
View motd.sh
cfonts "rpi4-3" -f huge --gradient blue,cyan,"#FFA500" --transition-gradient > motd
@l1x
l1x / flush_dns.sh
Created Apr 5, 2021
Flushing DNS cache on MacOS
View flush_dns.sh
sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache
View sane_file_names.py
#!/usr/bin/env python
import os
import hashlib
import sys
def get_folders(folder):
ret = []
for root, subdirs, _files in os.walk(folder):
for subdir in subdirs:
View git.alias.sh
git config --global alias.sweep
git config --global --replace-all alias.sweep '!git branch --merged $([[ $1 != "-f" ]] \
&& git rev-parse master) | egrep -v "(^\*|^\s*(main|master|develop)$)" \
| xargs git branch -d'
View git.sucks.md
➜  frontend git:(master) git stash
No local changes to save
➜  frontend git:(master) git checkout feature/user-menu-and-logout
error: Your local changes to the following files would be overwritten by checkout:
        backend/warm-up/VERSION
Please commit your changes or stash them before you switch branches.
Aborting
View getting_started_with_nim.md
sh build.sh
bin/nim c koch
./koch boot -d:release
./koch tools
View systemd.sucks.md

Both systems are Raspberry 4 having exactly the same HW configuration, living on the same network. The first is Alpine Linux with OpenRC, the second if Ubuntu with Systemd. Both of the systems run OpenSSH with the same configuration.

~ time ssh -A 10.10.10.41 'exit 0'

________________________________________________________
Executed in  239.94 millis    fish           external
   usr time   12.44 millis   67.00 micros   12.37 millis
   sys time    9.36 millis  448.00 micros    8.91 millis
@l1x
l1x / getting_started_aarch64.md
Last active Nov 23, 2020
Getting started with AWS Firecracker on aarch64 (Raspberry Pi 4 for example)
View getting_started_aarch64.md

Getting started with Firecracker on Raspberry Pi 4B

Creating a new kernel

Getting the kernel source

We only need version 4.20

wget https://github.com/torvalds/linux/archive/v4.20.zip
@l1x
l1x / aws-update-policy-v2.sh
Created Nov 16, 2020
Updating managed policy in AWS
View aws-update-policy-v2.sh
#!/bin/bash
set -e
#set -x
AWS_PROFILE="dev-deploy"
POLICY_ARN="arn:aws:iam::2314123:policy/PolicyName"
POLICY_DOC="file://policies/PolicyNameOnDisk.json"
which aws >/dev/null 2>&1 || ("ERROR: aws command is not installed!"; exit 1)
which jq >/dev/null 2>&1 || ("ERROR: jq command is not installed!"; exit 1)
@l1x
l1x / git_delete_sensitive.sh
Last active Nov 12, 2020
Deleting a sensitive file from Git (including history) starting a certain commit hash
View git_delete_sensitive.sh
#!/usr/bin/env bash
PATH_TO_BE_DELETED="${1}"
if [[ -z ${PATH_TO_BE_DELETED} ]]; then
echo "Path variable a is not set"
exit 1
else
echo "Deleting $PATH_TO_BE_DELETED"
fi