Skip to content

Instantly share code, notes, and snippets.

# Developed by Greg Miller, [email protected]
# Version 3.05
# Last Updated April 13, 2020
# Tweaks by Dre on 8/18/2020 to fix bad assumptions about file paths
# Purpose: To compile publicly-available CAISO system-wide electricity demand, supply, and emissions data into a csv file
# Currently configured to coninue downloading data until the most recent data has been downloaded.
# All directories and files will be created the first time you run the script
# Run in unbuffered mode to make sure time.sleep() works: $ python -u
@dreness
dreness / what_is_up_with_that.md
Last active July 24, 2020 09:11
Who resolves the resolver?

I remember this one time, I was messing with stuff and my DNS lookups stopped working. So I looked around...

effective DNS servers for en0

❯ scutil --dns | grep -B 1 en0        
  nameserver[0] : 2600:1700:43b0:d640::1
  if_index : 18 (en0)
--
  nameserver[0] : 2600:1700:43b0:d640::1
  if_index : 18 (en0)
@dreness
dreness / iShapeParser.py
Created July 22, 2020 20:29
Export Keynote shapes to SVG
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json # Native JSON Library
import argparse # Native Argument parser Library
# This is a slightly updated version of a script found on ye cyberwebs to
# add batch conversion support. Just don't specify an image ID to export the world.
# ==============================#
@dreness
dreness / notes.md
Created June 24, 2020 05:53
Low Latency HLS test: how low can you go?
@dreness
dreness / iftotal
Created May 25, 2020 21:50
Display only the "total" column of ifstat output
#!/bin/zsh
# ifstat can sum the bandwidth across specified interfaces, which it displays
# as an additional column of output. This script trims the output to contain
# only the Total column.
# For debugging, uncomment the following line
# set -x
# First execute ifstat once to find the number of interfaces we'll be watching.
@dreness
dreness / acorn-save-numbered-layers.scpt
Created April 23, 2020 22:06
Ask Acorn to save every layer of an image to a separate index-numbered file.
set skipLayers to {}
set the end of skipLayers to {outter:"Window Server", inner:"Desktop"}
set outString to "Skipping layers:" & "
"
repeat with i in skipLayers
set outString to outString & " " & outter of i & "-->" & inner of i & "
"
end repeat
log outString
@dreness
dreness / copyEvents.applescript
Created April 3, 2020 10:30
Create an anonymized copy of selected events from a primary calendar into a secondary calendar
set mySourceCal to "cloudcal"
set myTargetCal to "anothercal"
set windowEnd to (current date) + (4 * weeks)
set windowStart to (current date) - (1 * weeks)
tell application "Calendar"
repeat with sourceEvent in (events of calendar mySourceCal where (its start date ≥ windowStart) and (its start date ≤ windowEnd))
@dreness
dreness / throttle.ows
Created March 30, 2020 20:30
Trails / Throttle demo
rule("fast setup")
{
event
{
Ongoing - Global;
}
conditions
{
Or(Is In Setup, Is Assembling Heroes) == True;
@dreness
dreness / PKGBUILD
Created March 8, 2020 12:31
mingw-w64-mujs-git
_realname=mujs
pkgbase=mingw-w64-${_realname}-git
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}-git"
pkgrel=1
pkgver=1.0.6_18_g6f93cab
pkgdesc='MuJS (mingw-w64)'
url='https://mujs.com/'
arch=('any')
source=("${_realname}"::"git+https://git.ghostscript.com/mujs.git")
@dreness
dreness / similarity.py
Last active December 16, 2019 03:38
Given a set of images in the same format, compute a slideshow order that minimizes image differences between adjacent frames using a bottleneck TSP solver.
#!/usr/bin/env python
import turicreate as tc
import mlrose
import numpy as np
import os
import sys
import IPython
baseDir = "/Users/andre/work/turi/attempts/attempt1"