Skip to content

Instantly share code, notes, and snippets.

View mcohen01's full-sized avatar

Michael Cohen mcohen01

View GitHub Profile
import pandas_datareader.data as web
import pandas as pd
import datetime as dt
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
def get_series(name, start, end):
df = web.DataReader('^GSPC', 'yahoo', start=start, end=end)['Adj Close']
#!/usr/bin/env bash
# ~/.macos — https://mths.be/macos
# Close any open System Preferences panes, to prevent them from overriding
# settings we’re about to change
osascript -e 'tell application "System Preferences" to quit'
# Ask for the administrator password upfront
sudo -v
def cai2php(lines):
import re
frames = []
current_frame = None
for line in lines:
line = str(line, 'utf-8')
# first line of the frame text
if re.match("^[0-9]+\.", line):
current_frame = re.sub('^[0-9]+\.\s+', '', line.strip())
# end of the frame text
import math
import os
import numpy as np
import pandas as pd
import scipy.stats as stats
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import us as us_states
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import json
import requests as r
import pprint
import sys
class Command:
def __init__(self) -> None:
self.headers = {
2018-12-17 00:00:00 22 item1
2018-12-17 01:00:00 26 item1
2018-12-17 02:00:00 23 item1
2018-12-17 03:00:00 25 item1
2018-12-17 04:00:00 201 item1
2018-12-17 00:00:00 22 item1
2018-12-17 01:00:00 26 item1
2018-12-17 02:00:00 23 item1
2018-12-17 03:00:00 25 item1
2018-12-17 04:00:00 201 item1
2018-12-17 05:00:00 17 item1
2018-12-17 06:00:00 18 item1
2018-12-17 07:00:00 27 item1
2018-12-17 08:00:00 54 item1
2018-12-17 09:00:00 37 item1
tar czf Downloads.tar.gz Downloads
tar czf Sites.tar.gz Sites
tar czf dots.tar.gz .aliases .aws .bash .bash_history .bash_profile .bash_prompt .bashrc .boto .config .curlrc .docker .dropbox .exports .gitconfig .gnupg .gsutil .hushlogin .inputrc .ipython .iterm2 .iterm2_shell_integration.bash .lein .mysql_history .profile .psql_history .sh_history .ssh .vim .viminfo .vimrc .vscode
tar czf Postgresql.tar.gz /usr/local/var/postgres/
gsutil cp Downloads.tar.gz gs://mcohen01-backup
gsutil cp Sites.tar.gz gs://mcohen01-backup
gsutil cp dots.tar.gz gs://mcohen01-backup
gsutil cp Postgresql.tar.gz gs://mcohen01-backup
gcloud config set compute/zone us-central1-c
gcloud compute instances create tpu-demo-vm --machine-type=n1-standard-4 --boot-disk-size=500GB --image-project=ml-images --image-family=tf-1-8 --scopes=cloud-platform
gcloud beta compute tpus create demo-tpu --range=10.240.1.0/29 --version=1.13 --network=default
gcloud compute ssh tpu-demo-vm
export TPU_NAME="demo-tpu"