Skip to content

Instantly share code, notes, and snippets.

Avatar

Michal Kottman mkottman

View GitHub Profile
@mkottman
mkottman / figfonts.sh
Created Sep 30, 2013
Show all ASCII art figlet fonts installed on your system using the font itself
View figfonts.sh
#!/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 / cacert.pem
Last active Apr 10, 2020
A simple Lua IMAP client. Prerequisites: LuaSocket and LuaSec
View cacert.pem
##
## 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 / favicon.ico
Last active Dec 18, 2015
Remote control your TV from the browser using Luvit / LIRC
@mkottman
mkottman / twoline_prompt.sh
Last active Dec 23, 2020
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.
View twoline_prompt.sh
# 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\]"
@mkottman
mkottman / multitouch.lua
Created Dec 22, 2011
Apple Multitouch MacBook trackpad in Lua using LuaJIT FFI
View multitouch.lua
-- 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 / id3.lua
Created Aug 22, 2011
An ID3 tag reader implemented in pure Lua. Supports ID3v1 tags and a subset of ID3v2 tags.
View id3.lua
--- 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)
View bash_git_prompt.sh
# ...
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
View GitDist.lua
#!/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,
}
View SciteLuaTraceback.patch
--- 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);