Skip to content

Instantly share code, notes, and snippets.

@gt3
gt3 / min-char-rnn.py
Created November 14, 2021 18:32 — forked from karpathy/min-char-rnn.py
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)
scaler_features = StandardScaler().fit(build_df[build_df.columns.values[:-1]])
scaled_features = scaler_features.transform(build_df[build_df.columns.values[:-1]])
scaler_label = StandardScaler().fit(np.array(build_df[build_df.columns.values[-1]]).reshape(-1, 1))
scaled_label = scaler_label.transform(np.array(build_df[build_df.columns.values[-1]]).reshape(-1, 1))
### Split data using train proportion of 0.7
train_size = int(scaled_features[:, :-1].shape[0] * 0.7)
@gt3
gt3 / multipleActionEnhancer.md
Created December 27, 2018 18:17 — forked from Aldredcz/multipleActionEnhancer.md
Redux - enhance store to process multiple batched actions

Usable mainly when reducer is more like assembler for your data store changes, and main logic is put into action. So you often need to dispatch multiple smaller action, but to keep it atomic, they have to be processed in a single reduce step. This is the solution. The bonus is, it works well with devTools also.

Sourcecode:

multipleActionEnhancer.js:

export function multipleActionsEnhanceReducer(reducer) {
	return (state, action, ...rest) => {
		if (action.actions && action.actions.type && action.actions instanceof Array) {
			state = action.actions.reduce(reducer, state);
		} else {
@gt3
gt3 / timeago.js
Created January 20, 2018 23:17 — forked from IbeVanmeenen/timeago.js
TimeAgo - ES6
// Epochs
const epochs = [
['year', 31536000],
['month', 2592000],
['day', 86400],
['hour', 3600],
['minute', 60],
['second', 1]
];
@gt3
gt3 / markdownhere.css
Last active February 23, 2017 19:27 — forked from xiaolai/markdownhere.css
markdown-here-css
.markdown-here-wrapper {
font-size: 16px;
line-height: 1.8em;
letter-spacing: 0.1em;
}
pre, code {
font-size: 14px;
font-family: Roboto, 'Courier New', Consolas, Inconsolata, Courier, monospace;