Skip to content

Instantly share code, notes, and snippets.

View SoniEx2's full-sized avatar

Soni L. SoniEx2

View GitHub Profile
@SoniEx2
SoniEx2 / special.lua
Last active August 29, 2015 14:01
IRC friendly Lua table copy
-- the following deep copy function never stack overflows from recursion
-- needs optimization tho
local function deep(inp,copies)
-- push
local stack = {{inp = inp, key = nil, value = nil, next = false, skipNext = false, out = nil}}
local currentResult
copies = (type(copies) == "table") and copies or {}
@SoniEx2
SoniEx2 / gist:db92b01e8053c7505ab4
Last active August 29, 2015 14:10
6th wave feminism

6th Wave Feminism

So let's make a "6th wave" of feminism (w/e that means)

There are 4 main rules:

  1. Respect everyone. (or rather, don't care about things which aren't primarily about you)
  2. Accept and support everyone until they harm others. (see examples)
  3. Get absolutely everyone to follow this.
--[[ pastebin didn't like me so I'm moving it here ]]
--[[ code used to make Shocky run this remote file
.r sonilua <lua>local function runpage(pageurl) local page,f,l; page = {net.get(pageurl)}; f=loadstring(page[1]); l = {}; for k,v in pairs(_G) do l[k] = v; end; for k,v in pairs(getfenv()) do l[k] = v; end; setfenv(f,l); return f(); end; return runpage("https://gist.githubusercontent.com/SoniEx2/f392c77ae81032bc295e/raw/sonilua.lua");
--]]
--[[
This is public domain btw
--]]
if (not args) or (args == "") then
-- JIT It, the thing that makes LuaJIT JIT.
do
-- get the registry table
local registry = debug.getregistry();
-- replace debug.getregistry with a JIT-able (pure-Lua) version.
debug.getregistry = function() return registry end
end

MPNGPNG - Mutli-PNG PNG spec

MPNGPNG v0.22

Authors:

@SoniEx2
SoniEx2 / Abstract Enums.md
Created May 4, 2015 00:54
Abstract Enums

Hello,

I'd like to talk about abstract enums. In Java, you have enums:

public enum MyEnum {
    MY_ENUM_VALUE,
    MY_OTHER_ENUM_VALUE;
}
@SoniEx2
SoniEx2 / andif.md
Last active September 18, 2015 03:44

The andif Idea

[I might throw this one out. Scroll down for the orif idea]

Trivial use-case

Sometimes when you're coding you end up with things like this:

@SoniEx2
SoniEx2 / 52emu.lua
Created September 26, 2015 19:05 — forked from katlogic/52emu.lua
local track={}
setmetatable(track,{__mode="v"})
function setmetatable52(t,mt)
if mt.__gc then
local p = newproxy(true)
track[p] = t
getmetatable(p).__gc = function(p)
local mt = debug.getmetatable(t)
if mt and rawget(mt, "__gc") then
rawget(mt, "__gc")(t)
@SoniEx2
SoniEx2 / steamchat.md
Created April 26, 2016 23:14
Steam Chat

Did you know?

Steam chat, the thing you use while playing games, mangles your messages for you... It's especially interesting when sending shell commands.

  • ~/.ssh/config becomes http://ssh/config
  • $HOME/.ssh/config becomes http://HOME/.ssh/config
  • ${HOME}/.ssh/config becomes http://HOME}/.ssh/config
@SoniEx2
SoniEx2 / apng_sucks.md
Last active August 19, 2016 17:38
APNG Sucks!

APNG Sucks!

Hi! Let's talk about APNG! Note that I'm biased because I made my own animated PNG extension and it also sucks.

Problems with APNG

So, APNG has the following issues: