This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
networksetup -setairportpower en0 off | |
sleep 1 | |
networksetup -setairportpower en0 on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
document.body.style.width = '100vw'; | |
document.documentElement.style.width = '100vw'; | |
document.body.style.height = '100vh'; | |
document.documentElement.style.height = '100vh'; | |
document.body.style.overflow = 'scroll'; | |
document.documentElement.style.overflow = 'scroll'; | |
window.addEventListener("deviceorientation", event => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.from(document.querySelectorAll('.fsl.fwb.fcb > a')).map(link => link.text).sort().join('\n'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function linkReport(selector) { | |
'use strict'; | |
const fetchOptions = { | |
method: 'HEAD' | |
}; | |
window.brokenLinks = []; | |
document | |
.querySelectorAll(selector) | |
.forEach(link => { | |
fetch(link.href) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const request = require('superagent'); | |
const username = 'liddiard'; // change username as needed | |
request | |
.get(`https://api.github.com/users/${username}/repos`) | |
.query({page: 1}) // increment this page number as needed | |
.then(res => | |
fs.appendFile('repos.txt', res.body.map(repo => | |
[repo.name, repo.html_url, repo.description].join('\n')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.setInterval(() => document.querySelector('input[value="Move to Cart"]').click(), 250); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data | |
.filter(x => (new Date(x.dt_iso)).getMonth() > 5 && (new Date(x.dt_iso)).getMonth() < 8) | |
.reduce((acc, x) => { | |
const h = (new Date(x.dt_iso)).getHours(); | |
return acc.hasOwnProperty(h) ? | |
Object.assign({}, acc, { [h]: acc[h] + x.clouds.all }) : | |
Object.assign({}, acc, { [h]: x.clouds.all }) | |
}, {}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ballots in the form: | |
* { userID: [ firstChoice, secondChoice, ... ], | |
* userID: [ ... ], | |
* ... } | |
*/ | |
const instantRunoff = ballots => { | |
// initialize an map from choices to number of votes | |
const votes = {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- requires airports, runways, and airport_frequencies tables to be present with the correct data types | |
-- example output row: | |
-- ident name ATIS CTAF TWR GND elevation_ft runways | |
-- KHWD Hayward Executive Airport 126.7 120.2 118.9 121.4 52 10L-28R 3107'x75', 10R-28L 5694'x150' | |
SELECT | |
ident, | |
name, | |
-- "pivot" frequency data from rows to columns | |
MAX(CASE WHEN airport_frequencies.type = 'ATIS' THEN airport_frequencies.frequency_mhz END) ATIS, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> <!-- necessary to define language here to get English hyphenation --> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<style> | |
:root { | |
--article-padding: 1.5em; | |
} | |
html { |