• 0 Posts
  • 34 Comments
Joined 27 days ago
cake
Cake day: February 5th, 2025

help-circle



  • Bash is a really great shell, but consider trying out a functional shell scripting language like Elvish (which is also a shell). Syntatically it’s pretty similar and not hard to pickup, but it’s stupid powerful. A cool example is updating different servers via ssh in parallel using a servers.json file;

    [
      {"name": "server.com", "user": "root", "identity": "~/.ssh/private_key0", "cmd": "apt update; apt upgrade -y"},
      {"name": "serverb.com", "user": "root", "identity": "~/.ssh/private_key1", "cmd": "pacman -Syu"},
      {"name": "serverc.com", "user": "root", "identity": "~/.ssh/private_key2", "cmd": "apk update; apk upgrade"}
    ]
    

    and a little elvish magic;

    var hosts = (from-json < servers.json)
    peach {|h|
      ssh $h[user]@$h[name] -i $h[identity] $h[cmd] > ssh-$h[name].log
    } $hosts
    

    Just run the script and boom, done. You can even swap out peach which is parallel each for each if you want to do each command procedurally–but I really love using peach, especially with file operations over many different files. Linux is fast, but peach is fuckin’ crazy fast. Especially for deleting files (fd -e conf -t file | peach {|x| rm $x }, or one thing that I do is extract internal subs (so they play on my chromecast) in my Jellyfin server, using elvish makes it really fast;

    fd -e mkv | peach {|x| ffmpeg -i $x -map 0:s:0 $x.srt }
    

    Find all *.mkv files, pass the filenames through ffmpeg (using peach) and extract the first subtitle as filename.mkv.srt. Takes only about a few seconds to do thousands and thousands of video files. I highly recommend it for home-labbers.


    Pretty dumb example, but peach is like 6x faster;

    ❯ time { range 0 1000 | each {|x| touch $x.txt }}
    5.2591751s
    ❯ time { range 0 1000 | peach {|x| touch $x.txt }}
    776.2411ms
    




  • Just swapped VPS hosts from ssdnodes to MassiveGRID. Got a pretty sweet deal, so I’m pretty excited.

    Got my services transferred over this week and it’s been fun as hell. It’s interesting because I was discussing Portainer with my buddy and he has Portainer on his local PC to connect to his remote instances and with hindsight it sounds obvious of course, but it’s such a nice little setup. Just finished setting up my Jellyfin reverse proxy so I’m gonna watch a movie and chill.










  • Seems to be online, but honestly duckdns isn’t exceptionally reliable…

    Check out hurricane electric. You can activate any A record as a DDNS record: http://i.xno.dev/u/fpaXcG.png

    Once the A record is activated, they’ll give you a key that you can simply update with curl or something similar. I created a function for my shell and just run it via crontab;

    fn ddns { xhs -4 "https://dyn.dns.he.net/nic/update?hostname=domain.com&password=password&myip="(xhs -4 -b https://myip.addr.tools/plain) }
    

    and then just execute:

    ❯ ddns
    HTTP/1.1 200 OK
    Cache-Control: no-cache, must-revalidate
    Content-Length: 18
    Content-Type: text/html
    Date: Sun, 02 Mar 2025 09:35:31 GMT
    Email: DNS Administrator <dnsadmin@he.net>
    Expires: Mon, 02 Mar 2026 09:35:31 GMT
    Server: dns.he.net v0.0.1
    
    nochg {ip}
    

    No dependencies, no software, and he.net is an ISP/Transit/COLO so they’re highly available (https://he.net/Hurricane_Electric_Geographic_Network_Map.jpg). I’ve been using their service for 5-6 years and never been down.



  • Yeah let’s instead install a massive bloated shit project that the original developers left years ago and the maintainers don’t know heads from tails of the code base because it’s too massive to maintain

    So much this. I recently had OneDev recommended to me as a forgejo alternative. I was told that it was “very lightweight.” Intrigued I tried it out. It fuckin’ runs java and is resource heavy as fuck. Just sitting idle it consumes almost 13% of VPS RAM: http://i.xno.dev/u/SGXxO2.png