Skip to content

Instantly share code, notes, and snippets.

@masakk1
masakk1 / Playlist_PathConvertor.sh
Created April 12, 2026 13:56
Replaces the extension of the songs found in playlists to the same one. It will ONLY look for .m3u files.
#!/bin/bash
# --- WHAT IT DOES ---
# Replaces the extension of the songs found in playlists to the same one.
# It will ONLY look for .m3u files.
# --- WHY ---
# Because I use my uncompressed library on the computer, and a compressed one
# on portable storage or devices.
@masakk1
masakk1 / setpeername_doesnt_care.lua
Created February 25, 2025 22:53
`:setpeername()` doesn't care whether its connected or not. Contrary to `luasocket`'s documenation.
local socket = require("socket")
-- Proof that `:setpeername()` doesn't care whether it's connected or not
-- On the other hand, `:getpeername()` errors if the UDP object isn't connected
local udp, err = socket.udp()
assert(udp, err)
local function print_peer(message)
print(message)
local success, result = pcall(udp.getpeername, udp)
@masakk1
masakk1 / test_udp.lua
Created February 25, 2025 22:12
Code to test the type annotations for LuaCATS/luasocket 's UDP module
local socket = require("socket")
local client, err = socket.udp()
local server, err = socket.udp()
assert(client, err)
assert(server, err)
---@cast server UDPSocketUnconnected
server:setsockname("127.0.0.1", 12345)