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 September 18, 2024 22:04
Connect to SSH server through bastion/jump host
@pojntfx
pojntfx / main.sh
Created September 18, 2024 21:57
Disable automatic suspend for GDM and current user on Fedora
#!/bin/bash
gsettings list-recursively org.gnome.settings-daemon.plugins.power | grep sleep
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 0
sudo -u gdm dbus-run-session gsettings list-recursively org.gnome.settings-daemon.plugins.power | grep sleep
sudo -u gdm dbus-run-session gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0
sudo -u gdm dbus-run-session gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 0
@pojntfx
pojntfx / main.sh
Last active September 4, 2024 05:37
Share Wifi/WLAN to an Ethernet/LAN network using a Linux Desktop
#!/bin/bash
# 1. Go to "Settings → Networks"
# 2. Create a new profile
# 3. Go to "Identity" and set the name to "Shared", and the MAC address to that of your ethernet device (use the dropdown)
# 4. Go to "IPv4" and set the method to "Shared with other computers"
# 5. Go to "IPv6" and set the method to "Shared with other computers"
# 6. Select "Apply" to create the profile
# 7. Enable the profile by clicking on it
# 8. Run the commands below (replace wlp0s20f3 with your WLAN interface and enp0s13f0u3u1c2 with your LAN interface)
@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