Skip to content

Instantly share code, notes, and snippets.

View karolba's full-sized avatar
:shipit:

Karol Baraniecki karolba

:shipit:
View GitHub Profile
@karolba
karolba / scan-dynamodb-aws4-tiny.js
Last active May 4, 2024 19:52
Scan a dynamodb table with aws4-tiny
const credentials = {
accessKeyId: "AKIA...",
secretAccessKey: "...",
}
const region = 'eu-west-1'
async function dynamoDB(target, body) {
const response = await aws4.fetch({
service: 'dynamodb',
@karolba
karolba / userChrome.css
Last active December 25, 2023 14:21
Firefox userChrome.css that makes it look a bit more like Safari on macOS
.tabbrowser-tab .tab-close-button {
order: -1 !important;
padding-inline-start: 6px !important;
margin-left: -4px !important;
margin-right: -20px !important;
z-index: 1 !important;
}
.tabbrowser-tab .tab-close-button:not(:hover) {
color: rgba(0, 0, 0, 0) !important;
@karolba
karolba / exectree.zsh
Last active August 24, 2023 20:29
A very quick-and-dirty strace to json process tree parser
#!/bin/zsh
# Generate strace.* files like that:
# strace -o strace -D -qqq --no-abbrev -y -Y -s 16384 -ff -ttt --seccomp-bpf -e "trace=fork,vfork,clone,fchdir,chdir,/exec*" -e signal=none [...]
emulate sh
# Speed up grep and other similar tools
export LC_ALL=C
@karolba
karolba / libc-minumum-supported-linux-versions.md
Last active March 18, 2024 07:41
(GNU/)Linux distributions and their minimum kernel versions supported by their libc

glibc-based systems

The minimum kernel version can be configured by passing in the --enable-kernel parameter to glibc's configure script.

  1. Arch Linux - Linux 4.4 (release year: 2016)
...
--enable-kernel=4.4
...
@karolba
karolba / alpine-on-stardust-no-rescue.md
Last active November 12, 2023 16:47
Install Alpine Linux on Scaleway Stardust without the rescue image using https://netboot.xyz

A way to install Alpine Linux on a Scaleway Stardust instance without the use of a rescue image, but by booting into the install image over the network using https://netboot.xyz.

  1. Connect to the serial console, using scw instance server console {uuid} zone={zone}

  2. Reboot the VM into UEFI settings

    • either by executing systemctl reboot --firmware on the machine
    • or by using scw instance server reboot {uuid} zone={zone} locally and repeatedly mashing the escape key on the serial console image
  3. Go to Device Manager -> Network Device List -> the only network device -> HTTP Boot Configuration -> Boot URI

@karolba
karolba / 90-custom-logitech-mx-mini-mac-keyboard.hwdb
Created June 8, 2022 08:46
Key mapping to use a ISO layout MX Keys Mini for Mac keyboard with Linux comfortably
# /etc/udev/hwdb.d/90-custom-logitech-mx-mini-mac-keyboard.hwdb
evdev:name:MX Keys M Mac Keyboard:*
KEYBOARD_KEY_70064=grave # plusminus/paragraph -> grave/tilde
KEYBOARD_KEY_700e2=leftmeta # left option -> left windows/super
KEYBOARD_KEY_700e3=leftalt # left command -> left alt
KEYBOARD_KEY_700e7=rightalt # right command -> right alt
# to reload the config, execute: systemd-hwdb update && udevadm trigger
@karolba
karolba / set-user-key-mapping.sh
Last active March 14, 2023 05:14
My personal key remappings for macos - for "ISO International Layout" keyboards
#!/bin/bash
common_mapping=(
$' {"HIDKeyboardModifierMappingSrc":0x7000000e7, \n' # <!-- from: right command -->
$' "HIDKeyboardModifierMappingDst":0x7000000e6}, \n' # <!-- to: right option -->
$' \n' #
$' {"HIDKeyboardModifierMappingSrc":0x7000000e6, \n' # <!-- from: right option -->
$' "HIDKeyboardModifierMappingDst":0x7000000e7}, \n' # <!-- to: right command -->
$' \n' #
$' {"HIDKeyboardModifierMappingSrc": 0x7000000E0, \n' # <!-- from: left control -->
@karolba
karolba / web.nasm
Last active July 25, 2023 19:24
A forking web-server with directory contents listing in x86_64 assembly
extern printf
extern perror
extern exit
extern puts
extern socket
extern bind
extern listen
extern accept
extern close
extern fdopen
@karolba
karolba / quicksort_mips.asm
Created May 9, 2019 16:29
A simple quicksort with a dynamically allocated array implemented for the MARS MIPS emulator
.eqv SYS_PRINT_INT 1
.eqv SYS_READ_INT 5
.eqv SYS_MALLOC 9
.eqv SYS_EXIT 10
.eqv SYS_PRINT_CHAR 11
.eqv SYS_READ_CHAR 12
# macros that push register(s) to the stack
.macro push (%a)
#include <iostream>
#include <memory>
#include <json/value.h>
#include <json/reader.h>
#include <json/writer.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <ext/stdio_filebuf.h>