Skip to content

Instantly share code, notes, and snippets.

View Ismoh's full-sized avatar
🐔
bwok bwok bwokaaak

Torben H. Ismoh

🐔
bwok bwok bwokaaak
View GitHub Profile
@jagrosh
jagrosh / Github Webhook Tutorial.md
Last active May 9, 2026 02:22
Simple Github -> Discord webhook

Step 1 - Make a Discord Webhook

  1. Find the Discord channel in which you would like to send commits and other updates

  2. In the settings for that channel, find the Webhooks option and create a new webhook. Note: Do NOT give this URL out to the public. Anyone or service can post messages to this channel, without even needing to be in the server. Keep it safe! WebhookDiscord

Step 2 - Set up the webhook on Github

  1. Navigate to your repository on Github, and open the Settings Settings
@iamalbert
iamalbert / test.lua
Created August 31, 2016 09:11
lua coroutine vs plain loop
require 'sys'
local n = 100000
local seq = {}
for i = 1, n do seq[i] = i end
local bs = 405
local plainLoop = function()
local yield = {}
for i = 1, #seq do
@enghqii
enghqii / main.lua
Created August 30, 2016 10:26
Lua Coroutine Example
queue = {}
queue_max = 100
producer = coroutine.create(function ()
while #queue < queue_max do
local item = "Hello! "..#queue
table.insert(queue, item)
-- print(item .. " inserted")
end
@corny
corny / lua-udp.lua
Created July 4, 2016 16:08
Lua UDP example
#!/usr/bin/env lua5.2
--
-- apt install lua5.2 lua-socket
--
local socket = require("socket")
local udp = assert(socket.udp())
local data
udp:settimeout(1)
@RyanPattison
RyanPattison / ordered_table.lua
Last active February 5, 2025 18:03
Ordered table for Lua. A table that keeps track of the order that keys are added and makes pairs iterate in order of insertion. Also, it maintains/reports the correct number of items in the table with the `#` operator.
local ordered_table = {}
--[[
This implementation of ordered table does not hold performance above functionality.
It invokes a metamethod `__newindex` for every access, and
while this is not ideal performance wise, the resulting table behaves very closely to
a standard Lua table, with the quirk that the keys are ordered by when they are first seen
(unless deleted and then reinserted.)
--]]
-- private unique keys
for idx = 1, 5 do repeat
print(1)
print(2)
print(3)
do break end -- goes to next iteration of for
print(4)
print(5)
until true end
@soulik
soulik / os_name.lua
Created May 12, 2015 18:23
OS type and CPU architecture detection in Lua language
local function getOS()
local raw_os_name, raw_arch_name = '', ''
-- LuaJIT shortcut
if jit and jit.os and jit.arch then
raw_os_name = jit.os
raw_arch_name = jit.arch
else
-- is popen supported?
local popen_status, popen_result = pcall(io.popen, "")
@fasterthanlime
fasterthanlime / oh-god-windows.md
Last active December 24, 2022 22:46
Getting rock 0.9.9 to make 32-bit binaries with MSYS2 on Windows

It seems the command-line toolchain of choice changes every fortnight on Windows (except if you're in the MSVC camp, but that's a no-go for ooc at the time of this writing).

The new kid on the block is msys2, which I first had doubts about, but it turns out it's a great way to get a shell, install the packages you need via pacman (!) and get started with ooc on windows.

MSYS2 32-bit

@HoraceBury
HoraceBury / tablelib.lua
Last active May 30, 2023 05:49
Lua table extensions used to improve and expand the table.* library in a simple manner.
-- table library extensions
if (dump == nil) then
dump = function(t)
print("=============")
for k,v in pairs(t) do
print("\t",k,v)
end
print("=============")
end
@gitaarik
gitaarik / git_submodules.md
Last active May 17, 2026 04:22
Git Submodules basic explanation

Git Submodules - Basic Explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a sub-repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.