Skip to content

Instantly share code, notes, and snippets.

-- placed in .config/mpv/user-builtins/
local msg = require 'mp.msg'
local function ping()
msg.error("PONG")
end
return {
ping = ping,
local mp = require 'mp'
local msg = require 'mp.msg'
local time_saved = 0 -- TODO keep running system total
local last_time = 0 -- FIXME reset this on on_load?
local last_speed = 1 -- FIXME not necessarily true, set this for real on on_load
local last_tick_time = 0
#lang racket
(require "murmur3.rkt")
(require data/bit-vector)
(require racket/serialize)
(provide make-bloom-filter make-recommended-bloom-filter bloom-filter-recommender bloom-filter-member? bloom-filter-batch-member? bloom-filter-add! false-positive-rate )
(define (murmur-int x seed) (murmur-hash (integer->integer-bytes x 8 false false) seed))
(define (h1 x) (murmur-int x 583))
(define (h2 x) (murmur-int x 2387))
@jgreco
jgreco / mpv_thumbnail_script_client_osc.lua
Created November 8, 2018 23:18
mpv_thumbnailer_script WITH youtube-quality OSC icon
--[[
Copyright (C) 2017 AMM
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
[youtube] CWG5oZB593w: Downloading webpage
[youtube] CWG5oZB593w: Downloading video info webpage
[info] Available formats for CWG5oZB593w:
format code extension resolution note
249 webm audio only DASH audio 53k , opus @ 50k, 7.95MiB
250 webm audio only DASH audio 69k , opus @ 70k, 9.97MiB
171 webm audio only DASH audio 125k , vorbis@128k, 17.30MiB
140 m4a audio only DASH audio 129k , m4a_dash container, mp4a.40.2@128k, 21.23MiB
251 webm audio only DASH audio 132k , opus @160k, 18.76MiB
160 mp4 256x144 144p 112k , avc1.4d400c, 25fps, video only, 9.43MiB
@jgreco
jgreco / gist:2932994
Created June 14, 2012 21:14
thread macro
#define THREAD(thread_id, fun, ...) \
__extension__ pthread_create(thread_id, NULL, ({ \
void *func() { \
fun(__VA_ARGS__); \
return NULL; \
} \
func;\
}), NULL)
@jgreco
jgreco / function.asm
Created October 1, 2011 06:45
AVR assembly macros for making register safe call on stack functions
; global registers:
; r0 - no man's land
; r1 - return address
; X (r26,r27) - frame pointer
;function frame:
;---------------------------
; return address
; arg0
; ...
@jgreco
jgreco / tco.c
Created September 14, 2011 02:16
TCO
#include "tco.h"
#include <stdlib.h>
#include <stdarg.h>
conscell cons_f(void *car, void *cdr)
{
conscell ret = malloc(sizeof(struct conscell_str));
ret->car = car;
ret->cdr = cdr;