Skip to content

Instantly share code, notes, and snippets.

View tracek's full-sized avatar

Lukasz Tracewski tracek

View GitHub Profile
@tracek
tracek / ping.py
Created September 20, 2019 16:42
import re
import numpy as np
with open('code-corp.log') as f:
log = f.readlines()
latency = []
timeout = []
for idx, line in enumerate(log):
# For Khaned
FROM jupyter/base-notebook
USER $NB_UID
RUN pip install --yes ----no-cache-dir jupyter numpy matplotlib pandas pulp
COPY FooD_Kind.csv [destination]
@tracek
tracek / librosa_parallel.py
Created February 19, 2019 06:24
Running librosa parallel for loops with multiprocessing and joblib
# The script illustartes stunning difference on my machine with processing of signal with multiprocessing and joblib.
# The slowness of multiprocessing is likely caused by oversubscription
import time
import numpy as np
import librosa
from joblib import Parallel, delayed
from functools import partial
from multiprocessing import Pool

Keybase proof

I hereby claim:

  • I am tracek on github.
  • I am tracek (https://keybase.io/tracek) on keybase.
  • I have a public key ASAnakbg2gzt50cHIRePbtoR_SqQjqUgZGnoTMVhT6rpvgo

To claim this, I am signing this object:

@tracek
tracek / gist:463f85eed935440ba0193f33547cef45
Last active May 24, 2018 11:46
labelencoder for pandas
# Use `LabelEncoder` to encode encode labels with value between 0 and n_classes-1.
import pandas as pd
from sklearn.preprocessing import LabelEncoder
df = pd.DataFrame({'UserName': ['Peter', 'Richard', 'Peter'], 'exam': [1,2,2], 'score': [70,80,60]})
le = LabelEncoder()
df['UserName'] = le.fit_transform(df['UserName'])
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def validate_against_metadata(met, paths):
"""
Checks the list of images to ensure that a metadata entry exists for each one
if this is not the case, remove that image from the upload list.
Also check for blank values in the metadata fields, which will cause Property KeyErrors on GEE
Behaviour at the moment is to stop the upload if either type of errors is found, to allow the user to edit the file.
:param met - a dictionary of dictionaries containing the metadata entries:
:param paths - a list of full filepaths:
:return: updated list of full filepaths
"""