This file contains hidden or 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 | |
| import pickle | |
| import sys | |
| if __name__ == '__main__': | |
| argv = sys.argv | |
| if len(argv) <= 1: | |
| print 'Specify pickle file as parameter.' |
This file contains hidden or 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
| # 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 ] |
This file contains hidden or 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 requests | |
| from bs4 import BeautifulSoup | |
| def get_downloads_count(package_name: str): | |
| badge_url = f"https://static.pepy.tech/badge/{package_name}" | |
| response = requests.get(badge_url) | |
| download_count = int( | |
| BeautifulSoup(response.text, 'html.parser') | |
| .find_all('text')[-1].text.replace('k', '000').replace('m', '000000') |
This file contains hidden or 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 | |
| # online computation of the mean and the variance. | |
| class RollingMean: | |
| def __init__(self): | |
| self.st = 0.0 | |
| self.n = 0 |
This file contains hidden or 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
| // y-cruncher Configuration File | |
| // Version: 0.7.8 Build 9507 | |
| // | |
| // Load this from y-cruncher or run directly: | |
| // y-cruncher config filename.cfg | |
| // | |
| // If you're copying Windows file paths into here, be sure to replace | |
| // all backslashes "\" with forward slashes "/". Backslash is an | |
| // escape character. | |
| // |
This file contains hidden or 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 __future__ import print_function | |
| import numpy as np | |
| from keras.callbacks import Callback | |
| from keras.layers import Dense | |
| from keras.layers import LSTM | |
| from keras.models import Sequential | |
| from numpy.random import choice | |
| from utils import prepare_sequences |
This file contains hidden or 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 __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 |
This file contains hidden or 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 | |
| # FIND LARGEST K ELEMENTS IN A 2D ARRAY IN NUMPY | |
| def find_k_largest_elements_in_2d_array(arr: np.array, k=1): | |
| assert len(arr.shape) == 2 | |
| h, w = arr.shape | |
| top_indices = np.flip(arr.flatten().argsort()[-k:]) | |
| return np.divmod(top_indices, w) |
This file contains hidden or 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 matplotlib | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| matplotlib.use('MACOSX') | |
| img_h, img_w = 250, 500 | |
| img = np.zeros((img_h, img_w)) |
This file contains hidden or 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 tensorflow as tf | |
| from tensorflow import keras | |
| from tensorflow.keras.applications import Xception | |
| import numpy as np | |
| num_samples = 1000 | |
| height = 224 | |
| width = 224 | |
| num_classes = 1000 |
NewerOlder