Skip to content

Instantly share code, notes, and snippets.

View alairock's full-sized avatar

Skyler Lewis alairock

View GitHub Profile
@alairock
alairock / lastfm.py
Created November 26, 2024 23:03
LastFM Fun
import os
import aiohttp
import asyncio
import json
import argparse
from pathlib import Path
import hashlib
import time
# Configuration
@alairock
alairock / .env
Created November 22, 2024 18:30
Manage your LastFM data!
LASTFM_API_KEY=XXXXXXXXXXXXX
LASTFM_API_SECRET=XXXXXXXXXXXXX
LASTFM_SESSION_KEY=XXXXXXXXXXXXX
LASTFM_USERNAME=USERNAME
@alairock
alairock / pgpass.ts
Created July 8, 2024 20:03
PGPass file reader, typed for TS, Node, JS
import * as path from "path"
import fs from "fs/promises"
import { getLogger } from "../logging"
/**
* The default port number for PostgreSQL database connections.
*/
const defaultPort = 5432
@alairock
alairock / SHNight.go
Created February 6, 2024 05:22
Secret Hitler Night Phase Code
package sh
import (
"errors"
"math/rand"
)
type Game struct{}
type GameState struct {
@alairock
alairock / work-time.py
Created October 26, 2023 23:06
Calculation of clocking in, minute-by-minute, vs rounding.
import random
import numpy as np
import matplotlib.pyplot as plt
# Initialize variables for multiple tests
num_tests = 10000
differences = []
# Loop for each test
for test in range(num_tests):
@alairock
alairock / serial.rs
Created August 23, 2020 00:54
Serial Reader in Rust with cli for selecting open ports
// [dependencies]
// serialport = "3.3.0"
// dialoguer = "0.6.2"
use serialport::{available_ports, SerialPortType};
use crate::serial;
use dialoguer::theme::ColorfulTheme;
use dialoguer::Select;
use std::io;
@alairock
alairock / ProMicroDebouncePulseAndClock.ino
Created July 17, 2020 19:49
This is the code for a single button, debounced, pulse/variable-clock combo.
int RXLED = 17;
int TXLED = 30;
// constants won't change. They're used here to set pin numbers:
const int buttonPin = 16; // the number of the pushbutton pin
const int ledPin = 10; // the number of the LED pin
// Variables will change:
int ledState = HIGH; // the current state of the output pin
int buttonState; // the current reading from the input pin
SMALL = 1
MED = 2
LARGE = 3
s = list(range(1, 31))
m = list(range(31, 61))
l = list(range(61, 91))
print(s)
print(m)
from bs4 import BeautifulSoup
import requests
url = "https://www.azjobconnection.gov/ada/r/search/jobs?utf8=%E2%9C%93&per_page=50&keywords=Python&refiners=%7B%7D&is_subsequent_search=false&status=Active"
r = requests.get(url)
soup = BeautifulSoup(r.content, features="html.parser")
jobs_to_look_at = []
@alairock
alairock / database.py
Created November 27, 2019 23:57
Example database file
import asyncpg
import asyncio
DATABASE_POOL = None
async def get_connection_pool():
if DATABASE_POOL is None:
await asyncio.sleep(1)
return await get_connection_pool()