Skip to content

Instantly share code, notes, and snippets.

View whittlem's full-sized avatar

Michael Whittle whittlem

View GitHub Profile
#!/bin/sh
### BEGIN INIT INFO
# Provides: apache
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: apache
# Description: Start apache
### END INIT INFO
@whittlem
whittlem / rhel8-apache24-using-mpm
Last active September 7, 2020 16:26
Amazon AWS EC2 'User Data' script to auto provision Apache 2.4 using MPM on RHEL8
#!/bin/bash
yum repolist all;
yum-config-manager --enable codeready-builder-for-rhel-8-rhui-rpms;
yum update -y;
dd if=/dev/zero of=/swapfile bs=128M count=32;
chmod 600 /swapfile;
mkswap /swapfile;
swapon /swapfile;
@whittlem
whittlem / aws-ec2-rhel8-apache24
Created September 7, 2020 16:59
Amazon AWS EC2 RHEL8 provisioning script for Apache 2.4
#!/bin/bash
yum repolist all;
yum-config-manager --enable codeready-builder-for-rhel-8-rhui-rpms;
yum update -y;
dd if=/dev/zero of=/swapfile bs=128M count=32;
chmod 600 /swapfile;
mkswap /swapfile;
swapon /swapfile;
@whittlem
whittlem / cbpGetHistoricRates.py
Created November 17, 2020 12:42
Trading using Python - Coinbase Pro Historic Rates
import re
import requests
from datetime import datetime
def cbpGetHistoricRates(market='BTC-GBP', granularity=86400, iso8601start='', iso8601end=''):
if not isinstance(market, str):
raise Exception('Market string input expected')
if not isinstance(granularity, int):
@whittlem
whittlem / exponentialMovingAverage.py
Last active February 25, 2023 00:29
Trading using Python  - Exponential Moving Average (EMA)
# data: dictionary { 'dd/mm/yyy': price, 'dd/mm/yyyy': price, ... }
# num: range in the average calculation, normally 9 to 26
def exponentialMovingAverage(data, num):
if not isinstance(data, dict):
raise Exception('Dictionary input expected')
if not isinstance(num, int):
raise Exception('Integer input expected')
@whittlem
whittlem / movingAverageConvergenceDivergence.py
Last active November 17, 2020 13:21
Trading using Python - Moving Average Convergence Divergence (MACD)
# data: dictionary { 'dd/mm/yyy': price, 'dd/mm/yyyy': price, ... }
def movingAverageConvergenceDivergence(data):
if not isinstance(data, dict):
raise Exception('Dictionary input expected')
if (26 > len(data)):
raise Exception('Insufficient data for calculation')
@whittlem
whittlem / macd.py
Last active November 17, 2020 14:31
Trading using Python — Moving Average Convergence Divergence (MACD)
# https://whittle.medium.com/trading-using-python-moving-average-convergence-divergence-macd-4dbfee1c1a37
import re
import requests
from datetime import datetime
def cbpGetHistoricRates(market='BTC-GBP', granularity=86400, iso8601start='', iso8601end=''):
if not isinstance(market, str):
raise Exception('Market string input expected')
@whittlem
whittlem / relativeStrengthIndex.py
Last active May 2, 2024 21:49
Trading using Python — Relative Strength Index (RSI)
# data: dictionary { 'dd/mm/yyy': price, 'dd/mm/yyyy': price, ... }
def relativeStrengthIndex(data, num):
if not isinstance(data, dict):
raise Exception('Dictionary input expected')
if not isinstance(num, int):
raise Exception('Integer input expected')
# https://whittle.medium.com/trading-using-python-relative-strength-index-rsi-f0c63c1c0db
import re
import requests
from datetime import datetime
def cbpGetHistoricRates(market='BTC-GBP', granularity=86400, iso8601start='', iso8601end=''):
if not isinstance(market, str):
raise Exception('Market string input expected')
@whittlem
whittlem / ema.py
Last active November 17, 2020 16:54
Trading using Python — Exponential Moving Average (EMA)
# https://levelup.gitconnected.com/trading-using-python-exponential-moving-average-ema-f38ed3211a44?source=your_stories_page-------------------------------------
import re
import requests
from datetime import datetime
def cbpGetHistoricRates(market='BTC-GBP', granularity=86400, iso8601start='', iso8601end=''):
if not isinstance(market, str):
raise Exception('Market string input expected')