Skip to content

Instantly share code, notes, and snippets.

View rosston's full-sized avatar

Ross Brandes rosston

View GitHub Profile
@rosston
rosston / check-internet.sh
Last active October 28, 2021 23:52
A script to check which of your network interfaces is up
#!/bin/bash
# Built only to support macOS, almost certainly doesn't work on Linux
lan_mac='<your LAN MAC address>'
wifi_mac='<your Wi-Fi MAC address>'
test_url='<some test URL, which should fully support both IPv4 and IPv6>'
interfaces=$(ifconfig | grep -E '^[A-z0-9]+: ' | sed 's/: .*$//g')
@rosston
rosston / delete_old_tm_backups
Last active February 3, 2023 17:03
A script to delete Time Machine backups that match a regex
#!/usr/bin/env ruby
# Usage:
# sudo delete_old_tm_backups <path to backup volume> <regex>
#
# Example:
# sudo delete_old_tm_backups /Volumes/backup ^2019
backup_volume = ARGV.shift
delete_regex = Regexp.new(ARGV.shift)
@rosston
rosston / unwatch-github-repos.js
Last active October 20, 2021 17:59
A quick and dirty bit of JS to run in the console to quickly unwatch repos in GitHub one page at a time
// WARNING: this script is very brittle and may not do what you intend.
//
//
// To run:
// 1. On github.com/watching, copy/paste the function into the console
// 2. Call the function, passing a function to filter repos to unwatch, e.g.,
// unfollowMatches((repoName) => repoName.startsWith('rosston'))
// 3. Check the output of the function to make sure it looks right
// 4. Run the function again with `true` at the end to really for real make the changes, e.g.,
// unfollowMatches((repoName) => repoName.startsWith('rosston'), true)
@rosston
rosston / ios-update-watcher.py
Last active May 23, 2020 03:21
A script for watching and reporting progress of iOS update file downloads
#
# A script for watching and reporting progress of iOS update file downloads.
#
# Supported platforms: macOS
#
# Once your update begins downloading, run
# * on macOS:
# python3 /path/to/ios-update-watcher.py
#
import collections
say_command=$1
if [ -z "$say_command" ]; then
say_command="say"
fi
$say_command "
It's, supercalifragilisticexpialidocious
Even though the sound of it is something quite atrocious
If you say it loud enough, you'll always sound precocious
Supercalifragilisticexpialidocious

Keybase proof

I hereby claim:

  • I am rosston on github.
  • I am rosston (https://keybase.io/rosston) on keybase.
  • I have a public key ASAEF2nOt-GgXLEHrk4xLCGATKkz9wRbFbtuH6pdp-2A-Qo

To claim this, I am signing this object:

#!/bin/bash
path="/path/to/some.special.png"
filename=${path%.*}
jpg=$filename.jpg
echo "$jpg"
sudo nginx -t -c /etc/nginx/nginx.conf
/*
Below is one of my favorite timing functions.
It closely mimics jQuery's swing function.
*/
* {
transition: 0.25s transform cubic-bezier(.02, .01, .47, 1);
}
/*
* Doubly-nested timeout ensures we run after browser render. (Sometimes needs
* to be triply-nested timeout in IE/Edge, for reasons unknown to me.)
* Explanation below.
*
* 1. $watch runs, sets up $timeout to be run later (see NOTE below)
* 2. $watch finishes (i.e., Angular has finished manipulating the DOM)
* 3. First $timeout runs, sets up $timeout to be run later (see NOTE below)
* 4. Browser renders
* 5. Second $timeout runs!