Skip to content

Instantly share code, notes, and snippets.

View alex-phillips's full-sized avatar

Alex Phillips alex-phillips

View GitHub Profile
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, '/') . "/";
@alex-phillips
alex-phillips / us_state_capitals.json
Last active September 1, 2019 16:53
US State Capitals JSON file
{
"AL": {
"name": "Alabama",
"capital": "Montgomery",
"lat": "32.361538",
"long": "-86.279118"
},
"AK": {
"name": "Alaska",
"capital": "Juneau",
<template>
<f7-page name="about">
<nav-bar page-title="About" :root-view="rootView"></nav-bar>
<f7-block-title>About My App</f7-block-title>
<f7-block strong>
<p>Fugiat perspiciatis excepturi, soluta quod non ullam deleniti. Nobis sint nemo consequuntur, fugiat. Eius perferendis animi autem incidunt vel quod tenetur nostrum, voluptate omnis quasi quidem illum consequuntur, a, quisquam.</p>
<p>Laudantium neque magnam vitae nemo quam commodi, in cum dolore obcaecati laborum, excepturi harum, optio qui, consequuntur? Obcaecati dolor sequi nesciunt culpa quia perspiciatis, reiciendis ex debitis, ut tenetur alias.</p>
</f7-block>
<f7-block>
<?php
$converter = new img2ansi();
$converter->run();
class img2ansi
{
private $_image;
private $_colors_array = array(
"black" => array(0, 0, 0),
version: '2'
services:
grafana:
container_name: grafana
image: grafana/grafana
volumes:
- ${DOCKER_HOME}/grafana/data:/var/lib/grafana
- ${DOCKER_HOME}/grafana/config:/etc/grafana
influxdb: