Skip to content

Instantly share code, notes, and snippets.

View raingloom's full-sized avatar

Use a better git forge raingloom

View GitHub Profile
// cargo-deps: hsl, image, csv = "1.0.0-beta.4", serde, serde_derive
// ~~~ PUBLIC DOMAIN ~~~
// I, the copyright holder of this work, hereby release it
// into the public domain. This applies worldwide.
// In case this is not legally possible, I grant any entity
// the right to use this work for any purpose, without any
// conditions, unless such conditions are required by law.
extern crate csv;
@raingloom
raingloom / here.lua
Created November 25, 2015 17:46
path up until current module (usually the current directory)
local prefix = ... and (...):match '(.-%.?)[^%.]+$' or ''
print( prefix )
--preserves last dot
--possible improvement: get module separator from package.config, usually not needed
--[[examples
require 'module.submodule'
module.
require 'long.path.to.submodule'
long.path.to.
dofile 'module.lua'
@tom-galvin
tom-galvin / mapwacom
Last active January 17, 2024 12:23
Mapwacom script
#!/bin/bash
# mapwacom script
MAPWACOM=$(basename $0)
EXIT_CODE_BAD_DEVICE=82
EXIT_CODE_NO_SUCH_DEVICE=80
EXIT_CODE_NO_SUCH_SCREEN=81
EXIT_CODE_MISSING_DEPS=83
EXIT_CODE_USAGE=64
@perky
perky / ProFi.lua
Created May 30, 2012 20:32
ProFi, a simple lua profiler that works with LuaJIT and prints a pretty report file in columns.
--[[
ProFi v1.3, by Luke Perkin 2012. MIT Licence http://www.opensource.org/licenses/mit-license.php.
Example:
ProFi = require 'ProFi'
ProFi:start()
some_function()
another_function()
coroutine.resume( some_coroutine )
ProFi:stop()