Skip to content

Instantly share code, notes, and snippets.

View ahmedoumar's full-sized avatar
😄

Ahmed Oumar ahmedoumar

😄
View GitHub Profile
@kmbenjel
kmbenjel / words.rb
Last active May 29, 2023 18:32
My submission to: `Integer to English Words` challenge on LeetCode (Hard)
# frozen_string_literal: true
def three_digit_to_words(num)
ones = %w[zero one two three four five six seven eight nine]
teens = %w[ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen]
tens = %w[ten twenty thirty forty fifty sixty seventy eighty ninety]
words = []
if (num / 100).positive?
words << ones[num / 100].capitalize
@karpathy
karpathy / min-char-rnn.py
Last active May 19, 2024 14: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)