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
### Keybase proof | |
I hereby claim: | |
* I am perryism on github. | |
* I am perrylee (https://keybase.io/perrylee) on keybase. | |
* I have a public key ASB8r9SSmhz7ykeAh3aaFwfAgfpm90Fs8XpStxg0BVoNLwo | |
To claim this, I am signing this 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
# https://www.tensorflow.org/install/install_linux | |
# https://developer.nvidia.com/cuda-downloads | |
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb -qO cuda.deb | |
sudo dpkg -i cuda.deb | |
sudo apt-get update | |
sudo apt-get install -y python-pip python-dev build-essential libcupti-dev cuda | |
sudo pip install -U pip |
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 datetime import datetime, timedelta | |
import os, logging | |
def week_dir(): | |
now = datetime.now() | |
now = now - timedelta(days=now.weekday()) | |
return now.strftime("%Y-%m-%d") | |
def make_week_dir(): | |
try: |
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
""" | |
Make a copy of a file in case the block is modifying it | |
Example: | |
with Backup('filepath') as f: | |
pickle(f, xx) | |
""" | |
from datetime import datetime |
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 nvidia/cuda | |
MAINTAINER perry | |
COPY ./keyboard /etc/default/keyboard | |
RUN apt-get update && \ | |
apt-get install -y python-pip python-dev build-essential libcupti-dev cuda wget git && \ | |
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb -qO cuda.deb && \ | |
dpkg -i cuda.deb && \ |
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
read -s PASSWORD && security -v unlock-keychain -p $PASSWORD "/Users/plee/Library/Keychains/login.keychain-db" 2>&1 | grep -v 'unlock-keychain' |
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
class Record: | |
def __init__(self, record): | |
self.record = record | |
def decoded_data(self): | |
return base64.b64decode(self.record['data']) | |
def merge(self, new_data): | |
return { | |
'recordId': self.record['recordId'], |
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 json | |
import base64 | |
def each_data(stream): | |
for line in stream.readlines(): | |
data = json.loads(line) | |
data['errorMessage'] = json.loads(data['errorMessage']) | |
yield data, json.loads(base64.b64decode(data['rawData']).decode()) | |
import boto3 |
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 boto3 | |
from requests_aws4auth import AWS4Auth | |
from elasticsearch import Elasticsearch, RequestsHttpConnection | |
class AwsElasticSearchClient(Elasticsearch): | |
def __init__(self, **args): | |
session = boto3.Session() | |
creds = session.get_credentials().get_frozen_credentials() | |
awsauth = AWS4Auth( | |
creds.access_key, creds.secret_key, args["region"], "es", session_token=creds.token |
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 flask import Flask, request | |
app = Flask(__name__) | |
import logging, sys | |
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) | |
logger = logging.getLogger(__name__) | |
@app.route("/", methods=["POST", "GET"]) | |
def call(): |
OlderNewer