Skip to content

Instantly share code, notes, and snippets.

@tylerneylon
tylerneylon / json.lua
Last active May 17, 2025 02:04
Pure Lua json library.
--[[ json.lua
A compact pure-Lua JSON library.
The main functions are: json.stringify, json.parse.
## json.stringify:
This expects the following to be true of any tables being encoded:
* They only have string or number keys. Number keys must be represented as
strings in json; this is part of the json spec.
@vovcacik
vovcacik / LAVSplitter-hack.md
Last active February 18, 2024 14:36
Hacking LAV Splitter to use plain old buffering

Hacking LAV Splitter to use plain old buffering

LAV Splitter is used to fetch network data in some media players (e.g. MPC-HC). The LAV buffer (aka packets queue) is not measured in data volume, but rather in packets (or frames, not sure here). Anyway, since the network throughput is limited by data volume, the number of packets in queue is multiplied by factor variable, which is bigger the higher quality video you are playing. This provides variable length buffer, however you can't really control the size and if you got slow WiFi you might have experienced choppy playback.

The following guide changes the way LAV buffer works by eliminating packet limits and putting the infamous "Maximum Queue Memory" settings in charge (you might have tried to increase this settings from default 256 MB to no avail as many have before you).

###32-bit instructions

  1. Open the mpc-hc/LAVFilters/LAVSplitter.ax file in [HEX editor][hxd] of your choice.
#!/bin/sh
#/ Usage: btsync-secret [option]...
#/ A Bittorrent Sync Secret Generator
set -e
h_flag=false
v_flag=false
e_flag=false
n_flag=false
c_flag=false
@GMMan
GMMan / chatbot_publiccmds.md
Last active June 9, 2016 20:10
Groupees ChatBot Command Help

Groupees ChatBot, programmed by cyanic.

Public Commands

help

Lists available commands.
Example: !help
Aliases: cmds, commands, introduction, introduce

@mengzhuo
mengzhuo / hash_djb2.py
Created March 9, 2015 07:40
DJB2 Hash in Python
#!/usr/bin/env python
# encoding: utf-8
def hash_djb2(s):
hash = 5381
for x in s:
hash = (( hash << 5) + hash) + ord(x)
return hash & 0xFFFFFFFF
@xero
xero / irc.md
Last active May 13, 2025 20:21
irc cheat sheet
@soulik
soulik / os_name.lua
Created May 12, 2015 18:23
OS type and CPU architecture detection in Lua language
local function getOS()
local raw_os_name, raw_arch_name = '', ''
-- LuaJIT shortcut
if jit and jit.os and jit.arch then
raw_os_name = jit.os
raw_arch_name = jit.arch
else
-- is popen supported?
local popen_status, popen_result = pcall(io.popen, "")
@zeux
zeux / nlerp.cpp
Created June 27, 2015 08:34
A fast version of nlerp that is very close to slerp, with some analysis/derivation code.
#include <math.h>
#include <stdio.h>
struct Q { float x, y, z, w; };
float dot(Q l, Q r)
{
return l.x * r.x + l.y * r.y + l.z * r.z + l.w * r.w;
}
@karpathy
karpathy / min-char-rnn.py
Last active May 12, 2025 17:28
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@grantland
grantland / AGB-001_Light_Mod.md
Last active May 14, 2025 19:53
AGB-001 Front/Backlight Mod Instructions

AGB-001 Front/Backlight Mod Instructions

AGB-001 Backlight Mod

Requirements

  • AGB-001
  • ASS101 screen