This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gym | |
import time | |
from gym import envs | |
print(envs.registry.all()) | |
env = gym.make('CartPole-v0') | |
env.reset() | |
t = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import time | |
import sys | |
print("## Checking Keras\n\n") | |
import keras.backend as K | |
backend = K.backend() | |
vlen = 10 * 30 * 768 | |
iters = 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gensim.models import Doc2Vec | |
import pickle | |
with open('./docs_proc.pkl', 'rb') as file: | |
docs = pickle.load(file) | |
model = Doc2Vec(docs, vector_size = 500, window = 9, min_count = 20, workers=8, dm=0) | |
with open('./d2v_model.pkl', 'wb') as file: | |
pickle.dump(model, file) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
word_list = [doc.words for doc in docs] | |
bigram = gensim.models.Phrases(word_list) | |
bigram_phr = gensim.models.phrases.Phraser(bigram) | |
bi_docs = [] | |
for doc in docs: | |
words = bigram_phr[doc.words] | |
tags = doc.tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def series_to_supervised(df, n_in=1, n_out=1, targets=[], dropnan=True): | |
""" | |
Converts a time series Pandas DataFrame into a supervised learning problem | |
returns: X(t-n_in+1,...,t), y(t+1,....,t+n_out) | |
""" | |
assert n_in > 0 and n_out > 0 | |
assert all([t in df.columns for t in targets]) | |
n_vars = len(df.columns) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Linq; | |
using System.Reflection; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace CSV |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://blog.jessitron.com/2013/08/finding-and-removing-large-files-in-git.html | |
git rev-list master | while read rev; do git ls-tree -lr $rev | cut -c54- | grep -v '^ '; done | sort -u | perl -e ' | |
while (<>) { | |
chomp; | |
@stuff=split("\t"); | |
$sums{$stuff[1]} += $stuff[0]; | |
} | |
print "$sums{$_} $_\n" for (keys %sums); | |
' | sort -rn >> /tmp/large_files | |
gedit /tmp/large_files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# START_0f56bb1d | |
# To Install permanently: | |
# curl -s https://gist.githubusercontent.com/HeshamMeneisi/0f56bb1dfd3ca3d09d304d3a02107205/raw/Productivity >> ~/.bashrc && source ~/.bashrc | |
# To Uninstall: | |
# cp ~/.bashrc bashrc.bak && perl -0777 -i -pe "s/# START_0f56bb1d.+# END_0f56bb1d//igs" ~/.bashrc | |
# To use temporarily: | |
# source <(curl -s https://gist.githubusercontent.com/HeshamMeneisi/0f56bb1dfd3ca3d09d304d3a02107205/raw/Productivity) | |
# Useful paths | |
# !! MAKE SURE TO UPDATE VERSION NUMBERS !! | |
export PATH=/home/$USER/.dotnet:/usr/local/cuda-9.0/bin:~/browser-drivers:~/.composer/vendor/bin${PATH:+:${PATH}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
# Requirements | |
# sudo apt install mdbtools | |
import os | |
import subprocess | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
usage() { | |
cat << EOF | |
Usage: $0 [OPTION] | |
Build frontend. | |
Arguments: | |
-d Dev-mode (This will skip any production-specific operations) | |
-s Push stable to docker.io, ignored in dev-mode. (auto-set by "feat:*" commit) | |
-b Build image (auto-set after a new commit) |
OlderNewer