Skip to content

Instantly share code, notes, and snippets.

View rosston's full-sized avatar

Ross Brandes rosston

View GitHub Profile
@rosston
rosston / find-lodash-method.js
Last active January 9, 2024 20:22
jscodeshift "transform" to find uses of any lodash method
'use strict';
//
// Usage:
// jscodeshift -t find-lodash-method.js /path/to/dir/or/file --method-name=<lodash_method> [--min-args=<min_num_args>] [--chain-only=1]
//
// Prints all locations of matching uses of the lodash method (e.g., `map`).
//
// Function copied from https://github.com/jfmengels/lodash-codemods/blob/v1.0.1/lib/method-calls-conditional-name-changes.js#L163-L179
@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 / 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 / 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);
}