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
""" | |
This is a template algorithm on Quantopian for you to adapt and fill in. | |
""" | |
import quantopian.algorithm as algo | |
from quantopian.pipeline import Pipeline | |
from quantopian.pipeline.data.builtin import USEquityPricing | |
from quantopian.pipeline.filters import QTradableStocksUS | |
def initialize(context): |
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 time | |
import pprint | |
import functools | |
from functools import wraps | |
def repeat(num_times=1): | |
def decorator_repeat(func): | |
@functools.wraps(func) | |
def wrapper_repeat(*args, **kwargs): |
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 subprocess | |
bashCommand = ''' | |
last | awk '{ print $1"|"$3 }' | |
''' | |
process = subprocess.Popen(bashCommand,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT) | |
output, error = process.communicate() | |
lines=output.split('\n') | |
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 collections import Counter | |
class Tank(): | |
def __init__(self, value): | |
self.tab = dict(Counter(value)) | |
def mult(self, x, factor): | |
self.tab[x] = self.tab[x] * factor |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 time | |
import pprint | |
import functools | |
from functools import wraps | |
def repeat(num_times=1): | |
def decorator_repeat(func): | |
@functools.wraps(func) | |
def wrapper_repeat(*args, **kwargs): |
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/bash | |
while read oldrev newrev refname | |
do | |
branch=$(git rev-parse --symbolic --abbrev-ref $refname) | |
if [ "master" == "$branch" ]; then | |
sudo git --git-dir=/home/git/ozsales.git --work-tree=/opt/ozsales checkout -f master >/dev/null | |
cd /opt/ozsales | |
PIP=/home/luotao/venv/ozsales/bin/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
import requests | |
import json | |
import uuid | |
from flask_oauthlib.client import OAuthRemoteApp | |
from flask_oauthlib.utils import to_bytes | |
from jose import jws | |
from oauthlib.oauth2 import WebApplicationClient | |
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
# os lib | |
sudo yum update | |
sudo yum groupinstall "Development Tools" | |
sudo yum install -y gcc gcc-c++ git zlib zlib-devel libffi-devel openssl-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz xz-devel findutils | |
# pyenv | |
git clone https://github.com/pyenv/pyenv.git ~/.pyenv | |
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile | |
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile | |
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profile |
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
[user] | |
name = Lorne | |
email = [email protected] | |
[alias] | |
# BASIC | |
cl = clone | |
ci = commit -m | |
mg = merge | |
st = status | |
co = checkout |