Skip to content

Instantly share code, notes, and snippets.

View edavis's full-sized avatar
💭
I may be slow to respond.

Eric Davis edavis

💭
I may be slow to respond.
View GitHub Profile
@edavis
edavis / gist:0daf6c11c196c9b5cf8fdc1afcd87312
Created September 4, 2024 17:40
"View in Astrolabe" bookmarklet
javascript:(function(){
var currentUrl = window.location.href;
var newUrl = currentUrl
.replace('https://bsky.app/profile/', 'https://astrolabe.edavis.dev/at/')
.replace('/post/', '/app.bsky.feed.post/');
window.open(newUrl, '_blank');
})();
@edavis
edavis / gist:a168dced532d1f5ef4ca314cab605379
Created August 20, 2024 16:26
The last instant of every TID by unique two-letter start
22zzzzzzzzz22 1971-02-12T05:26:12.088Z
23zzzzzzzzz22 1972-03-25T10:52:24.177Z
24zzzzzzzzz22 1973-05-06T16:18:36.266Z
25zzzzzzzzz22 1974-06-17T21:44:48.355Z
26zzzzzzzzz22 1975-07-30T03:11:00.444Z
27zzzzzzzzz22 1976-09-09T08:37:12.532Z
2azzzzzzzzz22 1977-10-21T14:03:24.621Z
2bzzzzzzzzz22 1978-12-02T19:29:36.710Z
2czzzzzzzzz22 1980-01-14T00:55:48.799Z
2dzzzzzzzzz22 1981-02-24T06:22:00.888Z
@edavis
edavis / gist:35a65aa76cf58ce45f8d012e59373f2e
Last active August 20, 2024 19:52
Timestamp of when every "3*" TID begins
3222222222222 2005-09-05T05:58:26.842Z
3322222222222 2006-10-17T11:24:38.931Z
3422222222222 2007-11-28T16:50:51.020Z
3522222222222 2009-01-08T22:17:03.109Z
3622222222222 2010-02-20T03:43:15.197Z
3722222222222 2011-04-03T09:09:27.286Z
3a22222222222 2012-05-14T14:35:39.375Z
3b22222222222 2013-06-25T20:01:51.464Z
3c22222222222 2014-08-07T01:28:03.553Z
3d22222222222 2015-09-18T06:54:15.642Z
sudo port install rbenv ruby-build
rbenv install 2.7.6
rbenv global 2.7.6
eval "$(rbenv init - bash)"
cd social-web
bundler install
nvm use # v18
corepack enable # this makes yarn available
yarn exec env # smoketest for yarn
@edavis
edavis / if_rx_eth0.sh
Created January 21, 2024 04:40
Graph rx and tx separately in munin. Taken from the core if_ plugin but simplified down.
#!/bin/bash
INTERFACE="eth0"
case $1 in
config)
echo "graph_title $INTERFACE rx traffic"
echo 'graph_args --base 1000'
echo 'graph_category network'
echo 'traffic.label rx'
@edavis
edavis / torrent-sum.py
Created November 23, 2023 06:48
Parse a directory of torrent files and return the total size of all files within
#!/usr/bin/env python
import os, glob
from io import BytesIO
class End(Exception): pass
def decode(stream):
delim = stream.read(1)
@edavis
edavis / bsky_firehose_standalone.py
Created September 23, 2023 04:58 — forked from DavidBuchanan314/bsky_firehose_standalone.py
This is not production quality code, several corners have been cut, etc. etc.
import io
import base64
import struct
import hashlib
import asyncio
import websockets
from enum import Enum
# ground control to major type
@edavis
edavis / dbhist.sh
Last active September 1, 2023 21:03 — forked from outcoldman/dbhist.sh
DBHist: bash history in sqlite
# The MIT License
# SPDX short identifier: MIT
# Further resources on the MIT License
# Copyright 2017 Denis Gladkikh (https://www.outcoldman.com/en/archive/2017/07/19/dbhist/)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@edavis
edavis / counter.py
Created January 3, 2020 17:36
Determining when baseball games become unique
#!/usr/bin/env python
import csv
from itertools import groupby
from collections import Counter
reader = csv.DictReader(open('MLB.CWEVENTS'))
writer = csv.writer(open('sequences.csv', 'wb'))
it = groupby(reader, key=lambda row: row['GAME_ID'])
@edavis
edavis / bet-odds-formats.org
Created May 14, 2018 01:52
Betting odds cheatsheet

Cheatsheet for converting between different betting odds and calculating implied probability.

American to Decimal

Fav
-110 = 100 / 110 + 1 = 1.909
Dog
+150 = 150 / 100 + 1 = 2.5

American to Fractional

Fav
-110 = 100 / 110 = 10 / 11
Dog
+150 = 150 / 100 = 3 / 2