Skip to content

Instantly share code, notes, and snippets.

View lotherk's full-sized avatar

Konrad Lother lotherk

View GitHub Profile
require 'logger'
logger = Logger.new(STDOUT)
logger.info "This is a log message"
require 'logger'
logger = Logger.new(STDOUT)
logger.progname = "MyApp"
logger.info "This is a log message"
logger.info("MyApp#method") { "This is a log message" }
logger.info "This is a log message, again"
module A
def self.a
puts caller[0]
end
end
A.a
module A
def self.a
puts caller[0]
end
def self.b
self.a
end
end
require 'logger'
logger = Logger.new(STDOUT)
logger.formatter = proc { |severity, datetime, progname, msg|
"#{datetime} #{severity} #{caller[4]}: #{msg}"
}
logger.info "This is a log message"
module TTVDB
def self.logger(output=STDOUT)
unless @logger
@logger = Logger.new(output)
@logger.formatter = proc { |severity, datetime, progname, msg|
kaller = caller[4]
file, ln, func = kaller.split(":")
_nil, func = func.split("`")
func.gsub!(/[<>']/, "")
file = File.basename(file)
@lotherk
lotherk / gist:e3ce62a2bc4ac746ad16
Created May 10, 2014 13:37
xpadder space engineers (w/ force feedback)
;--- Xpadder Controller File ---
DataType=Controller
Version=2013.07.18
[Button Locations]
Button1Location=16,96
Button2Location=46,96
Button3Location=76,96
Button4Location=106,96
Button5Location=136,96
@lotherk
lotherk / vpnroute.sh
Created June 20, 2014 10:46
vpnroute.sh
#!/bin/sh
GW_IFACE="mun0"
GW_IP="172.16.37.1"
LOCAL_IP="172.16.37.2"
ROUTE_PORTS="80 443 25 110 143 993"
MARK=2
TABLE=2
@lotherk
lotherk / gist:fe6b0d56a1711b37c505
Created September 24, 2014 11:13
dcs_intercom glovepie script
if pressed(Key.Backslash) {
debug = "intercom"
var.intercom = true
}
if released(Key.F12) or released(Key.Backslash) {
debug = "close intercom"
var.intercom = false
var.cmd = false
}
#!/bin/bash
/usr/bin/jackd -R -p128 -t2000 -dalsa -dhw:1 -r48000 -p256 -n3 -X raw &
jack_wait -w
Xvfb -screen 0 800x480x24 &
sleep 1
export DISPLAY=:0
/usr/bin/x11vnc -xkb -auth /var/run/lightdm/root/:0 -noxrecord -noxfixes -noxdamage -rfbauth /etc/x11vnc.pass -forever -bg -rfbport 5900 -o /var/log/x11vnc.log &
sleep 1
/root/bin/xwax -k -g 800x480 -j deck_0 -j deck_1 -l /mnt/music &
sleep 2