Skip to content

Instantly share code, notes, and snippets.

@mrprofessor
mrprofessor / gifsicle_delete_frames.sh
Last active December 24, 2022 15:29
Delete frames using gifsicle
#gifsicle -O3 -k 8 --lossy=80 -o tty-small.gif js_demo.gif
#gifsicle --lossy=80 -o tty-small.gif js_demo.gif
#gifsicle --delete "#0-12" -o tty-small1.gif tty-small.gif
#gifsicle tty-small.gif --delete "#0-12" -o tty-small.gif
# Make a copy of the file
cp $1 $2
gifsicle "$1" --delete "#1-10" -o "$2"
gifsicle "$2" --delete "#100-105" -o "$2"
echo "script completed"
@tinywrkb
tinywrkb / btswitch
Last active February 6, 2024 10:09
NOT NEEDED WITH 0.3.21 OR GIT VERSION | PipeWire Pulse Server Bluetooth Auto-Switch
#!/bin/bash
#
# ~/.local/bin/btswitch
#
# wait a second this is too fast for udev
sleep 1
btdev="$(pactl list sinks|grep Name|grep 'bluez.*.a2dp.sink'|sed 's/Name: //'|sed 's/\s//')"
if [ -n "$btdev" ]; then
@koonix
koonix / mpvmusic.sh
Last active January 3, 2022 17:50
Play music in terminal via mpv.
#!/bin/sh
clear -x; tput civis # hide cursor
mpv \
--audio-display=no --term-osd-bar --force-window=no \
--keep-open=yes --display-tags-clr --term-title='mpv' \
--msg-level=cplayer=error,ffmpeg=fatal,ffmpeg/demuxer=error \
--term-status-msg='File: ${filename}\n\nTitle: ${metadata/by-key/title}\nArtist: ${metadata/by-key/artist}\nAlbum: ${metadata/by-key/album}\n\n${!playlist-count==1:Playing ${playlist-pos-1}/${playlist-count}\n}${?pause==yes:(Paused) }${time-pos} / ${duration}' \
--term-osd-bar-chars='[-> ]' "$@"
tput cnorm # cursor back to normal
@nitred
nitred / optimal_mtu.md
Last active November 13, 2024 12:36
Wireguard Optimal MTU

About

  • I faced bandwidth issues between a WG Peer and a WG server. Download bandwidth when downloading from WG Server to WG peer was reduced significantly and upload bandwidth was practically non existent.
  • I found a few reddit posts that said that we need to choose the right MTU. So I wrote a script to find an optimal MTU.
  • Ideally I would have liked to have run all possible MTU configurations for both WG Server and WG Peer but for simplicity I choose to fix the WG Server to the original 1420 MTU and tried all MTUs from 1280 to 1500 for the WG Peer.

Testing

  • On WG server, I started an iperf3 server
  • On WG peer, I wrote a script that does the following:
    • wg-quick down wg0
  • Edit MTU in the /etc/wireguard/wg0.conf file