Skip to content

Instantly share code, notes, and snippets.

@LPGhatguy
LPGhatguy / main.rs
Created June 3, 2017 08:56
Start program, attempt to move window, observe that window resizes
extern crate winit;
fn main() {
let events_loop = winit::EventsLoop::new();
let window = winit::WindowBuilder::new()
.with_dimensions(200, 200)
.with_max_dimensions(200, 200)
.build(&events_loop)
.unwrap();
@LPGhatguy
LPGhatguy / gist:f4caed3b81e7f84bccb701eb953a59ee
Created May 24, 2017 06:12
Community emoji, rendered by GitHub
👩🏽‍🚒‍👩🏻‍👦🏻‍👶🏻‍👩🏻‍🍳‍👩🏼‍👧🏾‍👶🏾‍👩🏽‍🚀‍👨🏽‍👦🏽‍👦🏼‍👨🏾‍🏫‍👨🏼‍👶🏾‍👧🏽‍👨🏽‍✈️‍👨🏾‍👦🏾‍👦🏼‍👨🏼‍🚒‍👩🏼‍👧🏼‍👧🏾‍👨🏾‍🎨‍👨🏼‍👦🏾‍👧🏻‍👨🏾‍✈️‍👨🏾‍👶🏼‍👦🏼‍👨🏼‍🎨‍👩🏿‍👧🏾‍👧🏽‍👩🏿‍💻‍👨🏽‍👦🏽‍👧🏼‍👩🏿‍✈️‍👨🏾‍👧🏿‍👧🏻‍👩🏾‍🎨‍👨🏼‍👦🏼‍👧🏻‍👩🏻‍🌾‍👨🏽‍👧🏾‍👧🏾‍👩🏼‍⚕️‍👨🏽‍👧🏾‍👧🏼‍👨🏾‍🚒‍👨🏿‍👶🏽‍👧🏽‍👨🏻‍💻‍👨🏽‍👧🏾‍👶🏾‍👨🏽‍🚀‍👩🏽‍👧🏼‍👧🏽‍👨🏽‍🏭‍👩🏽‍👶🏼‍👦🏾‍👨🏼‍🚒‍👩🏽‍👶🏾‍👦🏻‍👨🏼‍✈️‍👨🏾‍👧🏽‍👧🏼‍👨🏼‍🏫‍👩🏾‍👧🏻‍👦🏾‍👨🏽‍🍳‍👩🏿‍👶🏾‍👦🏻‍👨🏻‍✈️‍👩🏼‍👶🏼‍👶🏻‍👩🏻‍✈️‍👨🏿‍👧🏻‍👧🏼‍👨🏾‍🎨‍👩🏼‍👶🏽‍👶🏽‍👩🏼‍🚀‍👩🏾‍👦🏼‍👧🏽‍👨🏽‍💻‍👩🏼‍👧🏼‍👦🏾‍👨🏾‍🎤‍👩🏾‍👧🏽‍👦🏾‍👨🏻‍🎨‍👨🏼‍👶🏼‍👧🏽‍👩🏼‍🎤‍👨🏻‍👧🏼‍👧🏾‍👩🏼‍🎓‍👨🏼‍👧🏼‍👧🏾‍👨🏾‍🚒‍👨🏾‍👧🏾‍👶🏿‍👨🏾‍💼‍👨🏾‍👧🏾‍👦🏾‍👩🏽‍🚒‍👩🏼‍👶🏿‍👧🏾‍👨🏿‍🍳‍👩🏽‍👧🏽‍👧🏾‍👩🏾‍🚀‍👩🏼‍👧🏾‍👧🏿‍👩🏿‍🍳‍👩🏽‍👧🏽‍👧🏼‍👨🏽‍🏭‍👨🏿‍👧🏾‍👧🏽‍👨🏽‍🍳‍👩🏼‍👦🏻‍👶🏻‍👨🏽‍🏫‍👩🏻‍👧🏼‍👧🏼‍👨🏻‍🔬‍👨🏿‍👧🏿‍👶🏾‍👩🏾‍🏫‍👨🏽‍👧🏼‍👧🏼‍👨🏼‍🎤‍👨🏽‍👦🏻‍👧🏼‍👨🏽‍🍳‍👩🏻‍👧🏾‍👧🏾‍👩🏻‍🔬‍👩🏾‍👧🏻‍👶🏼‍👨🏽‍🎨‍👩🏻‍👦🏽‍👶🏾‍👩🏻‍💼‍👨🏼‍👧🏽‍👶🏽‍👩🏾‍🎤‍👨🏽‍👶🏻‍👧🏾‍👩🏽‍🔬‍👩🏾‍👦🏽‍👧🏻‍👨🏿‍🎨‍👨🏼‍👧🏾‍👧🏼‍👩🏼‍🚒‍👩🏼‍👦🏾‍👧🏽‍👨🏽‍✈️‍👨🏿‍👧🏾‍👧🏿‍👨🏾‍🏭‍👩🏼‍👶🏾‍👶🏽‍👨🏽‍🎤‍👩🏼‍👶🏾‍👶🏽‍👨🏽‍🚀‍👨🏼‍👧🏿‍👶🏾‍👨🏾‍🏫‍👨🏼‍👶🏼‍👶🏼‍👨🏻‍🏭‍👩🏿‍👧🏼‍👧🏿‍👩🏽‍🎨‍👨🏽‍👶🏾‍👧🏾‍👨🏻‍🚀‍👨🏼‍👦🏾‍👶🏿‍👩🏽‍✈️‍👨🏾‍👦🏿‍👧🏾‍👨🏼‍💻‍👩🏽‍👧🏻‍👶🏼‍👨🏿‍🏭‍👨🏽‍👧🏾‍👧🏼‍👨🏻‍✈️‍👩🏾‍👦🏾‍👶🏽‍👩🏼‍🔬‍👩🏽‍👶🏾‍👶🏾‍👨🏽‍🏭‍👩🏾‍👶🏿‍👦🏾‍👨🏽‍🎤‍👩🏽‍👦🏼‍👶🏾‍👩🏾‍🍳‍👩🏽‍👦🏼‍👶🏾‍👩🏽‍🏫‍👩🏽‍👶🏾‍👧🏽‍👩🏽‍🎨‍👨🏾‍👧🏻‍👦🏽‍👨🏾‍🔬‍👨🏿‍👦🏼‍👧🏿‍👩🏽‍🌾‍👩🏼‍👶🏼‍👧🏽‍👨🏿‍🎓‍👩🏼‍👶🏽‍👶🏿‍👩🏿‍🚀‍👩
@LPGhatguy
LPGhatguy / keybase.md
Created March 7, 2017 21:39
Proving Keybase.io identity!

Keybase proof

I hereby claim:

  • I am lpghatguy on github.
  • I am lpghatguy (https://keybase.io/lpghatguy) on keybase.
  • I have a public key ASAlopNHLRvh_NYWSkVIlct6b9hEdlseTDB97NKEtjNUCgo

To claim this, I am signing this object:

@LPGhatguy
LPGhatguy / parse-exp.lua
Created February 11, 2016 10:50
A parser for C-style numeric expressions
local bit = require("bit")
-- Operators that can stay as-is
local natop = {
["+"] = true,
["-"] = true,
["*"] = true,
["/"] = true
}
@LPGhatguy
LPGhatguy / VoipEncoder.lua
Created December 16, 2014 22:18
Demonstration of encoding SoundData into a packet
local ffi = require("ffi")
-- Create a C struct representing the header for our packet
ffi.cdef([[
typedef struct {
uint32_t uuid; // user identifier
uint32_t size; // in bytes
uint32_t bitrate; // in Hz
uint16_t bitdepth; // bits per sample
uint16_t channels; // probably 1 or 2
@LPGhatguy
LPGhatguy / minify.lua
Last active January 1, 2016 19:59
Minifies Lua from the command line.
--[[
Lua Minify 1.0
Usage:
lua minify.lua comments DIRECTORY
strips comments from all .lua files in the directory, recursively, and puts them in DIRECTORY/minified
lua minify.lua minify DIRECTORY
strips comments and minifies code from all .lua files and places them like the prior command.
]]
@LPGhatguy
LPGhatguy / format.lua
Created December 31, 2013 05:29
LDOC Prototype. Produces HTML-formatted documentation from Lua comments. See http://hastebin.com/nexedayeqo.lua for example input code. This is taken from my personal stash of utility scripts and isn't guaranteed to be decent. util.lua is the library's utility set (one function?) parser.lua parses the comments and forms a document tree. output.l…
return {
["html"] = {
value_process = function(source)
if (type(source) == "string") then
return source:gsub("\n", "\n<br />")
else
return source
end
end,
extension = ".html",
@LPGhatguy
LPGhatguy / luby.lua
Created June 19, 2013 00:37
This is a fun thing that allows select Ruby code (namely loops with ranges) to execute as valid Lua code.
--Luby 1.0
function construct_iterator(n)
local at = 0
return function()
at = at + 1
return n[at]
end, n
end
@LPGhatguy
LPGhatguy / cube.js
Last active December 18, 2015 16:19
This is the official WCA Cube Scrambling JavaScript source, taken from http://www.jaapsch.net/scramble_cube.htm.
var size=3;
var seqlen=30;
var numcub=5;
var mult=false;
var cubeorient=false;
var colorString = "yobwrg"; //In dlburf order. May use any colours in colorList below
// list of available colours
var colorList=new Array(
'y', "yellow", "yellow",
@LPGhatguy
LPGhatguy / CubeTimer.lua
Created June 19, 2013 00:13
The source for a cube timer application.
--[[
Cube Timer
Version 3.1
]]
local start_keys = {"lctrl", "ralt"}
local start_keys_down = {false, false}
local keys_down = false
local keys_down_last = false