Skip to content

Instantly share code, notes, and snippets.

View Alex-Kopylov's full-sized avatar
🐍
just no

Alex Alex-Kopylov

🐍
just no
  • Georgia, Tbilisi
View GitHub Profile
@Alex-Kopylov
Alex-Kopylov / dvc list tracked
Created December 3, 2020 19:37
dvc list tracked files in current repo
dvc list -R --dvc-only ./
@Alex-Kopylov
Alex-Kopylov / Linux key speed
Created November 18, 2020 20:57
Increase key speed via a rate change
xset r rate 300 50
@Alex-Kopylov
Alex-Kopylov / Davinci Resolve 16 ARCH audio fix.sh
Created November 8, 2020 14:23
Davinci Resolve 16 ARCH audio fix
sudo pacman -S pulseaudio-alsa
def resumetable(df):
print(f"Dataset Shape: {df.shape}")
summary = pd.DataFrame(df.dtypes,columns=['dtypes'])
summary = summary.reset_index()
summary['Name'] = summary['index']
summary = summary[['Name','dtypes']]
summary['Missing'] = df.isnull().sum().values
summary['Uniques'] = df.nunique().values
summary['First Value'] = df.loc[0].values
summary['Second Value'] = df.loc[1].values
@Alex-Kopylov
Alex-Kopylov / disp_multiple_images.py
Created July 29, 2019 07:16 — forked from soply/disp_multiple_images.py
Plot multiple images with matplotlib in a single figure. Titles can be given optionally as second argument.
import matplotlib.pyplot as plt
import numpy as np
def show_images(images, cols = 1, titles = None):
"""Display a list of images in a single figure with matplotlib.
Parameters
---------
images: List of np.arrays compatible with plt.imshow.
def getSymbolBeforeDigit(x):
for i, c in enumerate(x):
if c.isdigit():
return x[i-1]
pd.to_numeric(data['Толщина_перед_смоткой'].apply(lambda x: x.split(getSymbolBeforeDigit(x))[1].replace(',','.')))
import time
import hashlib
t1 = time.time()
train_hashes = [hashlib.sha1(x).digest() for x in train_dataset]
valid_hashes = [hashlib.sha1(x).digest() for x in valid_dataset]
test_hashes = [hashlib.sha1(x).digest() for x in test_dataset]
valid_in_train = np.in1d(valid_hashes, train_hashes)
def randomize(dataset, labels):
permutation = np.random.permutation(labels.shape[0])
shuffled_dataset = dataset[permutation,:,:]
shuffled_labels = labels[permutation]
return shuffled_dataset, shuffled_labels
train_dataset, train_labels = randomize(train_dataset, train_labels)
test_dataset, test_labels = randomize(test_dataset, test_labels)
valid_dataset, valid_labels = randomize(valid_dataset, valid_labels)