Skip to content

Instantly share code, notes, and snippets.

Harley Laue losinggeneration

Block or report user

Report or block losinggeneration

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
losinggeneration / Gopkg.lock
Last active Apr 21, 2018
Viper PFlag nested binding
View Gopkg.lock
name = ""
packages = ["."]
revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9"
version = "v1.4.7"
branch = "master"
name = ""
packages = [".","hcl/ast","hcl/parser","hcl/printer","hcl/scanner","hcl/strconv","hcl/token","json/parser","json/scanner","json/token"]
losinggeneration / muxchain_kitten.go
Created May 18, 2014
This is a fix to the muxchain kitten example in
View muxchain_kitten.go
func main() {
m := muxchainutil.NewMethodMux()
m.Handle("GET /kitten", http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
f, _ := os.Open("kitten.jpg")
defer f.Close()
io.Copy(w, f)
http.ListenAndServe(":3000", m)
losinggeneration / lock.moon
Created Mar 24, 2014
Warlock Lua->Moon (just for fun)
View lock.moon
-- Set a lock
-- KEYS[1] - key
-- KEYS[2] - ttl in ms
-- KEYS[3] - lock content
{key, ttl, content} = KEYS
lockSet = 'setnx', key, content
losinggeneration / moon.xml
Created Jan 15, 2014
A MoonScript syntax file for Kate
View moon.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
By Harley Laue <>
Based on the CoffeeScript syntax file by Max Shawabkeh (
and the Lua syntax file by Bruno Massa
<language name="MoonScript"
losinggeneration / main.lua
Last active Oct 13, 2016
A Löve2D main.lua bootstrap file for Moonscript. This loads main.moon during development so moonc isn't required. It also has the nice side effect of automatically being overwritten when moonc is run so the game is ready to be distributed.
View main.lua
This file will purposefully overwritten when moonc is run. However it provides
an easy way to do Moonscript development without having to use moonc to compile
to Lua.
License (MIT)
View gist:8382292
function markdown()
lua5.1 <(echo "$(cat << EOLUA
if #arg > 0 then
for _,v in ipairs(arg) do
local lines = ""
local f =, "r")
if not f then
io.output(io.stderr):write(string.format([[%s: No such file or directory\n]], v))
losinggeneration /
Created Apr 9, 2013
A naive script to remove old kernels from Debian
find /boot -type f -mtime +90 -and -name "vmlinuz*" | while read i; do dpkg -S $i; done | cut -d":" -f1 | xargs dpkg -r
losinggeneration / lua_macro.zsh
Last active Dec 15, 2015
Lua path setting with ZSH functions. This is another reason why ZSH is awesome: macro shell scripting. This removes the need to duplicate code for each of these functions.
View lua_macro.zsh
# useful for when you have multiple lua commands for different versions
for i in lua lua5.2 lua5.1 luajit; do
function $i()
# Get Lua's version
local lua_version=$(command $0 -e "print(string.sub(_VERSION, -3))")
# Append to Lua's paths using normal shell variable interpolation
LUA_PATH=$(command $0 -e "print(package.path..';$HOME/.luarocks/share/lua/$lua_version/?.lua;$HOME/.luarocks/share/lua/$lua_version/?/init.lua;$HOME/.local/share/lua/$lua_version/?.lua;$HOME/.local/share/lua/$lua_version/?/init.lua')") \
LUA_CPATH=$(command $0 -e "print(package.cpath..';$HOME/.luarocks/lib/lua/$lua_version/?.so;$HOME/.local/lib/lua/$lua_version/?.so')") \
command $0 $*
View .bash_prompt.lua
local ret_code , n_jobs = ...
ret_code = tonumber ( ret_code )
n_jobs = tonumber ( n_jobs ) or 0
-- This MUST be updated to where ljsyscall is located
package.path = "/home/harley/Source/languages/lua/ljsyscall/?.lua;" .. package.path
local ljsyscall = require "syscall"
local getenv = os.getenv
local function cmd ( c )
losinggeneration / main.c
Created Dec 10, 2012
libssh with & without goto for error handling
View main.c
#include <stdio.h>
#include <stdlib.h>
#include <libssh/libssh.h>
int main(int argc, const char *argv[]) {
char *host = "localhost", *username = "username", *password = "password";
int port = 22, timeout = 5;
You can’t perform that action at this time.