Skip to content

Instantly share code, notes, and snippets.

View major's full-sized avatar
🤠
Yeehaw.

Major Hayden major

🤠
Yeehaw.
View GitHub Profile
@major
major / ca.py
Last active March 15, 2024 14:24
Making a certificate authority (CA) with python cryptography
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.x509.oid import NameOID
import datetime
import uuid
one_day = datetime.timedelta(1, 0, 0)
private_key = rsa.generate_private_key(
public_exponent=65537,
@major
major / test.html
Last active March 9, 2024 15:35
Testing TradingView Embeds
# TradingView embed testing
<!-- TradingView Widget BEGIN -->
<div class="tradingview-widget-container" style="height:100%;width:100%">
<div class="tradingview-widget-container__widget" style="height:calc(100% - 32px);width:100%"></div>
<div class="tradingview-widget-copyright"><a href="https://www.tradingview.com/" rel="noopener nofollow" target="_blank"><span class="blue-text">Track all markets on TradingView</span></a></div>
<script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-advanced-chart.js" async>
{
"autosize": true,
"symbol": "XLP/SPY",
@major
major / build.log
Created February 2, 2024 13:05
azure-cli 2.56.0 deps
Provides: azure-cli = 2.56.0-1.fc39 python3.12dist(azure-cli) = 2.56 python3dist(azure-cli) = 2.56
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PartialHardlinkSets) <= 4.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: ((python3.12dist(azure-cosmos) >= 3 with python3.12dist(azure-cosmos) < 4) with python3.12dist(azure-cosmos) >= 3.0.2) (python3.12dist(azure-appconfiguration) >= 1.1.1 with python3.12dist(azure-appconfiguration) < 1.2) (python3.12dist(azure-batch) >= 14 with python3.12dist(azure-batch) < 14.1) (python3.12dist(azure-datalake-store) >= 0.0.49 with python3.12dist(azure-datalake-store) < 0.1) (python3.12dist(azure-graphrbac) >= 0.60 with python3.12dist(azure-graphrbac) < 0.61) (python3.12dist(azure-loganalytics) >= 0.1 with python3.12dist(azure-loganalytics) < 0.2) (python3.12dist(azure-mgmt-applicationinsights) >= 1 with python3.12dist(azure-mgmt-applicationinsights) < 1.1) (python3.12dist(azure-mgmt-authorization) >= 4 with python3.12dist(a
@major
major / charts.md
Last active November 23, 2023 03:57
Major's interesting charts

SPX to VVIX correlation

When this closes over zero, watch out for a turnaround in the VIX. It isn't always immediate, but it often precedes a change down the line.

https://schrts.co/MTbuyXTK

Back month vol versus current

https://schrts.co/VsZbvNHQ

@major
major / gist:d4e9f447ab942edd7952
Created July 28, 2014 13:51
CentOS 7 / Fedora LiveOS issues when live disk fills
to cause the problem:
dd if=/dev/zero of=/testfile.bin bs=1M count=2048
system journal:
[ 2214.964214] device-mapper: snapshots: Invalidating snapshot: Unable to allocate exception.
[ 2214.971235] Buffer I/O error on device dm-0, logical block 1783562
[ 2214.971244] Buffer I/O error on device dm-0, logical block 1783095
[ 2214.971247] EXT4-fs warning (device dm-0): ext4_end_bio:287: I/O error writing to inode 16 (offset 198406144 size 4096 starting block 1783095)
@major
major / el9.txt
Created July 3, 2023 15:37
websockets missing modules
+ /usr/bin/python3 -s /usr/lib/rpm/redhat/import_all_modules.py -f /builddir/build/BUILD/python-websockets-11.0.3-2.el9.x86_64-pyproject-modules
Check import: websockets
Check import: websockets.speedups
@major
major / Caddyfile
Last active June 15, 2023 14:24
Caddy + Watchtower + Wordpress + MariaDB
example.com {
tls major@mhtx.net
root * /var/www/html
php_fastcgi wordpress:9000
encode gzip
file_server
@disallowed {
path *.sql
path /wp-content/uploads/*.php
@major
major / aws_ec2_pricing_pandas.py
Created May 25, 2023 19:24
EC2 Linux pricing into CSV
#!/usr/bin/env python
import json
import pandas as pd
df = pd.read_csv(
"us-east-1.csv",
header=5,
usecols=[
"Instance Type",
"vCPU",
@major
major / playlist.csv
Created April 27, 2023 13:39
Spotify - Heavy Queens playlist
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 3.
"Track URI","Track Name","Artist URI(s)","Artist Name(s)","Album URI","Album Name","Album Artist URI(s)","Album Artist Name(s)","Album Release Date","Album Image URL","Disc Number","Track Number","Track Duration (ms)","Track Preview URL","Explicit","Popularity","ISRC","Added By","Added At"
"spotify:track:2Rw6wkd0q3LXx5xsdjLs1P","Monochrome","spotify:artist:630wzNP2OL7fl4Xl0GnMWq","BABYMETAL","spotify:album:6IoOqdEHdwLgfUONXeYvoI","Monochrome","spotify:artist:630wzNP2OL7fl4Xl0GnMWq","BABYMETAL","2022-11-17","https://i.scdn.co/image/ab67616d0000b2738e02c7c47138ffbcbb4183fa","1","1","237354","https://p.scdn.co/mp3-preview/ab2c2b09f9fa3c49b8fdb8ef384829f380571e36?cid=9950ac751e34487dbbe027c4fd7f8e99","false","60","JPTF02224108","spotify:user:","2022-11-18T01:31:53Z"
"spotify:track:2Ez8SNfzrw2bwkrZTx5B5j","Paralyzed","spotify:artist:4ZznAOb4aE3va5Jz1iDpjc","Conquer Divide","spotify:album:0DiNp9OwAkJTfYOICCyHcZ","Paralyzed","spotify:artist:4ZznAOb4aE3va5Jz1iDpjc","Conquer Divide","2022-10-26","https://i.scdn.co/ima
@major
major / metar_weather.py
Created April 24, 2020 20:03
METAR Weather
#!/usr/bin/env python
import json
from metar import Metar
import metpy.calc as mpcalc
from metpy.units import units
import requests
observation_station = "KRND"
alerts_zone = "TXZ207"