Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View roosto's full-sized avatar

Dustø Masterson Goldman roosto

View GitHub Profile
@roosto
roosto / set-secret.bash
Last active April 6, 2021 11:34
a secure bash shell function to interactively set and export an environment variable
#!/bin/bash
function set-secret {
# TODO: handle signals: an ill-timed signal could leave the user
# with a non-sane terminal, which can really foul things up
# even for experienced users
ME='set-secret'
@roosto
roosto / pbmunge.bash
Created September 2, 2020 13:16
Filter/Modify contents of the macOS pasteboard using arbitrary commands
function pbmunge {
if [[ "$1" ]] && echo "$1" | grep -q -e '^-h$' -e '^--help$'
then
echo 'Usage: pbmunge utility [util-arg ...]'
echo ''
echo "Filter (or munge) contents of the macOS pasteboard using \`utility'"
echo " \`utility' will be invoked with any supplied util-arg(s)"
echo ''
echo 'Example: increase the quote level of a plain text email'
@roosto
roosto / log_defaults_writes.bash
Last active September 2, 2020 12:09
func to use in bash to log invocations of `defaults write`
# to be run as your `PROMPT_COMMAND`, this will log any invocations of `defaults write`
# now you stand a chance of figuring out which time when you pasted something from a
# random website into your terminal months ago is now totally screwing up your mac
function __log_defaults_writes {
local DEFAULTS_WRITES_HISTORY="$HOME/.defaults_writes"
if history 1 | grep -F -q 'defaults write'
then
chmod u+w "$HOME/.defaults_writes" # make log file writeable
echo -en "$(date +%Y%m%d.%T):\t"$'\t' >> "$DEFAULTS_WRITES_HISTORY" # add timestamp
@roosto
roosto / get_attritubes_from_ipa.py
Created October 18, 2018 19:21
Some python to pull Info.plist values out of a .ipa file
# This has to be run on macOS, because it relies on `plutil(1)` to convert binary Info.plist files
# into ASCII xml plist files. If you know the Info.plist will not be binary, you should be able to
# run this on other systems with minimal modification
# we pass the file path of the .ipa and array of plist keys to retrieve
# returns: a dict of the plist keys and their values as found in the app’s Info.plist
def get_attritubes_from_ipa(ipa_file, attributes):
retval = {}
zip_archive = zipfile.ZipFile(ipa_file, 'r')
@roosto
roosto / macos-unix.md
Created August 5, 2018 21:45
A quick guide for useful unix commands for use in macOS

macOS & Unix: Making the World’s Best Desktop Even Better

General Tips

  1. Drag a file onto the terminal to get its path put on the command line
  2. In the Finder ⇧⌘G gives a dialogue box to open a location, that can use tab completion.
  3. Pressing / or ⇧⌘G in any file picker dialogue will give you the same file location dialogue box.
  4. Show/hides hidden files in a save dialogue box: ⇧⌘.

Homebrew

@roosto
roosto / ascii-art-lightning-talk-notes.md
Created July 26, 2018 13:39
Notes from my Creative Coding NYC ASCII Art ⚡ Talk on July 25, 2018

Creative Coding NYC ASCII Art ⚡ Talk

Here are links and follow-up notes from the ASCII Art Tips & Trick talk by Dustin Goldman, originally presented at the [Creative Coding X meetup][1].

Dustin hopes you enjoyed the talk. If you have any questions, feel free to contact him on twitter, where he is [@roosto][2]

FIGlet

per the [FIGlet website][3]:

@roosto
roosto / cowtip-cows.txt
Last active July 26, 2018 12:17
A collection of custom cowsay .cow files
# all the custome .cow files from https://github.com/roosto/cowtip
# Author: Dustin Goldman <dusto@goldmans.net>
##### ducks.cow #####
$the_cow = <<COW;
$thoughts
$thoughts
>(.)__ <(.)__ =(.)__
~~~~~~~~~(___/~~~(___/~~~(___/~~~~~~~~~
COW
@roosto
roosto / party.sh
Last active April 6, 2016 17:10 — forked from poweld/party.sh
Annoy your coworkers with massive emoji banners in Slack
function party {
if ! command -v figlet > /devc/null; then
if ! command -v brew > /dev/null; then
echo Requires figlet or brew to be installed 1>&2
return 1
fi
brew install figlet || exit $?
fi
if [ -z "$1" ]; then
@roosto
roosto / timber_short.pl
Last active August 29, 2015 14:04
A file for a “Code Golf” challenge. Specially “Timber”, № 8, here: http://codegolf.stackexchange.com/questions/16707/9-hole-challenge
# roosto’s “Code Golf” v3 149 characters
# problem is #8 here: http://codegolf.stackexchange.com/questions/16707/9-hole-challenge
#
# The basic idea here is to go line by line, looking through the current line for whitespace.
# When we find a whitespace character we see if the character above it needs
# to have a non-whitespace character, a.k.a. a “supporting” character below it.
# If the “supporting” character above the whitespace character is not '/' or '\', a.k.a. a “bracing” character,
# then shit is fucked. We make comparisons easier and severely limit corner cases by
# kinda normalizing the input with a few regexs before we get into it.
#
@roosto
roosto / jenkins_login_redirect.js
Last active August 29, 2015 14:01
Reload Jenkins Login Page Bookmarklet
/***********************
Dustin Masterson aka @roosto
If you have been logged out of jenkins and you open your browser and your
browser reopens a slew of tabs from your jenkins instance, each page will
redirect you to a login page.
Annoyingly even after you login on one of these login pages, reloading
another page will still load the login page, instead of the page that you