Skip to content

Instantly share code, notes, and snippets.

Tom McKenzie grrowl

Block or report user

Report or block grrowl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@grrowl
grrowl / portforward.sh
Created Oct 22, 2019 — forked from kura/portforward.sh
Updated version of - https://gist.github.com/kura/5065819 + https://gist.github.com/codeinthehole/5064150 Forwards a list of known ports from localhost to a host
View portforward.sh
#!/bin/bash
if [[ $# -lt 2 ]]
then
echo "Usage: port-forward HOST REMOTE_PORT [LOCAL_PORT]";
else
HOST=$1
REMOTE_PORT=$2
LOCAL_PORT=${3:-${REMOTE_PORT}}
@grrowl
grrowl / ac-wattage.1m.sh
Created Jan 11, 2019
Show AC wattage and battery drain (for bitbar)
View ac-wattage.1m.sh
#!/bin/bash
# <bitbar.title>ac-wattage</bitbar.title>
# <bitbar.version>1.0</bitbar.version>
# <bitbar.author>Tom McKenzie</bitbar.author>
# <bitbar.author.github>grrowl</bitbar.author.github>
# <bitbar.desc>Shows the currently AC Charger wattage, if any.</bitbar.desc>
# Get SPPowerDataType
powerdata=$(system_profiler SPPowerDataType)
connected=$(echo "$powerdata" | grep 'Connected:' | awk 'END{print $2}')
View collect-windows.applescript
tell application "Finder"
-- get desktop dimensions (dw = desktop width; dh = desktop height)
set db to bounds of window of desktop
set {dw, dh} to {item 3 of db, item 4 of db}
end tell
tell application "System Events"
repeat with proc in application processes
tell proc
repeat with win in windows
@grrowl
grrowl / apache-plex-reverse-proxy.vhost
Created Jan 8, 2018 — forked from hazcod/apache-plex-reverse-proxy.vhost
Apache2 reverse proxy vhost configuration for Plex. Rerquires modules ssl, proxy, wstunnel
View apache-plex-reverse-proxy.vhost
ServerSignature Off
ServerTokens Prod
<VirtualHost *:80>
ServerName plex.website.com
# This VirtualHost redirects everything to HTTPS on port 443.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>
View scuttlebutt-compact.md
  • when should this compacter run?
    • every n actions added (compactEvery)
    • when history is at n length (highWaterMark, compactAtLength)
  • can the function signal when it should?
    • run the compacter every time
    • needs a private state (below) or
    • getCompacter({ n, highwater }) => compactingDispatcher()

we can compactingReducer, basically searches the last 50 actions for "stop" or

@grrowl
grrowl / README.md
Last active Nov 20, 2016 — forked from christophermanning/README.md
Voronoi Diagram with Force Directed Nodes and Delaunay Links
View README.md

Created by Christopher Manning

Summary

Nodes are linked to nodes in neighboring cells. The cell's color is a function of its area.

The white lines are the Delaunay triangulation and the purple cells are the Voronoi diagram.

Controls

@grrowl
grrowl / Signature.js
Created Nov 19, 2016
React component to provide ed25519 key generation, signing and verification
View Signature.js
import React, { Component, PropTypes } from 'react'
import elliptic, { eddsa as EdDSA } from 'elliptic'
function toHex(arr) {
return elliptic.utils.toHex(arr).toUpperCase()
}
function fromHex(hex) {
return elliptic.utils.toArray(hex, 'hex')
@grrowl
grrowl / code-review.sh
Created Jun 2, 2016
code-review.sh <branch to review> [<base branch>]
View code-review.sh
#!/bin/bash
DEFAULT_BASE="develop"
if [ -z "$*" ]; then echo "Usage: code-review.sh [review branch] [case compare branch]"; exit 0; fi
REVIEW_BRANCH=$1
BASE_BRANCH=${2-$DEFAULT_BASE}
echo "Checking out $REVIEW_BRANCH"
@grrowl
grrowl / githubDelayedMerge.user.js
Created May 10, 2016
GitHub: click anywhere on the "merge message" (with disabled button) and it'll wait until the button enables and click it for you.
View githubDelayedMerge.user.js
(function () {
function handleLoaded() {
var butan = document.querySelector('.merge-message .btn[disabled]')
var checkTimer;
if (butan) {
butan.parentElement.addEventListener('click', function handleClick(event) {
if (checkTimer) {
@grrowl
grrowl / Twitter.gs
Created Apr 27, 2016
Google Docs script to automate Twitter posting
View Twitter.gs
// source: https://ctrlq.org/code/19702-twitter-image-upload
function autoTweet() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("schedule"); // This must match the sheet name!
var rows = sheet.getRange("A:D").getValues();
var titleList = [], newValues = [],
response, doc, title;
var twitterCallback = function(rowIndex, err, result) {
You can’t perform that action at this time.