Skip to content

Instantly share code, notes, and snippets.

@phiresky
phiresky / motioninterpolation.vpy
Last active January 12, 2025 07:39
Realtime motion interpolating 60fps playback in mpv
# vim: set ft=python:
# see the README at https://gist.github.com/phiresky/4bfcfbbd05b3c2ed8645
# source: https://github.com/mpv-player/mpv/issues/2149
# source: https://github.com/mpv-player/mpv/issues/566
# source: https://github.com/haasn/gentoo-conf/blob/nanodesu/home/nand/.mpv/filters/mvtools.vpy
import vapoursynth
core = vapoursynth.get_core()
@karpathy
karpathy / min-char-rnn.py
Last active May 4, 2025 03:00
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)
@havenwood
havenwood / ping.gemspec
Last active August 29, 2015 14:24
A Gem in a Gist with modern RubyGems
# -*- encoding: utf-8 -*-
#
# echo "gem 'ping', gist: '2f58ca4bbbb8c5720dc6'" >> gem.deps.rb
# gem install -g --no-lock
#
module Ping
VERSION = '0.1.0'
module_function
#include <stdio.h>
//; def int(*args); end
//; def main(*args, &block);
//; Object.class_eval { define_method("foo", &block) }; foo; end
//; def argc; end
//; def char; 3; end
//; def argv; 3; end
int main(int argc, char ** argv) {
width = 50; (1..width).each { |n| a = [" "] * width; dist = width/n.to_f; (1...n).each { |i| a[i*dist] = "/" }; puts "#{n.to_s.rjust(3)} #{a.join('')}" }
@havenwood
havenwood / fizz_buzz.exs
Last active October 21, 2015 23:37
Elixir FizzBuzz
defmodule FizzBuzz do
use GenServer
require Logger
def init(state) do
Logger.debug "Starting FizzBuzz Server ..."
{:ok, state}
end
@havenwood
havenwood / hello.cr
Created April 17, 2015 00:09
"Hello, world!" from MRuby embedded in Crystal
@[Link("mruby")]
lib MRuby
type MRubyState = Void*
fun open = mrb_open : MRubyState
fun load_string = mrb_load_string(mrb : MRubyState, code : Pointer(UInt8))
fun close = mrb_close(mrb : MRubyState)
end
CODE = <<-RUBY_CODE
@paulirish
paulirish / bling.js
Last active May 5, 2025 12:44
bling dot js
/* bling.js */
window.$ = document.querySelector.bind(document);
window.$$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); };
NodeList.prototype.__proto__ = Array.prototype;
NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); };
@imjasonh
imjasonh / markdown.css
Last active January 3, 2025 20:15
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}