import boto3
from boto3.dynamodb.conditions import Key
from boto3.dynamodb.types import TypeDeserializer
import json
print('Loading function')
tableName = 'fizzbuzz'
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
Your task is to implement a simplified version of an in-memory database. Plan your design according to the level specifications below: | |
Level 1: In-memory database should support basic operations to manipulate records, fields, and values within fields. | |
Level 2: In-memory database should support displaying a specific record's fields based on a filter. | |
Level 3: In-memory database should support TTL (Time-To-Live) configurations on database records. | |
Level 4: In-memory database should support backup and restore functionality. | |
I only got to level 3, got 750/750. | |
0/?? for Level 4. |
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 requests | |
import json | |
import webbrowser | |
USER = "alik604" | |
chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s' | |
# Change to your OS - https://stackoverflow.com/a/24353812/5728614 | |
req = requests.get('https://api.github.com/users/' + USER + '/starred?per_page=100') | |
# ?page=2&per_page=100 # page is not working, first result is always the same |
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
# imports from matplotlib import pyplot as plt | |
from matplotlib import pyplot as plt | |
import pylab | |
from mpl_toolkits.mplot3d import Axes3D | |
from mpl_toolkits.mplot3d import proj3d | |
%matplotlib inline | |
%pylab inline | |
from sklearn.manifold import TSNE | |
from sklear.decomposition import PCA |
Quickly get up to speed
Use Python 3.8.*. No point in 3.9, however it should be fine.
Run these to test if install is successful, and install some important packages. Please follow the errors as they come, one will ask the user to install C++ build tools, if not already installed (see below). This will take several minutes, as the dependencies are a few GBs. You must be off VPN, or set-proxy, as shown below.
for %i in (*.mp4) do ffmpeg -i "%i" -c:v libx265 -vtag hvc1 -preset fast "%~ni_265.mp4"
ffmpeg -i input.mp4 -c:v libx265 -vtag hvc1 -preset fast input_compressed.mp4
for %i in (*.mp4) do ffmpeg -i "%i" -c:v hevc_nvenc -preset fast "%~ni_nvda.mp4"
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 matplotlib.pyplot as plt | |
from sklearn.datasets import load_digits | |
from sklearn.decomposition import PCA, IncrementalPCA | |
iris = load_iris() | |
X = iris.data | |
y = iris.target |
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
# load data and set labels. details admitted | |
train = pd.read_csv('https://raw.githubusercontent.com/defcom17/NSL_KDD/master/KDDTrain%2B.csv') | |
test = pd.read_csv('https://raw.githubusercontent.com/defcom17/NSL_KDD/master/KDDTest%2B.csv') | |
train.columns , test.columns = labels , labels | |
combined_data = pd.concat([train, test]).drop('difficulty_level', 1) | |
le = LabelEncoder() | |
vector = combined_data['attack_type'] | |
print("Attack Vectors:", set(list(vector))) # use print to make it print on single line |
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 pylab as pl | |
from numpy import fft | |
def fourierExtrapolation(x, n_predict): | |
n = x.size | |
n_harm = 10 # number of harmonics in model | |
t = np.arange(0, n) | |
p = np.polyfit(t, x, 1) # find linear trend in x |
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
# make dataset to input | |
def build_dataset(time_series, seq_length): | |
dataX = [] | |
dataY = [] | |
for i in range(0, len(time_series) - seq_length): | |
_x = time_series[i:i + seq_length, :] | |
_y = time_series[i + seq_length, [-1]] # Next close price | |
print(_x, "->", _y) | |
dataX.append(_x) | |
dataY.append(_y) |
NewerOlder