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
linters: with_defaults( | |
line_length_linter(120), | |
camel_case_linter = NULL | |
) |
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
[net] | |
# Testing | |
# batch=1 | |
# subdivisions=1 | |
# Training | |
batch=1 | |
subdivisions=1 | |
width=416 | |
height=416 | |
channels=3 |
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 multiprocessing, joblib | |
def parallelize(iter_expression, func): | |
func = func.replace("(", ")(") | |
n_jobs = multiprocessing.cpu_count() | |
return eval("joblib.Parallel(n_jobs={})(joblib.delayed({} {})".format(n_jobs, func, iter_expression)) | |
parallelize("for i in range(10)", "print(i)") |
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 time | |
import pandas as pd | |
from multiprocessing import Pool | |
def worker(i): | |
t = time.time() | |
time.sleep(0.5) # simulate processing something | |
d = { | |
"name": "Player {}".format(i + 1), | |
"points": (i + 1) ** 2.0 |
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
const ua = require("universal-analytics"); | |
const request = require("request-promise"); | |
const { https } = require("firebase-functions"); | |
function getUserID (obj) { | |
if (!obj.source) { | |
return "dialogflow"; | |
} else { | |
switch (obj.source) { | |
case "twilio": |
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 re | |
def remove_padding(char, s, left=None, right=None): | |
if not left and not right: | |
print("You must specify either left or right.") | |
return | |
elif left: | |
return re.findall(re.escape(char) + r"*(.+)", s)[0] | |
elif right: | |
return re.findall(re.escape(char) + r"*(.+)", s[::-1])[0][::-1] |
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
# pip install lxml cssselect | |
import lxml.html | |
from lxml import etree | |
html = """ | |
<html> | |
<body> | |
<p>Hello world</p> | |
</body> |
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
# Install virtualenv | |
pip3 install virtualenv | |
# Go to project folder | |
cd path/to/project-name | |
# Create environment 'env' | |
virtualenv env | |
# Activate environment |
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
sudo su | |
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - | |
curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list > /etc/apt/sources.list.d/mssql-release.list | |
sudo apt-get update | |
sudo ACCEPT_EULA=Y apt-get install msodbcsql17 | |
sudo ACCEPT_EULA=Y apt-get install mssql-tools | |
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile | |
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc | |
source ~/.bashrc | |
sudo apt-get install unixodbc unixodbc-dev |
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
TRACKING_ID="UA-XXXXXXXX-Y" |