Skip to content

Instantly share code, notes, and snippets.

View Seanny123's full-sized avatar
💭
>.<

Sean Aubin Seanny123

💭
>.<
View GitHub Profile
@Seanny123
Seanny123 / fake_sci_dat.csv
Created October 28, 2017 18:39
Fake data for Code Review
Text A Text B Text C
Brownie physics fruitcake sesame snaps. Brownie chocolate cake gingerbread jelly wafer powder toffee. Icing pastry icing cupcake powder oat cake souffle.
Cheesecake gingerbread pastry chocolate cake pudding tart. Lemon biology drops macaroon danish marzipan gummi bears sweet roll candy. Pastry toffee sweet roll.
Wafer donut tootsie roll. Jelly tart carrot cake icing apple pie halvah. Icing liquorice gingerbread chem muffin.
Candy canes jelly-o croissant. Macaroon powder danish. Icing tootsie roll apple pie
@Seanny123
Seanny123 / build_python.sh
Created June 27, 2017 09:19
Python build script
./configure --enable-optimizations --enable-shared
make -j4
make install
@Seanny123
Seanny123 / phil_lstm.py
Created May 30, 2017 07:03
Stateful LSTM with variable length inputs
from keras.models import Sequential
from keras.layers import LSTM, Dense
import numpy as np
def gen_sig(num_samples, seq_len):
one_indices = np.random.choice(a=num_samples, size=num_samples // 2, replace=False)
x_val = np.zeros((num_samples, seq_len), dtype=np.bool)
x_val[one_indices, 0] = 1
@Seanny123
Seanny123 / phil_lstm.py
Last active September 19, 2017 09:23
Stateful LSTM example
from keras.models import Sequential
from keras.layers import LSTM, Dense
import numpy as np
def gen_sig(num_samples, seq_len):
one_indices = np.random.choice(a=num_samples, size=num_samples // 2, replace=False)
x_val = np.zeros((num_samples, seq_len), dtype=np.bool)
x_val[one_indices, 0] = 1
from keras.layers import Input, Masking, LSTM, Dense
from keras.models import Model
import numpy as np
# Case1: model with return_sequences=True (output_shape = (1,10,1) )
##############################################################
input1 = Input(batch_shape=(1, 10, 16))
mask1 = Masking(mask_value=2.)(input1)
lstm1 = LSTM(16, return_sequences=True)(mask1)
dense_layer = Dense(1, activation='sigmoid')
@Seanny123
Seanny123 / mask_example.py
Last active May 29, 2017 08:49 — forked from ragulpr/py
Keras masking example
from keras.layers import Masking, Dense
from keras.layers.recurrent import LSTM
from keras.models import Sequential
import numpy as np
np.set_printoptions(precision=4)
np.random.seed(1)
@Seanny123
Seanny123 / cont_depth_plot.py
Created April 11, 2017 05:38
Fading updating 3D plot
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import proj3d
def main():
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.set_ylim(-100, 100)
ax.set_xlim(-10, 10)
@Seanny123
Seanny123 / animate_line.py
Created February 21, 2017 05:15
Controllable animation in matplotlib
import numpy as np
from collections import deque
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.widgets import Button, Slider
class AnalogPlot:
def __init__(self, data, display_len):
@Seanny123
Seanny123 / animate_line.py
Last active February 28, 2020 01:52
Extremely simple continuously animated line using Python and matplotlib
import numpy as np
from collections import deque
import matplotlib.pyplot as plt
import matplotlib.animation as animation
class AnalogPlot:
def __init__(self, data, display_len):
self.buff = deque([0.0]*display_len)
@Seanny123
Seanny123 / search_mup.py
Last active January 15, 2023 20:17
Go through a bunch of exported MindMup .mup files looking for text
"""
Iterates through a directory of exported MindMup .mup files and prints the title of each file that matches the given
regular expression, as well as the matched node contents.
MindMup is a mind mapping tool which represents the Directed Acyclic Graph (DAG) of a mind map as a nested dictionary encoded as JSON.
"""
import argparse
import json
from pathlib import Path