Skip to content

Instantly share code, notes, and snippets.

View philipperemy's full-sized avatar
🇨🇵
Solving AI together.

Philippe Rémy philipperemy

🇨🇵
Solving AI together.
View GitHub Profile
from __future__ import print_function
import os
import numpy as np
from keras.layers import RepeatVector
from keras.layers.core import Dropout
from keras.layers.recurrent import LSTM
from keras.models import Sequential
from keras.models import load_model
@philipperemy
philipperemy / lstm-keras-stateful-variable-length.py
Created January 16, 2017 01:47
LSTM Keras Stateful for variable length inputs
from __future__ import print_function
import numpy as np
from keras.layers import Dense
from keras.layers import LSTM
from keras.models import Sequential
from numpy.random import choice
USE_SEQUENCES = False
USE_STATELESS_MODEL = False
var https = require('https'),
user = process.argv[2],
opts = parseOpts(process.argv.slice(3))
request('/users/' + user, function (res) {
if (!res.public_repos) {
console.log(res.message)
return
}
var pages = Math.ceil(res.public_repos / 100),
@philipperemy
philipperemy / keras_var_length.py
Created March 15, 2017 01:16
Keras variable length LSTM
from __future__ import print_function
import numpy as np
from keras.layers import Dense
from keras.layers import LSTM
from keras.models import Sequential
from numpy.random import choice
USE_SEQUENCES = False
USE_STATELESS_MODEL = False
@philipperemy
philipperemy / install.sh
Created December 23, 2017 08:15
Install Neural Style Transfer
# Ubuntu:14.04 - 64 bits
# MINIMUM IS 8GB OF RAM.
curl -sk https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash
git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch; ./install.sh
. ~/.bashrc # or: . ~/.zshrc
luarocks install nn
luarocks install nngraph
#!/usr/bin/env python
"""
Produces load on all available CPU cores
"""
from multiprocessing import Pool
from multiprocessing import cpu_count
def f(x):
while True:
@philipperemy
philipperemy / extract.sh
Last active June 22, 2018 02:37
Mac OS - extract handshakes from CAP files of airport command
# On Mac OSX
# Will run AIRODUMP scan of all BSSIDs
# sudo airport -s
# Will run AIRODUMP sniff on channel 11
# sudo airport en0 sniff 11
# Atm, I can't find how to sniff on all channels at the same time.
if [ $# -eq 0 ]
@philipperemy
philipperemy / r-deps.sh
Created October 15, 2019 13:00
R package manager (kind of) - Find and install all dependencies of your R project.
set -e
PACKAGES="$(find . -type f -iname "*.R" -exec cat {} + | grep "^library" | sed 's/library(//g' | cut -d ')' -f 1 | sed -e 's/^"//' -e 's/"$//' | sort -u | xargs)"
for package in $PACKAGES;
do
echo "Installing package: ${package}..."
rscript -e "install.packages('${package}', repos='https://cran.rstudio.com')"
done
@philipperemy
philipperemy / get_tinder_token.py
Created October 18, 2019 01:56
Get tinder token
import json
import requests
CODE_REQUEST_URL = "https://graph.accountkit.com/v1.2/start_login?access_token=AA%7C464891386855067%7Cd1891abb4b0bcdfa0580d9b839f4a522&credentials_type=phone_number&fb_app_events_enabled=1&fields=privacy_policy%2Cterms_of_service&locale=fr_FR&phone_number=#placeholder&response_type=token&sdk=ios"
CODE_VALIDATE_URL = "https://graph.accountkit.com/v1.2/confirm_login?access_token=AA%7C464891386855067%7Cd1891abb4b0bcdfa0580d9b839f4a522&confirmation_code=#confirmation_code&credentials_type=phone_number&fb_app_events_enabled=1&fields=privacy_policy%2Cterms_of_service&locale=fr_FR&login_request_code=#request_code&phone_number=#phone_number&response_type=token&sdk=ios"
TOKEN_URL = "https://api.gotinder.com/v2/auth/login/accountkit"
HEADERS = {
@philipperemy
philipperemy / selenium_download_file.py
Created April 9, 2020 10:45
Chromedriver headless download file
def new_chrome_browser(headless=True, download_path=os.path.dirname(os.path.abspath(__file__))):
"""Helper function that creates a new Selenium browser"""
options = webdriver.ChromeOptions()
user_agent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.50 Safari/537.36'
if headless:
options.add_argument('headless')
options.add_argument('--window-size=1280x1024')
options.add_argument('--disable-gpu')
# options.add_argument(f'user-agent={user_agent}')
if download_path is not None: