Skip to content

Instantly share code, notes, and snippets.

View alex-phillips's full-sized avatar

Alex Phillips alex-phillips

View GitHub Profile
import {
LitElement,
html,
css,
} from "https://unpkg.com/[email protected]/lit-element.js?module";
class MusicGroupCard extends LitElement {
static get properties() {
return {
hass: {},
#!/bin/bash
# Dynamic DNS for CF!
# Perfect for updating a single sub domain
# Get a record name from the command line e.g: Update.sh taco ; This will update taco.domain.com
name=$1
if [ -z "$name" ]
then
echo "[$(date)] - Record Name Missing, e.g: Update.sh taco ; This will update taco.domain.com"
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<atom:link href="https://static.w00t.cloud/chdfeed.xml" rel="self" type="application/rss+xml"/>
<title>Call Her Daddy (archive)</title>
<language>en-us</language>
<copyright/>
<description>
<![CDATA[
Call Her Daddy started as a podcast and evolved into a global movement. Alex Cooper bulldozed a
import os, argparse, spotipy, json
from spotipy.oauth2 import SpotifyClientCredentials, SpotifyOAuth
for env_var in [
"SPOTIPY_CLIENT_ID",
"SPOTIPY_CLIENT_SECRET",
"SPOTIPY_REDIRECT_URI",
]:
if os.getenv(env_var, default=None) == None:
print(f"Environment variable {env_var} is not set")
wget -O speedtest.tgz https://install.speedtest.net/app/cli/ookla-speedtest-1.2.0-linux-x86_64.tgz
tar xzf speedtest.tgz
mv speedtest /usr/local/bin/speedtest
chmod +x /usr/local/bin/speedtest
import boto3
import time
def create_new_session():
# Update these with your own values
role_arn = 'arn:aws:iam::YOUR_ACCOUNT_ID:role/YOUR_ROLE_NAME'
session_name = 'long-running-session'
sts_client = boto3.client('sts')
response = sts_client.assume_role(
/* I can be compiled with the command "gcc -o dentls dentls.c" */
#define _GNU_SOURCE
#include <search.h> /* Defines tree functions */
#include <dirent.h> /* Defines DT_* constants */
#include <fcntl.h>
#include <stdio.h>
#include <stdint.h>
#include <unistd.h>
#include <stdlib.h>
@alex-phillips
alex-phillips / hungarian.py
Created August 9, 2022 17:19
on-call generator
import json
from scipy.optimize import linear_sum_assignment
import numpy as np
maximize = False # set to true if you want to maximize cost vs minimize (reverse order of preferences)
holidays = [
'Memorial',
'Independence Day',
'Labor',
#!/usr/bin/env python3
import os, yaml, re, argparse, logging, json, subprocess
from pathlib import Path
def build_docker_compose(args):
def append_label(labels, label, value):
if label not in labels:
labels[label] = value
@alex-phillips
alex-phillips / case-insensitive-rcopy.php
Created January 25, 2020 15:11
recursively copy files form one dir to another - case insensitive
<?php
$src = $argv[1];
$dest = $argv[2];
if (!$src || !$dest) {
die("Need a source and destination");
}
$src = rtrim($src, '/') . "/";