Skip to content

Instantly share code, notes, and snippets.

View krishna2's full-sized avatar

Krishna Srinivasan krishna2

View GitHub Profile
@kahole
kahole / index.html
Last active April 26, 2024 06:04
*scratch*.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>*scratch*</title>
<style>
body {
font-family: Hack, Menlo, Monaco, 'Droid Sans Mono', 'Courier New', monospace;
white-space: pre;
@tomhicks
tomhicks / plink-plonk.js
Last active March 18, 2024 02:23
Listen to your web pages
@aparrish
aparrish / spacy_intro.ipynb
Last active August 9, 2023 01:41
NLP Concepts with spaCy. Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Creating a redis Module in 15 lines of code!

A quick guide to write a very very simple "ECHO" style module to redis and load it. It's not really useful of course, but the idea is to illustrate how little boilerplate it takes.

Step 1: open your favorite editor and write/paste the following code in a file called module.c

#include "redismodule.h"
/* ECHO <string> - Echo back a string sent from the client */
int EchoCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
@bishboria
bishboria / springer-free-maths-books.md
Last active April 25, 2024 06:27
Springer made a bunch of books available for free, these were the direct links
@karpathy
karpathy / min-char-rnn.py
Last active May 1, 2024 11: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)
@karpathy
karpathy / gist:587454dc0146a6ae21fc
Last active March 19, 2024 05:50
An efficient, batched LSTM.
"""
This is a batched LSTM forward and backward pass
"""
import numpy as np
import code
class LSTM:
@staticmethod
def init(input_size, hidden_size, fancy_forget_bias_init = 3):
@gleitz
gleitz / MIDI_scales.js
Last active February 11, 2024 06:17
MIDI scale arrays in Javascript
var scales = {
'natural major': [0,2,4,5,7,9,11,12],
'ionian': [0,2,4,5,7,9,11,12],
'major': [0,2,4,5,7,9,11,12],
'chromatic': [0,1,2,3,4,5,6,7,8,9,10,11,12],
'spanish 8 tone': [0,1,3,4,5,6,8,10,12],
'flamenco': [0,1,3,4,5,7,8,10,12],
'symmetrical': [0,1,3,4,6,7,9,10,12],
'inverted diminished': [0,1,3,4,6,7,9,10,12],
'diminished': [0,2,3,5,6,8,9,11,12],
@kentbrew
kentbrew / motion.html
Last active December 15, 2015 16:38
Motion demo for HTML5DevConf 2013
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>Drifting Things</title>
<style>
body {
text-align: center;
@kentbrew
kentbrew / index.html
Last active December 15, 2015 15:39
Sound demo for HTMLDevConf 2013
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>Sound Player</title>
<style>
body {
text-align: center;
}