Skip to content

Instantly share code, notes, and snippets.

View quinncomendant's full-sized avatar

Quinn Comendant quinncomendant

View GitHub Profile
@quinncomendant
quinncomendant / dscovr-epic-desktop
Last active September 13, 2018 22:14
This is an OS X command-line script that downloads the latest DSCOVR:EPIC <http://epic.gsfc.nasa.gov/> image and sets it as your desktop picture. Prerequisites: requires installing Homebrew <http://brew.sh/> and then the jshon tool (`brew install jshon`). Then you can run the command manually, or add it to your crontab.
#!/usr/bin/env bash
download_directory="$HOME/Desktop/_dl/epic-earth";
apiurl="http://epic.gsfc.nasa.gov/api/images.php";
curl -s "$apiurl" | jshon -a -e image -u | while read image; do
destfile="$download_directory/$image.jpg";
mkdir -p "$download_directory";
if [[ -n "$image" && ! -f "$destfile" ]]; then
echo "New 🌍 ! $image.jpg";
curl -so "$destfile" "http://epic.gsfc.nasa.gov/epic-archive/jpg/$image.jpg";
ln -sf "$destfile" "$download_directory/latest.jpg";
@quinncomendant
quinncomendant / qmail-queue-wrapper.pl
Created May 24, 2018 09:58
This is Peter Samuel’s script, adapted to prepend a X-AuthUser header for mail sent via mailchannels.com
#!/usr/bin/perl -w
#
# $Id: qmail-queue-wrapper.pl,v 1.3 2007/03/06 14:55:09 psamuel Exp $
#
# qmail-queue wrapper program.
#
# This program should be used when you wish to manipulate a mail
# message BEFORE it is placed in the queue. Possible uses include:
#
# - header rewriting

A list of contractions from divinewrite and a regex to find and eradicate the more unseemly from your documents (remember to use a case-insensitive search).

Regex to catch both the “least formal” and “less formal” contractions:

\b((could|how|might|must|should|that|what|when|where|why|would|it)n?['‘’](d|ll|re|ve)|why['‘’]s|we['‘’](d|re|ve|ll)|s?he['‘’](s|d|ll)|(where|how|when|who)['‘’](s)|(who|you|it)['‘’](d)|(they|who)['‘’](ll|ve)|(might|must)n['‘’]t|i'd)\b

Least formal

Regex to catch these:

@quinncomendant
quinncomendant / Analytics.inc.php
Last active September 7, 2017 07:28
Class for server-side submission of data to Google Analytics
<?php
/*
* Analytics.inc.php
*
* Class for server-side submission of data to Google Analytics.
* TODO: Would be better to save the request to a queue to process submissions in the background. Currently, requests are blocked until the POST to GA completes or timeout is reached.
*
* @author Quinn Comendant <quinn@strangecode.com>
* @version 1.0
* @since 24 Aug 2014 15:35:43
@quinncomendant
quinncomendant / spamdyke-sender-conf
Created May 6, 2017 07:37
Create a custom sender config file for spamdyke using a template
#!/usr/bin/env bash
#
# Quinn Comendant <quinn@strangecode.com>
# 06 May 2017 14:45:53
#
# Functions
#
version: '2'
volumes:
dbdata:
driver: local
services:
db:
image: mysql/mysql-server:5.7
ports:
- "3306:3306"
volumes:
@quinncomendant
quinncomendant / podcasts.md
Last active October 21, 2016 16:25
Podcast subscriptions as of July 2016. Computer-readable OPML version at bottom can be imported into a podcatcher like iTunes.
@quinncomendant
quinncomendant / denominator-zone-list.sh
Last active September 27, 2016 03:36
Wrapper script for denominator to prevent overrunning API limits. It works by watching the output file, and every 3 zones that are saved, it will pause for 4 seconds (so at most 45 zones/minute are retrieved).
#!/usr/bin/env bash
#
# Quinn Comendant <quinn@strangecode.com>
# 23 Sep 2016 19:31:05
#
# Functions
#

Design principles of computer systems

Design principles applicable to many areas of computer systems

  • Adopt sweeping simplifications
    So you can see what you are doing.
  • Avoid excessive generality
    If it is good for everything, it is good for nothing.
  • Avoid rarely used components
    Deterioration and corruption accumulate unnoticed—until the next use.
@quinncomendant
quinncomendant / Factuality service.md
Last active May 26, 2016 19:38
A service that crowdsources fact checking of web pages. This text is embryonic (text copied from an email to a friend), but it's a powerful idea and needs to start somewhere. I would appreciate comments: help identify problems, offer suggestions towards its design, and how to solve adoption. Email me at quinn@strangecode.com

The idea is to create a means for web users to rate the factuality of content on a web page. A browser extension, which allows individual phrases of text to be selected, then rated for accuracy and commented upon. The browser extension then displays a score of the page’s factuality, based on the crowdsourced ratings. Clicking the extension reveals more detail, including comments from fact-checkers and selected passages from the text with notes and external references. With the plugin running, it could then automatically add a light green or red underline to text on the page which has been rated, indicating exactly which phrases have been reviewed. Hovering the cursor over these phrases brings up a popup of notes for that statement.

But here's the exciting part: each phrase of text that is selected, rated, and commented upon (hopefully with cited references to why the phrases are factual or bullshit) will be sent to a central server with the rating metadata. With a lot of usage, a huge corpus of text phrases