Skip to content

Instantly share code, notes, and snippets.

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
losinggeneration / main.c
Created December 10, 2012 17:20
libssh with & without goto for error handling
#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;
ssh_init();
atexit((void(*)())ssh_finalize);
@losinggeneration
losinggeneration / except.go
Created October 4, 2012 16:02
A quick and dirty exception handler for the Go programming language
/*
MIT license:
Copyright (c) 2012 Harley Laue <losinggeneration@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
@losinggeneration
losinggeneration / rss.go
Created September 25, 2012 15:13
Possible Go RSS formatter
package rss
import "encoding/xml"
type Channel struct {
XMLName xml.Name `xml:"channel"`
Title string `xml:"title"`
Description string `xml:"description"`
Link string `xml:"url"`
LastBuildDate string `xml:"lastBuildDate"`