Skip to content

Instantly share code, notes, and snippets.

View thejevans's full-sized avatar

John Evans thejevans

View GitHub Profile
# ------------------------------------------------------------------------------
# import packages
# ------------------------------------------------------------------------------
import pathlib
import polars as pl
from pypika import Query, Tables
import pyodbc
@thejevans
thejevans / euler213v1.py
Last active January 29, 2024 05:54
euler213
import numpy as np
# build transition matrix
transition_matrix = np.zeros((900,900))
# corner cases
corner_transition_idx = [(0, 1), (0, 30), (29, 28), (29, 59), (870, 871), (870, 840), (899, 898), (899, 869)]
# edge cases
top_idx = [(x, x+30) for x in range(1, 29)] + [(x, x-1) for x in range(1, 29)] + [(x, x+1) for x in range(1, 29)]
left_idx = [(x, x+30) for x in range(30, 870, 30)] + [(x, x-30) for x in range(30, 870, 30)] + [(x, x+1) for x in range(30, 870, 30)]
@thejevans
thejevans / snarks_anagram.ipynb
Last active January 10, 2023 02:24
generate all anagrams to make names given a last name
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thejevans
thejevans / framework_powerled_color.sh
Created October 5, 2022 05:23
script to change the framework laptop power led color based on battery/charging status. I use it as a cron job
#!/bin/bash
# takes desired critical percentage as first argument and
# charged percentage as second, both with default values.
# example usages:
#
# framework_powerled_color.sh
# framework_powerled_color.sh 10
# framework_powerled_color.sh 10 98
#
@thejevans
thejevans / dag_watch.sh
Created September 22, 2022 17:27
Simple script to monitor multiple dags
#!/bin/bash
# best used with watch
# example:
# watch -n 30 "./dag_watch.sh dag1.dag dag2.dag dag3.dag"
TOWATCH=("$@")
for DAG in "${TOWATCH[@]}"; do
echo "${DAG}:"
DAGOUT="${DAG}.dagman.out"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Want bikes off the sidewalk? Build bike lanes.

While UMD policy states that bikes and scooters should be ridden on the road and off of sidewalks[^1], university infrastructure does nothing to incentivize their policy. So when scooterists or cyclists find the university roads unsafe or inconvenient, they take to the sidewalks. Without separate infrastructure, individuals will continue to violate university policy.

We are at a turning point where UMD policy can no longer ignore the deficiencies in transportation infrastructure. The Metro Purple Line construction through campus is a great opportunity for improved infrastructure. More people are cycling since the start of the pandemic[^9]. Fuel prices are high enough that people might also consider cycling as opposed to driving[^10].

A few years ago, while commuting to campus by bicycle, a car abruptly turned in front of me resulting in a collision that not only destroyed my bicycle, but left me with injuries that took months to heal. After a few more close

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import ast
import json
import os
import sys
import time
import pandas as pd
import py_nextbus
def parse_and_list(pairs: list) -> dict: