Skip to content

Instantly share code, notes, and snippets.

View r0xsh's full-sized avatar
🐙
Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn

Antoine Bagnaud r0xsh

🐙
Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn
View GitHub Profile
@r0xsh
r0xsh / Dockerfile
Created January 14, 2024 13:25 — forked from adtac/Dockerfile
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@r0xsh
r0xsh / gist:6ccea438559f83e7c1bfefd1863d90e5
Created October 23, 2023 19:56 — forked from Fusl/gist:3a708b8c32c9d5264fa0
Streaming audio output from Linux (Pulseaudio) to Windows
# Windows (receiver) side:
.\ffplay.exe -nodisp -ac 2 -acodec pcm_u8 -ar 48000 -analyzeduration 0 -probesize 32 -f u8 -i udp://0.0.0.0:18181?listen=1
# Linux (transmitter) side:
pactl load-module module-null-sink sink_name=remote
ffmpeg -f pulse -i "remote.monitor" -ac 2 -acodec pcm_u8 -ar 48000 -f u8 "udp://RECEIVER:18181"
pavucontrol # Change the default output to the Null sink or move single applications to this "output" device.

Automating Daily Reports, because fuck it, really...

Each day at our company, developers are required to document their activities, painstakingly jotting down their daily work and future plans. A monotonous chore that I just really dislike.

So now, there's a scribe for that :

auto-dr-

Code

Record

ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 25 -s 1920x1080 -i :0.0 \
-vcodec libx264 -pix_fmt yuv420p -preset ultrafast -crf 0 -threads 0 \
-acodec pcm_s16le -y $(mktemp --suffix '.mkv')
ffmpeg -video_size 1920x1080 -r 59 -f x11grab -i :0.0 -vcodec libx264 \
@r0xsh
r0xsh / handler.sh
Created May 13, 2023 20:47
lenovo privagyguard ACPI polybar hook
#!/bin/bash
# Default acpi script that takes an entry for all actions
case "$1" in
button/power)
case "$2" in
PBTN|PWRF)
logger 'PowerButton pressed'
;;
*)
@r0xsh
r0xsh / read.java
Created April 12, 2019 07:46
Android: Read file contents from Uri
public static byte[] readUri(Context context, Uri uri) throws IOException {
ParcelFileDescriptor pdf = context.getContentResolver().openFileDescriptor(uri, "r");
assert pdf != null;
assert pdf.getStatSize() <= Integer.MAX_VALUE;
byte[] data = new byte[(int) pdf.getStatSize()];
FileDescriptor fd = pdf.getFileDescriptor();
FileInputStream fileStream = new FileInputStream(fd);
fileStream.read(data);
// to run on each frame
function lerp(position, targetPosition) {
// update position by 20% of the distance between position and target position
position.x += (targetPosition.x - position.x)*0.2;
position.y += (targetPosition.y - position.y)*0.2;
}
@r0xsh
r0xsh / dyn_arr.h
Created February 28, 2023 19:27 — forked from nicebyte/dyn_arr.h
dyn_arr
#pragma once
#define DYN_ARR_OF(type) struct { \
type *data; \
type *endptr; \
uint32_t capacity; \
}
#if !defined(__cplusplus)
#define decltype(x) void*
## /etc/X11/xorg.conf.d
Section "Monitor"
Identifier "eDP1"
Option "Primary" "true"
Option "PreferredMode" "1920x1080_60.05"
EndSection
Section "Monitor"
Identifier "DP2"
Option "LeftOf" "eDP1"
Write health
5600E1A8C7EF - 44 08 8C 16 988E0A00 - or [rsi+rdx+000A8E98],r9l
5600E1A8C7F7 - 8B 14 87 - mov edx,[rdi+rax*4]
5600E1A8C7FA - 89 94 86 B88E0A00 - mov [rsi+rax*4+000A8EB8],edx <<
5600E1A8C801 - 48 83 C0 01 - add rax,01
5600E1A8C805 - 48 3D 00010000 - cmp rax,00000100
RAX=0000000000000000
RBX=00005600E948BE70