Skip to content

Instantly share code, notes, and snippets.

View armornick's full-sized avatar

Nick Arnoeyts armornick

  • Belgium
View GitHub Profile
//// seed.c ///////////////////////////////////////////////////////////////////
// seed is a lua executable which loads data and lua code embedded in the
// executable. Specifically, it loads from a zip file concatenated to its
// executable. Initially /init.lua from the zip file is run, and a loader is
// added to package.loaders so that 'require' searches inside the zip file. If
// a module is not found in the archive, then the default loaders are used.
//
// In addition to using 'require', lua files can be loaded with seed.loadfile,
// which is like loadfile except that it gets the file from inside the archive.
// Basic reading of arbitrary files from the archive is supported.
@armornick
armornick / seed.c
Created April 10, 2014 12:42
Seed (self-contained lua host using physfs to grab data from zip file concatenated to executable)
//// seed.c ///////////////////////////////////////////////////////////////////
// seed is a lua executable which loads data and lua code embedded in the
// executable. Specifically, it loads from a zip file concatenated to its
// executable. Initially /init.lua from the zip file is run, and a loader is
// added to package.loaders so that 'require' searches inside the zip file. If
// a module is not found in the archive, then the default loaders are used.
//
// In addition to using 'require', lua files can be loaded with seed.loadfile,
// which is like loadfile except that it gets the file from inside the archive.
// Basic reading of arbitrary files from the archive is supported.
@armornick
armornick / stripfile.lua
Created April 21, 2014 13:25
Utility to convert lua scripts to a C character array to embed scripts in code
---
-- Code copied from Premake-stable (scripts/embed.lua)
---
function iif(cond, iftrue, iffalse)
if cond then return iftrue else return iffalse end
end
local function stripfile(fname)
local f = io.open(fname)
@armornick
armornick / Lazarus.bat
Last active August 29, 2015 14:01
Batch script to make Lazarus (more) portable (for Lazarus version 1.2.2 but should be easy to modify)
@echo off
rem
rem from http://forum.lazarus.freepascal.org/index.php/topic,23343.msg139270.html
rem
rem Simple script to relocate lazarus to use the current driveletter as
rem path, and put basic portable app support in lazarus.
rem
rem Assumes lazarus is in drvletter:\lazarus and config in
@armornick
armornick / argparse_test.lua
Created June 5, 2014 09:34
Simple Argument Parser (and dependency-free pretty printer)
local concat, format = table.concat, string.format
-------------------------------------------------------------------------
--- Pretty Printing
-------------------------------------------------------------------------
function extended_tostring(o, qstring)
local otype = type(o)
if otype == "table" then
local result = {}
for k,v in pairs(o) do
@armornick
armornick / matchwords.nim
Created October 14, 2014 08:10
Testing Regular Expressions and Static Builds
# nimrod c --clibdir:. --dynlibOverride:pcre --PassL:-lpcre -d:release matchwords.nim
import re
var patt = re".*[a-zA-Z]+.*"
stdout.write("> ")
var inputs = stdin.readLine
while inputs != "":
@armornick
armornick / zip-dirs.js
Last active August 29, 2015 14:17
7-zip a whole bunch of directories in a directory
// Module imports
var _ = require('underscore'),
test = require('shelljs').test,
which = require('shelljs').which,
listdir = require('shelljs').ls,
exec = require('shelljs').exec;
// suppress output of commands
require('shelljs').config.silent = true;
@armornick
armornick / oban.styl
Created March 16, 2015 06:01
Translation of oban.io to Stylus (http://oban.io/)
//
// oban - a set of less mixins that give you a starting point when starting a new project
// v0.21.1
// https://github.com/firstandthird/oban
// copyright First+Third 2015
// MIT License
//
// translated for Stylus by armornick
//
@armornick
armornick / min.styl
Created March 16, 2015 06:02
Translation of min to Stylus (http://mincss.com/)
/*
* min
* a tiny framework that makes websites pretty
* https://github.com/owenversteeg/min
*
* translated to stylus by armornick
*/
// __var-lib.scss
@armornick
armornick / pocket-grid.styl
Created March 16, 2015 06:03
Translation of Pocket Grid to Stylus (https://arnaudleray.github.io/pocketgrid/)
/*! PocketGrid 1.1.0
* Copyright 2013 Arnaud Leray
* MIT License
*
* translated to stylus by armornick
*/
/* Border-box-sizing */
$use-border-box {
&, &:after, &:before {