Skip to content

Instantly share code, notes, and snippets.

@cferdinandi
cferdinandi / terminal-cheat-sheet.txt
Last active November 20, 2024 00:48
Terminal Cheat Sheet
# Terminal Cheat Sheet
pwd # print working directory
ls # list files in directory
cd # change directory
~ # home directory
.. # up one directory
- # previous working directory
help # get help
-h # get help
@tomysmile
tomysmile / mac-setup-redis.md
Last active October 31, 2024 21:46
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@miguelgrinberg
miguelgrinberg / app.py
Created July 13, 2017 11:46
datetimepicker-example
from flask import Flask, render_template
from flask_bootstrap import Bootstrap
from flask_wtf import Form
from wtforms.fields import DateField
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret'
Bootstrap(app)
@jcorrius
jcorrius / cointegrated_adf.py
Created September 24, 2018 06:26
Cointegrated Augmented Dickey-Fuller Test
import numpy as np
from statsmodels.regression.linear_model import OLS
from statsmodels.tsa.tsatools import lagmat, add_trend
from statsmodels.tsa.adfvalues import mackinnonp
def adf(ts, maxlag=1):
"""
Augmented Dickey-Fuller unit root test
"""
# make sure we are working with an array, convert if necessary
@ih2502mk
ih2502mk / list.md
Last active November 19, 2024 19:29
Quantopian Lectures Saved
@EM5813
EM5813 / all.py
Created December 4, 2020 17:47 — forked from shashankvemuri/all.py
all of the code
import pandas as pd
import numpy as np
from bs4 import BeautifulSoup as soup
from urllib.request import Request, urlopen
pd.set_option('display.max_colwidth', 25)
# Input
symbol = input('Enter a ticker: ')
print ('Getting data for ' + symbol + '...\n')
@quantra-go-algo
quantra-go-algo / SP500_tickers_data.py
Last active August 19, 2024 20:53
Python code to get price data for all S&P500 tickers
# Import packages
import yfinance as yf
import pandas as pd
# Read and print the stock tickers that make up S&P500
tickers = pd.read_html(
'https://en.wikipedia.org/wiki/List_of_S%26P_500_companies')[0]
print(tickers.head())
# Get the data for this tickers from yahoo finance
@eliasdabbas
eliasdabbas / crawl_multiple_sites.py
Last active April 27, 2022 08:56
Crawl multiple websites with one for loop, while saving the output, logs, and job status separately for each website. Resume crawling any time simply be re-running the same code
from urllib.parse import urlsplit
import advertools as adv
sites = [
'https://www.who.int',
'https://www.nytimes.com',
'https://www.washingtonpost.com',
]