Skip to content

Instantly share code, notes, and snippets.

--- a/LuaExtension.cxx 2010-07-21 01:03:41.000000000 +0200
+++ b/LuaExtension.cxx 2010-08-21 20:29:55.332214899 +0200
@@ -722,7 +722,9 @@
if (L) {
int traceback = 0;
if (tracebackEnabled) {
- lua_getglobal(L, "print");
+ lua_getglobal(L, "debug");
+ lua_getfield(L, -1, "traceback");
+ lua_remove(L, -2);
#!/usr/bin/lua
require 'lfs'
-- Path to where packages are located
REPO = 'packages'
-- List of packages (e.g. loaded from dist manifest)
PACKAGES = {
p1 = true, p2 = true, p3 = true,
}
# ...
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo -e " \e[0;33m"\(${ref#refs/heads/}\)
}
if [ "$color_prompt" = yes ]; then
PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\$(parse_git_branch)\[\033[00m\]\$ "
else
@mkottman
mkottman / multitouch.lua
Created December 22, 2011 21:19
Apple Multitouch MacBook trackpad in Lua using LuaJIT FFI
-- Apple Multitouch MacBook trackpad in Lua using LuaJIT FFI, 2011 Michal Kottman
-- definitions from http://www.steike.com/code/multitouch/
local ffi = require 'ffi'
ffi.cdef [[
typedef struct { float x,y; } mtPoint;
typedef struct { mtPoint pos,vel; } mtReadout;
typedef struct {
@mkottman
mkottman / favicon.ico
Last active December 18, 2015 09:09
Remote control your TV from the browser using Luvit / LIRC
@mkottman
mkottman / cacert.pem
Last active April 10, 2020 13:44
A simple Lua IMAP client. Prerequisites: LuaSocket and LuaSec
##
## ca-bundle.crt -- Bundle of CA Root Certificates
##
## Certificate data from Mozilla as of: Sat Dec 29 20:03:40 2012
##
## This is a bundle of X.509 certificates of public Certificate Authorities
## (CA). These were automatically extracted from Mozilla's root certificates
## file (certdata.txt). This file can be found in the mozilla source tree:
## http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1
##
@mkottman
mkottman / figfonts.sh
Created September 30, 2013 12:57
Show all ASCII art figlet fonts installed on your system using the font itself
#!/bin/sh
figlist | awk '/fonts/ {f=1;next} /control/ {f=0} f {print}' | while read font; do
echo "=== $font ==="
echo $font | figlet -f $font
done | less
@mkottman
mkottman / id3.lua
Created August 22, 2011 12:13
An ID3 tag reader implemented in pure Lua. Supports ID3v1 tags and a subset of ID3v2 tags.
--- A simple module to read ID3 tags from MP3 files.
-- Supports ID3v1 tags and a (meaningful) subset of ID3v2 tags.
-- @class module
-- @name id3
-- @author Michal Kottman
-- @copyright 2011, released under MIT license
local id3 = {}
local function textFrame(name)
@mkottman
mkottman / twoline_prompt.sh
Last active July 19, 2023 06:53
A two-line colored Bash prompt (PS1) with Git branch and a line decoration which adjusts automatically to the width of the terminal. Recognizes SVN, Git and Fossil version control systems and shows the current branch/revision.
# A two-line colored Bash prompt (PS1) with Git branch and a line decoration
# which adjusts automatically to the width of the terminal.
# Recognizes and shows Git, SVN and Fossil branch/revision.
# Screenshot: http://img194.imageshack.us/img194/2154/twolineprompt.png
# Michal Kottman, 2012
RESET="\[\033[0m\]"
RED="\[\033[0;31m\]"
GREEN="\[\033[01;32m\]"
BLUE="\[\033[01;34m\]"