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

CTCP COLOR

CTCP COLOR is a CTCP ACTION-like CTCP, but instead of providing a different message style, it provides different colors.

Let:

X-DELIM ::= '\x01'
SPACE ::= ' '
-- 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 / clex.md
Last active December 18, 2016 02:31

ClEx - Clunky Expressions

Version 0.10.

Authors:

  • SoniEx2

About

@SoniEx2
SoniEx2 / Makefile
Created April 4, 2015 14:48
liolib.lua, JIT-able reimplementation of Lua's I/O library. MIT license.
# This makefile is so we can extract some #define's from the C library, as LuaJIT has no way of exposing those #define's.
# Just run `make liolib.lua`.
LIOLIBC= int SEXIO_IOFBF = _IOFBF; \
int SEXIO_IOLBF = _IOLBF; \
int SEXIO_IONBF = _IONBF; \
int SEXIO_SEEK_SET = SEEK_SET; \
int SEXIO_SEEK_CUR = SEEK_CUR; \
int SEXIO_SEEK_END = SEEK_END;
@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: