Skip to content

Instantly share code, notes, and snippets.

View elithrar's full-sized avatar
🌐
Helping make the internet better.

Matt Silverlock elithrar

🌐
Helping make the internet better.
View GitHub Profile
https://docs.google.com/presentation/d/1GXCaoat2CEcPu9lJ9eJDjzVW_Vuqr-Yq7kJolfOpBG0/edit?usp=sharing
@elithrar
elithrar / get-local-api.js
Last active July 16, 2023 14:44
A Scriptable powered iOS 14 widget (https://docs.scriptable.app/) using JavaScriptCore to get the current AQI from a PurpleNow sensor: https://fire.airnow.gov/
const API_URL = "https://www.purpleair.com/json?show=";
// Params: lat, lng, zoom
const MAP_URL = "https://fire.airnow.gov/"
// const CACHE_FILE = "aqi_data.json"
// Find a nearby PurpleAir sensor ID via https://fire.airnow.gov/
// Click a sensor near your location: the ID is the trailing integers
// https://www.purpleair.com/json has all sensors by location & ID.
let SENSOR_ID = args.widgetParameter || "19066"
const HEADER_COLOR = "#222222"
@elithrar
elithrar / config.yml.tmpl
Last active June 29, 2019 17:34
Generate a @circleci Config for Go for the @gorilla Toolkit - https://github.com/gorilla
version: 2.0
jobs:
# Base test configuration for Go library tests Each distinct version should
# inherit this base, and override (at least) the container image used.
"test": &test
docker:
- image: circleci/golang:latest
working_directory: /go/src/github.com/gorilla/mux
steps: &steps
@elithrar
elithrar / .travis.yml
Last active September 13, 2020 21:29
CircleCI vs. TravisCI for gorilla/mux - comparing maintainability, verbosity, DRY, etc. Ref: https://twitter.com/elithrar/status/1140342082768261120 & https://blog.questionable.services/article/building-go-projects-on-circle-ci/
language: go
matrix:
include:
- go: 1.7.x
- go: 1.8.x
- go: 1.9.x
- go: 1.10.x
- go: 1.11.x
@elithrar
elithrar / query.sql
Last active May 30, 2022 23:56
Using BigQuery to find public GitHub READMEs (readme%) with "blazing" in the contents: via https://twitter.com/peterbourgon/status/1039902928151052288
SELECT
repo_name,
path
FROM (
SELECT
id,
repo_name,
path
FROM
`bigquery-public-data.github_repos.files`
@elithrar
elithrar / logger.go
Created July 12, 2016 05:52
An example of turning https://github.com/go-kit/kit/tree/master/log into usable HTTP middleware for Go.
package handler
import (
"bufio"
"io"
"net"
"net/http"
"time"
"github.com/go-kit/kit/log"
@elithrar
elithrar / balance.weakauras
Created July 5, 2016 03:02
Balance Druid WeakAuras - Legion (Beta). Screenshot: http://d.pr/i/nqIl
dGe4HaqiQuj1IOsL6ssrQrPQQQtPIknlQujClIuTlHQ4xQOIHrLCmIYYKGNrLY0uv5AejBtO03iQACQOCoQuX7OsLO5jfj19KsyFsj1bjQSqI4HePmrPKCrPO2OqXiLIeNuOQwPuIMPuLUPue7Kk(PkYqLQyPQQYtvMQixvfv9vPijNLkvsMRqvAVWFvHblv1Hf1ILkESqMmv1LjTzj6ZuLrlv60iTAvvvEnvQA2s62Q0UP43uA4QYYr8Ccth11fSDPuFxkmEHkNxvz9QQk7xcnKHewgjWycm5JhxXtNaT6lf2fZhZhjmHwl7XsnmMKtP0PM0BZXKWiQh1AsFpfZJydpmt4MiuppLiGJmmQpMKCnBI0I9Bfjq9XQ2SpsyCUQggjSBOYuKadgZNwwsJcv(djSBOYuKadgJyRksy3qLPibgm2R9JZv1WiHDdvMIeyWyL5iMAniHDdvMIeyWyKCKIe2nuzksGbdgtJ7Ln(Qp6aglcj4idjmMq98ucsye9I5ct80An((yYI9Nu)KcZ2WCYu)GemrOtKnyyiblkiy79Ol1xXy6v9XccvA2GHHemt(QcKGJmSzRzsX(nFF2gk5QggmwKny4tpLKzlbR1TaZKVk2S1mPy)MVpBdLCvdJfe6HjFvibli0dXtR147djyr2GHXKHr07PNsYSLG1Amt(Qh2NsYSLG1IwGfe6F6fsaJvAnmMCsIbRRs96YW5NlSQn7JegNRQHrc7gQmfjWGXepncjmb14vv4idmwunleiHjOgVQI1Q)oF8Bfymsosrc7gQmfjWGX8PLL0OqL)qc7gQmfjWGXi2QIe2nuzksGbJfe6runleqcwzoIPwdsy3qLPibgmwqOhINgbjybHEezVDYmKG9A)4Cvnmsy3qLPibgmySsRHh9FkCKDggr9Owt67Py0iRbJAO8rK9(QkR(Wrgg1hB2AMuSFZ3NTHsUQHXAq95UW5NlSSHEZm1AqctWzcJeg)9uShrfkJ9iQqzmrL6RDSmBVGXUzQbjm(7PypIku
@elithrar
elithrar / archive_cloudapp.rb
Last active July 4, 2016 19:14
archive_cloudapp.rb - leverages https://github.com/aaronrussell/cloudapp_api to archive your CloudApp uploads to the current directory. Intentionally simple.
# vim: ts=2 et sw=2 sts=2
# #!/usr/bin/ruby
# (c) 2016, Matt Silverlock. BSD 3-Clause licensed.
# Downloads all items in your CloudApp account to the current directory.
require "cloudapp_api"
require "optparse"
require "json"
require "open-uri"
require "shellwords"
@elithrar
elithrar / config
Created March 28, 2016 20:47
.git/config - Pull PRs into local branches (via @alaska)
Locate the section for your github remote in the `.git/config` file. It looks like this:
```
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com:joyent/node.git
```
Now add the line `fetch = +refs/pull/*/head:refs/remotes/origin/pr/*` to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
@elithrar
elithrar / history.js
Last active January 10, 2016 14:03
smartScroll for Ember.js - reset the scroll position on forward transitions you haven't previously visited - via @rwjblue on embercommunity.slack.com
// app/locations/history.js
export default Ember.HistoryLocation.extend({
pushState() {
this._super(...arguments);
window.scrollTo(0, 0);
}
});
```​