Skip to content

Instantly share code, notes, and snippets.

@openp2pdesign
openp2pdesign / kivy-serialdata.py
Last active November 29, 2023 12:13
Drawing serial data with Kivy (Python)
# -*- coding: utf8 -*-
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.graphics import Line
from kivy.uix.label import Label
from kivy.core.window import Window
from kivy.clock import Clock
import serial
@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):
@Aldaviva
Aldaviva / joinmov.bat
Created January 10, 2015 08:21
Join multiple MOV files into a single MP4 without reencoding (useful for video cameras that split files every 4GB)
@echo off
if "%1"=="" (
echo usage example: join.bat video1.mov video2.mov video3.mov
echo this will create joined.mp4 in the same directory
exit /B 1
)
ffmpeg -version >nul 2>&1 || (
echo ffmpeg missing, install from http://ffmpeg.zeranoe.com/builds/
@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@kastnerkyle
kastnerkyle / gmmhmm.py
Last active March 9, 2023 06:14
GMM-HMM (Hidden markov model with Gaussian mixture emissions) implementation for speech recognition and other uses
# (C) Kyle Kastner, June 2014
# License: BSD 3 clause
import scipy.stats as st
import numpy as np
class gmmhmm:
#This class converted with modifications from https://code.google.com/p/hmm-speech-recognition/source/browse/Word.m
def __init__(self, n_states):
self.n_states = n_states
@kastnerkyle
kastnerkyle / dhmm.py
Last active September 4, 2019 18:59
Discrete hmm implementation - for learning purposes only!
# (C) Kyle Kastner, June 2014
# License: BSD 3 clause
import numpy as np
class dhmm:
def __init__(self, n_states, initial_prob=None,
n_iter=100, random_seed=1999):
# Initial state probabilities p(s_0)=pi[s_0].
@Uberi
Uberi / Speech Recognition.ahk
Created August 18, 2013 20:29
Speech recognition with Microsoft's SAPI. A simple SpeechRecognizer class provides a quick and easy way to use speech recognition in your scripts. Inspired by some [prototype code](http://www.autohotkey.com/board/topic/24490-voice-recognition-com/) made a long time ago.
#NoEnv
#Warn All
#Warn LocalSameAsGlobal, Off
#Persistent
/*
Speech Recognition
==================
A class providing access to Microsoft's SAPI. Requires the SAPI SDK.
@willurd
willurd / web-servers.md
Last active May 4, 2024 07:22
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@creaktive
creaktive / tinyp2p-annotated.py
Last active February 13, 2019 11:18
tinyp2p.py 1.0 (documentation at http://freedom-to-tinker.com/tinyp2p.html)
# tinyp2p.py 1.0 (documentation at http://freedom-to-tinker.com/tinyp2p.html)
# (C) 2004, E.W. Felten
# license: http://creativecommons.org/licenses/by-nc-sa/2.0
# Annotated by Kochin Chang, Jan. 2005
# Usage:
# Server - python tinyp2p.py password server hostname portnum [otherurl]
@jordanorelli
jordanorelli / receive.ck
Created January 18, 2013 22:21
polyphonic theremin for LEAP with Python and ChucK
class Voice {
int id; // id of the finger on the leapmotion
OscRecv in; // inbound communication
ADSR env => Pan2 pan => dac; // setup an ADSR envelope
Osc @ osc; // reference to the current oscillator
float x;
float y;
float z;
0 => int state;