Skip to content

Instantly share code, notes, and snippets.

View itsAnanth's full-sized avatar
🧠
figuring out stuff

Ananth itsAnanth

🧠
figuring out stuff
View GitHub Profile
@itsAnanth
itsAnanth / bubbleSort.js
Last active November 28, 2021 17:29
Implementation of bubble sort in javascript
// bubble sort in javascript
Array.prototype.bubbleSort = function(callback = (a, b) => a > b) {
const array = this;
for (let i = 0; i < array.length; i++) {
let swaps = 0;
for (let j = 0; j < array.length - i - 1; j++) {
if (callback(array[j], array[j + 1])) {
let temp = array[j];
array[j] = array[j + 1];
@karpathy
karpathy / min-char-rnn.py
Last active July 27, 2025 12:08
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)