Skip to content

Instantly share code, notes, and snippets.

View dangh's full-sized avatar
🤖
I may be slow to respond.

Dang dangh

🤖
I may be slow to respond.
View GitHub Profile
@dangh
dangh / tftpd.fish
Created January 20, 2017 19:33
start OSX built-in TFTP server in fish shell
function tftpd
switch $argv
case start
sudo rm -rf /private/tftpboot
sudo ln -s (pwd) /private/tftpboot
sudo launchctl load -w /System/Library/LaunchDaemons/tftp.plist
case stop
sudo launchctl unload -w /System/Library/LaunchDaemons/tftp.plist
end
end
@dangh
dangh / uuid.lua
Last active April 6, 2023 09:52 — forked from jrus/lua-uuid.lua
quick lua implementation of "random" UUID
local function uuid()
math.randomseed(os.time())
local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
return string.gsub(template, '[xy]', function (c)
local v = (c == 'x') and math.random(0, 0xf) or math.random(8, 0xb)
return string.format('%x', v)
end)
end