Skip to content

Instantly share code, notes, and snippets.

View pojntfx's full-sized avatar
💭
🌅

Felicitas Pojtinger pojntfx

💭
🌅
View GitHub Profile
@pojntfx
pojntfx / main.sh
Created June 24, 2024 16:43
Download latest GNOME OS `systemd-sysupdate` image
#!/bin/bash
wget https://os.gnome.org/download/latest/gnome_os_sysupdate_installer.iso
@pojntfx
pojntfx / README.md
Created June 20, 2024 03:27
Use `dart-sass` on Vercel with Hugo
  • In environment variables, set: HUGO_VERSION=0.121.2
  • Use curl -L https://git.io/vQhTU | bash -s -- --version 1.22.4 && curl -L https://shorturl.at/cwSIl | tar -xzvf - -C /tmp && export PATH=$PATH:/tmp/dart-sass && source ~/.bashrc && make depend && make build-pwa/ps-pwa as the build command.
@pojntfx
pojntfx / main.sh
Created June 18, 2024 00:31
Port-forwarding from a VM at a private IP to the outside with `iptables`
#!/bin/bash
# Expose all ports of the VM at `<guest-veth-ip>:<port>` (this is done by default)
# nc "${HOST_VETH_INTERNAL_IP}" guest-veth-port-here
export HOST_VETH_INTERNAL_IP="10.0.8.1"
export NAMESPACE_INTERFACE_IP="172.100.100.2"
sudo ip netns exec ark0 iptables -t nat -A PREROUTING -d "${HOST_VETH_INTERNAL_IP}" -j DNAT --to-destination "${NAMESPACE_INTERFACE_IP}"
sudo ip netns exec ark0 iptables -t nat -A POSTROUTING -d "${NAMESPACE_INTERFACE_IP}" -j MASQUERADE
@pojntfx
pojntfx / main.go
Last active June 4, 2024 23:21
Use `pprof` to profile a Go application
import _ "net/http/pprof"
// ...
go func() {
log.Println(http.ListenAndServe("localhost:6060", nil))
}()
@pojntfx
pojntfx / client.sh
Last active June 11, 2024 05:33
Stream Wayland desktop over network with Pipewire, GStreamer and MJPEG
#!/bin/bash
gst-launch-1.0 tcpclientsrc host=localhost port=5000 ! multipartdemux ! jpegdec ! videoconvert ! autovideosink
@pojntfx
pojntfx / main.sh
Created June 4, 2024 20:27
Stream webcam to browser with GStreamer
gst-launch-1.0 v4l2src device=/dev/video1 ! videoconvert ! videoscale ! video/x-raw,width=720,height=320 ! theoraenc ! oggmux ! tcpserversink host=127.0.0.1 port=8080
@pojntfx
pojntfx / main.sh
Last active May 29, 2024 05:29
Build FreeRDP/xfreerdp with H264 enabled as a Flatpak and connect to a system with it
#!/bin/bash
flatpak-builder --repo=repo build packaging/flatpak/com.freerdp.FreeRDP.json
flatpak build-bundle repo com.freerdp.FreeRDP.flatpak com.freerdp.FreeRDP --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
flatpak install ./com.freerdp.FreeRDP.flatpak
flatpak run com.freerdp.FreeRDP /v:localhost:3389 /u:liveuser /gfx:avc420 /h:1200 /w:1920
# Or alternatively:
xfreerdp /v:localhost:3389 /u:pojntfx /p:LujOPipihBoc +multitouch +gestures -grab-keyboard -grab-mouse /gfx:AVC444,RFX,progressive:on /bpp:32 +dynamic-resolution
@pojntfx
pojntfx / main.sh
Last active May 29, 2024 19:30
Renderer a GTK4/libadwaita Flatpak application in the browser with Broadway
#!/bin/bash
gtk4-broadwayd :5
# Natively
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 workbench
# Flatpak
flatpak run --env=GDK_BACKEND=broadway --env=BROADWAY_DISPLAY=:5 --filesystem=/run/user/1000 re.sonny.Workbench
# Now open http://localhost:8085/
@pojntfx
pojntfx / main.js
Created May 26, 2024 21:41
Play a video in libadwaita from hTorrent with GJS and gtk4paintablesink
import Adw from "gi://Adw?version=1";
import Gtk from "gi://Gtk?version=4.0";
import Gst from "gi://Gst?version=1.0";
Gst.init(null);
const application = new Adw.Application({
application_id: "com.github.pojntfx.adwaitaGStreamerExample",
});
@pojntfx
pojntfx / Makefile
Created May 26, 2024 21:29
Use `panrpc` to connect a GJS application to a Go/NodeJS/Bun backend with bi-directional RPCs
dev:
npx esbuild playground.js --bundle --outfile=/tmp/playground.js '--external:gi://*' --platform=neutral && gjs -m /tmp/playground.js