Skip to content

Instantly share code, notes, and snippets.

@bishboria
bishboria / springer-free-maths-books.md
Last active March 18, 2026 03:40
Springer made a bunch of books available for free, these were the direct links
@havenwood
havenwood / rmd128.rb
Last active December 15, 2015 21:08
The hash function RIPEMD-128 in Ruby
require 'digest'
require 'stringio'
module Digest
class RMD128 < Digest::Class
##
# http://homes.esat.kuleuven.be/~bosselae/ripemd/rmd128.txt
#
# RIPEMD-128 is an iterative hash function that operates on 32-bit words.
# The round function takes as input a 4-word chaining variable and a 16-word
anonymous
anonymous / fizzbuzz.c
Created October 10, 2015 12:50
A FizzBuzz program. Somehow. I don't know why it works.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <gmp.h>
char * polynomial="-74101463560860539810482394216134472786413399/404009590666424903383979388988167534591844018460526499864038804741201731572423877094984692537474105135297393596654648304117684895744000000000000000000000*x^99 + 1786563401621773217421750502452955853226339781/1943688752347061390850759947022111850270039951356484879070977067483444756705819339975871373032521468004867185688372878439054154137600000000000000000000*x^98 - 27321291157050372775340569532625689973429185264741/12024094960310264981666053243695462339042976739896622019763059664916718201560234437350734896948634081407660523709959770955883479040000000000000000000000*x^97 + 4936870031754926645682423836151042176171669450909/1336493173680525187613977630110369004256312194947800263402124063124652591386915768177479078216982141485276408003996973457735680000000000000000000000*x^96 - 24473118674386691114350902920738421254018653211816783/55093218603941649400531744530105211175454647
@phiresky
phiresky / motioninterpolation.vpy
Last active October 31, 2025 01:50
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 April 4, 2026 16:39
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