Skip to content

Instantly share code, notes, and snippets.

View Swyter's full-sized avatar
💭
¯\_(ツ)_/¯

Swyter Swyter

💭
¯\_(ツ)_/¯
View GitHub Profile
@leegao
leegao / lregistry.c
Created July 23, 2011 03:01
Lua Registry library
#include <lua.h>
#include <lauxlib.h>
#include <Windows.h>
// using mingw
// gcc -shared -oregistry.dll -Ilua/include lua51.dll lregistry.c
// basically just a bitwise or function
static int Lmakeflag(lua_State *l){
int n = lua_gettop(l);
@eligrey
eligrey / html-domparser.js
Last active April 11, 2024 10:34
DOMParser HTML extension - Now a polyfill since HTML parsing was added to the DOMParser specification
/*
* DOMParser HTML extension
* 2019-11-13
*
* By Eli Grey, http://eligrey.com
* Public domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
/*! @source https://gist.github.com/1129031 */
@eligrey
eligrey / JS demo DOM tips.md
Created September 17, 2011 18:54
JS demo DOM tips

JS demo DOM tips

A few tips for shaving some bytes off your JS demos. I will probably add more to this list in the future.

Escaping HTML (saves 60-93B, depending on host document type)

26B:

new Option(html).innerHTML
@kizzx2
kizzx2 / fun.cpp
Created January 11, 2012 14:29
Illustrative C++ Lua binding example/tutorial
// fun.cpp
extern "C"
{
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
}
#include <iostream>
@abeluck
abeluck / concat-mp4-annexb.md
Created September 20, 2012 17:50
Concat MP4 files using AnnexB bitstream format

Concat MP4 files without transcoding to mpeg

  1. Use the h264_mp4toannexb bitstream filter to convert the mp4s (video steam only) into the AnnexB bitstream format

    ffmpeg -i input1.mp4 -vcodec copy -vbsf h264_mp4toannexb -acodec copy part1.ts
    # repeat for up to inputN
    
  2. Concat the files using cat

function SpotifyApi() {
this._modules = {};
this._requested = {};
this._moduleQueue = [];
this._delayedFns = [];
this._parallelReqs = 4;
this._contextStack = [];
this._deferredFlush = !1;
this._patchRequestOpen()
}
@torque
torque / aae-export.py
Last active August 17, 2020 15:24
Python script for exporting AAE formatted motion tracking data from Blender. Written by lachs0r.
# Copyright (c) 2013, Martin Herkt
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM

Exploiting Lua 5.1 on 32-bit Windows

The following Lua program generates a Lua bytecode program called ignore-unsigned-sga.fnt, which in turn loads a DLL from within an extremely locked down Lua 5.1 sandbox in a program called RelicCOH2.exe. The remainder of this document attempts to explain how this program works by a whirlwind tour of relevent bits of the Lua 5.1 virtual machine.

if string.dump(function()end):sub(1, 12) ~= "\27Lua\81\0\1\4\4\4\8\0" then
  error("This generator requires a 32-bit version of Lua 5.1")
end

local function outer()
  local magic -- In bytecode, the stack slot corresponding to this local is changed
@panzi
panzi / portable_endian.h
Last active April 18, 2024 20:59
This provides the endian conversion functions form endian.h on Windows, Linux, *BSD, Mac OS X, and QNX. You still need to use -std=gnu99 instead of -std=c99 for gcc. The functions might actually be macros. Functions: htobe16, htole16, be16toh, le16toh, htobe32, htole32, be32toh, le32toh, htobe64, htole64, be64toh, le64toh. License: I hereby put …
// "License": Public Domain
// I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like.
// In case there are jurisdictions that don't support putting things in the public domain you can also consider it to
// be "dual licensed" under the BSD, MIT and Apache licenses, if you want to. This code is trivial anyway. Consider it
// an example on how to get the endian conversion functions on different platforms.
#ifndef PORTABLE_ENDIAN_H__
#define PORTABLE_ENDIAN_H__
#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__)
@XVilka
XVilka / TrueColour.md
Last active May 28, 2024 17:42
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!