Skip to content

Instantly share code, notes, and snippets.

@fedden
fedden / frequency_modulation_visualisation.py
Last active December 1, 2020 10:54
Frequency modulation Python matplotlib visualisation
import numpy as np
import matplotlib.pyplot as plt
modulator_frequency = 4.0
carrier_frequency = 40.0
modulation_index = 1.0
time = np.arange(44100.0) / 44100.0
modulator = np.sin(2.0 * np.pi * modulator_frequency * time) * modulation_index
carrier = np.sin(2.0 * np.pi * carrier_frequency * time)
@teamdandelion
teamdandelion / labels_1024.tsv
Last active February 6, 2024 08:33
TensorBoard: TF Dev Summit Tutorial
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
7
2
1
0
4
1
4
9
5
9
@karpathy
karpathy / min-char-rnn.py
Last active May 8, 2025 09:24
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)
from tkinter import *
import asyncio
from functools import wraps
import websockets
def runloop(func):
'''
This decorator converts a coroutine into a function which, when called,
runs the underlying coroutine to completion in the asyncio event loop.
'''
@karpathy
karpathy / gist:587454dc0146a6ae21fc
Last active May 4, 2025 05:18
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):
@benjaoming
benjaoming / pyedit_autopep8.py
Last active February 2, 2017 08:55
PyDev with autopep8 formatting upon CTRL+SHIFT+F
"""
This code is public domain.
The original author is Bear Huang (http://bear330.wordpress.com/).
Uploaded to GIST and adapted for autopep8 by github/benjaoming
"""
# Guide for installing a code formatter (like this one) in PyDev:
# http://bear330.wordpress.com/2007/10/30/using-pythontidy-in-pydev-as-code-formatter/
# Ensure that your autopep8.py is executable (chmod +x).
@jineeshjohn
jineeshjohn / gist:2044414
Last active December 5, 2018 18:59
Dynamic html table rows and column creation with jQuery
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<style>
table{
width:500px;
height:500px;
}
table td{
padding:10px;
margin:10px;
border:1px solid #ccc;