Skip to content

Instantly share code, notes, and snippets.

@englercj
englercj / bootstrap.sh
Created August 31, 2019 16:16
Premake Bootstrap
#!/usr/bin/env bash
BUILD_DIR="build"
PREMAKE_VERSION="5.0.0-alpha14"
OS_NAME="$(uname -s)"
case $OS_NAME in
Linux*)
PREMAKE_OS="linux"
PREMAKE_EXT=".tar.gz"
@englercj
englercj / cleanupEOL.sh
Created July 24, 2018 18:38
cleanupEOL.sh
#!/usr/bin/env bash
FILES=`grep -IUlr $'\r' ${@}`
for file in $FILES; do
dos2unix $file
done
@englercj
englercj / createIconHeader.js
Last active February 11, 2018 18:42
Create icon header for material design icons (from css file)
#!/usr/bin/env node
const fs = require('fs');
const byline = require('byline');
const rgxName = /\.mdi-([^:]+):before {/;
const rgxCode = / content: "\\(F[0-9A-Fa-f]{3})";/;
const istream = byline(fs.createReadStream('css/materialdesignicons.css', { encoding: 'utf8' }));
// The suite used for all emit tests.
'use strict';
/**
* Preparation code.
*/
var EventEmitter3 = require('eventemitter3'),
EventEmitter1 = require('events').EventEmitter,
MiniRunner = require('mini-runner'),
MiniSignal = require('../src/index'),
@englercj
englercj / .eslintrc.json
Created September 14, 2016 15:39
pixi.js eslint file
{
"env": {
"es6": true,
"commonjs": true,
"browser": true
},
"globals": {
},
"parserOptions": {
"ecmaVersion": 6,
@englercj
englercj / example_caching_middleware.js
Last active August 29, 2015 14:13
Asset Loader API
// example of a simple in-memory cache for resources
var cache = {};
module.exports = function (options) {
return function (resource, next) {
// if cached, then set data and complete the resource
if (cache[resource.url]) {
resource.data = cache[resource.url];
resource.complete();
}
@englercj
englercj / SomethingRequestMessage.js
Created September 24, 2014 16:27
Desired workflow of a Protobuf.js-based code generator
// file: my/namespace/something/SomethingRequestMessage.js
var ProtoBuf = require('protobufjs');
function SomethingRequest() {
ProtoBuf.Message.apply(this, arguments);
this.addField(new ProtoBuf.Message.Field('required', 'int64', 'id', 1));
}
SomethingRequest.prototype = Object.create(ProtoBuf.Message.prototype);
@englercj
englercj / firewall.sh
Last active July 7, 2018 16:05
iptables setup
#!/bin/bash
IPT="/sbin/iptables"
### Interfaces ###
PUB_IF="eth0" # public interface
PRV_IF="eth1" # private interface
LO_IF="lo" # loopback
SERVER_IP=$(ifconfig eth0 | grep 'inet addr:' | awk -F'inet addr:' '{ print $2}' | awk '{ print $1}')
@englercj
englercj / gist:9924843
Last active August 29, 2015 13:57
Unicoin Farming for SE
function seData() {
var e = localStorage.getItem("se:fkey");
if (!e)
return {"time": 0};
var t = e.split(/,/);
return {"fkey": t[0],"time": parseInt(t[1], 10)}
}
function cheat() {
$.get("/unicoin/rock").done(function(e) {
@englercj
englercj / Light.js
Created February 2, 2014 20:59
Lighting system idea
function Light(pos, color, falloff) {
this.position = pos instanceof gf.Vector ? pos : new gf.Vector();
if(color == null)
this.color = new gf.Color(0xffffff);
else if(typeof color === 'number')
this.color = new gf.Color(color);
else
this.color = color;