Skip to content

Instantly share code, notes, and snippets.

View retpolanne's full-sized avatar
🏳️‍⚧️

Anne Isabelle "Anya" Macedo retpolanne

🏳️‍⚧️
View GitHub Profile
#!/bin/bash
# Ref https://docs.kernel.org/admin-guide/binfmt-misc.html
# enabled
# interpreter /usr/bin/qemu-x86_64
# flags: POCF
# offset 0
# magic 7f454c4602010100000000000000000002003e00
# mask fffffffffffefe00fffffffffffffffffeffffff
# :name:type:offset:magic:mask:interpreter:flags
BINFMT=":qemu-x86_64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00:\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-x86_64:POCF"
@retpolanne
retpolanne / gen-dot-llm.sh
Created November 12, 2024 01:40
Generate control-flow graph from source code using ollama and graphviz
#!/usr/bin/env sh
# Usage
# ./gen-dot-llm.sh filename.java Function
temp_jpg=$(mktemp)
full_prompt=$(mktemp)
prompt="generate a control-flow graph from the following code in dot language.
Consider only the function $2. Output only the raw dot code without any other words.
@retpolanne
retpolanne / copy-paste-wo-bg.sh
Created August 6, 2024 22:01
Copy and paste without background color (tested between slack and chrome)
#!/bin/bash
pbpaste -Prefer public.html \
| xmllint --html - \
| perl -pe 's/background-color:.*?;//g' \
| perl -pe 's/background:.*?;//g' \
| textutil -format html -stdin -convert rtf -stdout \
| pbcopy -Prefer public.rtf
@retpolanne
retpolanne / gsoc-proposal.md
Last active March 23, 2024 19:26
GSoC Linux Foundation proposal

Chosen project

perf - Scalability and speed

Verbatim:

complexity: intermediate or hard

duration: small, medium or large
@retpolanne
retpolanne / sink.sh
Last active October 22, 2023 22:05
gstreamer file sink
bash > /proc/`pidof agetty`/fd/0
clear
echo -e '\033[?17;0;0c' > /dev/tty1
dd if=/dev/zero count=1000 bs=1024 > /dev/tty1
gst-play-1.0 --videosink "fbdevsink device=/dev/fb0" layer1.mp4
gst-launch-1.0 videotestsrc ! video/x-raw,width=640,height=480 ! fbdevsink audiotestsrc ! audioconvert ! autoaudiosink
gst-launch-1.0 filesrc location=/home/root/layer1.mp4 ! decodebin name=dec ! videoconvert ! fbdevsink dec. ! audioconvert ! audioresample ! autoaudiosink
@retpolanne
retpolanne / colorbars.sh
Created October 18, 2023 13:29
Low res smtpe bars with message and rtmp stream - taken from https://gist.github.com/nickferrando/6d572b044a205a507201e2fc69423a3e
docker run -d --rm --network=host bluenviron/mediamtx:latest
ffmpeg -re -f lavfi -i "smptebars=rate=30:size=320x240" \
-f lavfi -i "sine=frequency=1000:sample_rate=48000" \
-vf drawtext="text='YOUR MESSAGE:timecode=01\:00\:00\:00':rate=30:x=(w-tw)/2:y=(h-lh)/2:fontsize=12:fontcolor=white:box=1:boxcolor=black" \
-f flv -c:v h264 -profile:v baseline -pix_fmt yuv420p -preset ultrafast -tune zerolatency -crf 28 -g 60 -c:a aac "rtmp://localhost:1935/mystream"
vlc --network-caching=50 rtmp://localhost:1935/mystream
@retpolanne
retpolanne / README.md
Last active September 27, 2024 12:27
GDB using Docker and Colima

GDB using Docker and Colima

You need to create a privileged container, with SYS_PTRACE capabilities and host PID, so you can access all the PIDs in the host (in my case, Colima VM).

docker run --privileged --cap-add=SYS_PTRACE --pid=host --name gdb-docker -it ubuntu:latest bash

Within the container:

BLACK_TEXT='\033[30m'
BLUE='\033[48;2;92;206;250m'
PINK='\033[48;2;245;169;184m'
WHIT='\033[48;2;255;255;255m'
#NC='\033[0m' # No Color
NC='\033[K'
kitty +kitten icat --align right ./anya2.png
printf "${BLACK_TEXT}${BLUE} Anne \"Anya\" Macedo ${NC}\n"
printf "${BLACK_TEXT}${PINK} Infrastructure Engineer ${NC}\n"
#!/bin/bash
log show -start `date '+%Y-%m-%d'` --process loginwindow -style compact | grep screenlock | awk '{print $1 " " $2 " " $10}'
@retpolanne
retpolanne / linux-dev-nodes.md
Last active August 4, 2021 19:52
Notes from a newbie wannabe kernel developer

Linux Dev Notes

Notes from a newbie wannabe kernel developer.

First things first

I'm running Ubuntu on my Mac (working pretty well btw). I separated 10GBs for / and ~100GB for /home and I do my work on /home.

Configuring GRUB