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 os | |
import os.path | |
from itertools import tee, izip | |
from subprocess import Popen, PIPE | |
BUFSIZE = 16 * 1024 * 1024 | |
def pairwise(iterable): | |
"s -> (s0,s1), (s1,s2), (s2, s3), ..." | |
a, b = tee(iterable) |
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
r = r'^rgba\((?P<red>\d+), (?P<green>\d+), (?P<blue>\d+), \d\.\d+\)$' | |
def max_rgba(color): | |
keys = ('red', 'green', 'blue') | |
d = { | |
k: int(v) | |
for k, v in zip( | |
keys, | |
re.search(r, color).group(*keys) | |
) |
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 python3 | |
import logging | |
import requests | |
SIGNIN_URL = "http://10.0.0.2/sign-in" | |
AIM_URL = "https://10.0.0.2/aim" | |
PID = "59ba0a1a100d2b744e4303e7" |
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
>>> parameters3 = { | |
... 'g': [100], | |
... 'h': [200, 201], | |
... 'i': [300, 301, 302], | |
... } | |
>>> | |
>>> from itertools import product | |
>>> def _exhaustive_list(parameters): | |
... keys, values = list(parameters.keys()), list(parameters.values()) | |
... return [ |
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 | |
from __future__ import print_function | |
import os | |
import os.path | |
import sys | |
from csv import DictReader | |
class DictDiffer(object): | |
""" |
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 | |
from hashlib import sha1 | |
import os | |
import os.path | |
from flask import ( | |
Flask, | |
send_from_directory, | |
) |
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: | |
# http://machinelearningmastery.com/5-step-life-cycle-long-short-term-memory-models-keras/ | |
# Example of LSTM to learn a sequence | |
from pandas import DataFrame | |
from pandas import concat | |
from keras.models import Sequential | |
from keras.layers import Dense | |
from keras.layers import LSTM | |
# create sequence |
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
% ls -l /usr/local/cuda/lib64/libcud* | |
-rw-r--r-- 1 root root 556000 May 10 13:21 /usr/local/cuda/lib64/libcudadevrt.a | |
lrwxrwxrwx 1 root root 16 May 10 13:21 /usr/local/cuda/lib64/libcudart.so -> libcudart.so.8.0 | |
lrwxrwxrwx 1 root root 19 May 10 13:21 /usr/local/cuda/lib64/libcudart.so.8.0 -> libcudart.so.8.0.61 | |
-rwxr-xr-x 1 root root 415432 May 10 13:21 /usr/local/cuda/lib64/libcudart.so.8.0.61 | |
-rw-r--r-- 1 root root 775162 May 10 13:21 /usr/local/cuda/lib64/libcudart_static.a | |
lrwxrwxrwx 1 ubuntu users 13 Nov 7 2016 /usr/local/cuda/lib64/libcudnn.so -> libcudnn.so.5 | |
lrwxrwxrwx 1 ubuntu users 18 Nov 7 2016 /usr/local/cuda/lib64/libcudnn.so.5 -> libcudnn.so.5.1.10 | |
-rwxr-xr-x 1 ubuntu users 84163560 May 31 16:28 /usr/local/cuda/lib64/libcudnn.so.5.1.10 | |
-rw-r--r-- 1 ubuntu users 70364814 May 31 16:28 /usr/local/cuda/lib64/libcudnn_static.a |
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
{17-06-01 15:10}lambda-devbox:~ ubuntu% nvidia-debugdump -l | |
Found 4 NVIDIA devices | |
Device ID: 0 | |
Device name: Graphics Device (*PrimaryCard) | |
GPU internal ID: 0321017145676 | |
Device ID: 1 | |
Device name: Graphics Device | |
GPU internal ID: 0321017095492 |
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
#!/bin/sh | |
brew install gcc@5 | |
sudo -H pip install --upgrade --force xgboost |