Skip to content

Instantly share code, notes, and snippets.

View whittlem's full-sized avatar

Michael Whittle whittlem

View GitHub Profile
@whittlem
whittlem / install-pycryptobot.sh
Created January 8, 2023 15:47
install-pycryptobot.sh
#!/bin/bash
DEBIAN_FRONTEND=noninteractive apt update -y
DEBIAN_FRONTEND=noninteractive apt install git python3 python3-pip unzip --assume-yes -y
DEBIAN_FRONTEND=noninteractive apt install apt-transport-https ca-certificates curl software-properties-common --assume-yes -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
DEBIAN_FRONTEND=noninteractive apt update --assume-yes -y
@whittlem
whittlem / aws-ec2-rhel8-apache24-bootstrap
Created June 11, 2022 08:19
aws-ec2-rhel8-apache24-bootstrap
#/usr/bin/bash
yum update -y
dd if=/dev/zero of=/swapfile bs=128M count=32
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
swapon -s
echo "/swapfile swap swap defaults 0 0" >> /etc/fstab
@whittlem
whittlem / rich-eodhistoricaldata-websocket
Created November 17, 2021 22:34
rich-eodhistoricaldata-websocket
def main() -> None:
"""Main"""
with Live(layout, screen=True, redirect_stderr=False) as live:
websocket = WebSocketClient(
# Demo API key for testing purposes
api_key="<removed>",
endpoint="crypto",
symbols=symbol_list,
)
import json, time
from threading import Thread
from websocket import create_connection, WebSocketConnectionClosedException
def main():
ws = None
thread = None
thread_running = False
thread_keepalive = None
import json, time
from threading import Thread
from websocket import create_connection, WebSocketConnectionClosedException
def main():
ws = None
thread = None
thread_running = False
thread_keepalive = None
import json, time
from threading import Thread
from websocket import create_connection, WebSocketConnectionClosedException
def main():
ws = None
thread = None
thread_running = False
thread_keepalive = None
@whittlem
whittlem / aws-ec2-redhat-apache-python-flask.py
Last active August 22, 2021 18:15
aws-ec2-redhat-apache-python-flask.py
#!/bin/bash
yum repolist all
yum-config-manager --enable codeready-builder-for-rhel-8-rhui-rpms
yum --disablerepo=\* remove subscription-manager -y
yum update -y
yum install vim git wget httpd python39 python3-pip python39-mod_wsgi python3-markupsafe -y
python3 -m pip install virtualenv
@whittlem
whittlem / python-flask-wsgi.py
Created August 19, 2021 22:50
python-flask-wsgi.py
import sys
import site
import logging
logging.basicConfig(stream=sys.stderr)
site.addsitedir('/var/www/html/lib/python3.6/site-packages')
site.addsitedir('/var/www/html/lib64/python3.6/site-packages')
sys.path.insert(0,"/var/www/html/")
@whittlem
whittlem / apache-wsgi-vhost.conf
Created August 19, 2021 22:39
apache-wsgi-vhost.conf
<VirtualHost *:80>
ServerName localhost
WSGIDaemonProcess html user=apache group=apache threads=2
WSGIScriptAlias / /var/www/html/wsgi.py
<Directory /var/www/html>
Require all granted
@whittlem
whittlem / python-flask-run.py
Created August 19, 2021 22:23
python-flask-run.py
import os
from app import app
if __name__ == "__main__":
port = int(os.environ.get("PORT", 5000))
app.run(host='0.0.0.0', port=port, debug=True)