Skip to content

Instantly share code, notes, and snippets.

View mattieb's full-sized avatar

Mattie B. mattieb

View GitHub Profile
@mattieb
mattieb / all-colors.sh
Last active May 30, 2023 12:05
prints all 256 available colors using portable-color
#!/bin/sh
#
# portable-color.sh is from https://github.com/mattieb/portable-color/
#
. portable-color.sh
printf %s 'all-colors:'
for n in $(seq 0 256)
@mattieb
mattieb / delete_copies.sh
Created October 8, 2022 20:57
deletes files with the text " copy" in them if an original exists
#!/bin/sh
#
# Deletes files with the text " copy" in them if an original exists.
# Cleans up after me accidentally hitting duplicate across lots of
# nested folders.
#
if [ "x$1" == x ]
then
echo usage: $0 PATH >&2
@mattieb
mattieb / download_icloud_drive.sh
Last active October 8, 2022 20:29
finds all the undownloaded iCloud Drive files and downloads them
#!/bin/sh
#
# Finds all the undownloaded iCloud Drive files in the supplied
# path and uses brctl to download each one.
#
# This is a workaround for a problem I'm having trying to download
# directories full of undownloaded iCloud Drive files. Ideally, you'd
# just be able to run `brctl download PATH` and be done with it.
# (Try that first, actually.)
#
@mattieb
mattieb / index.js
Created May 31, 2016 20:57
express-winston res.end testcase
'use strict';
const express = require('express');
const expressWinston = require('express-winston');
const stream = require('stream');
const winston = require('winston');
const app = express();
const requestLogger = new expressWinston.logger(({
@mattieb
mattieb / create_dmg.sh
Created November 4, 2015 02:51
Create a DMG installer for installing El Capitan into a VM
# Based on Tim Sutton's prepare_iso.sh from the excellent osx-vm-templates
# <https://github.com/timsutton/osx-vm-templates/blob/master/prepare_iso/prepare_iso.sh>
hdiutil attach /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/SharedSupport/InstallESD.dmg
hdiutil create -o tmp.dmg -size 10g -layout SPUD -fs HFS+J
hdiutil attach tmp.dmg
asr restore --source /Volumes/OS\ X\ Install\ ESD/BaseSystem.dmg --target /Volumes/untitled --erase
rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
cp -Rv /Volumes/OS\ X\ Install\ ESD/Packages /Volumes/OS\ X\ Base\ System/System/Installation/
cp -v /Volumes/OS\ X\ Install\ ESD/BaseSystem.* /Volumes/OS\ X\ Base\ System/
@mattieb
mattieb / out-vs-err.sh
Last active November 21, 2021 10:34
makes output on both stdout and stderr
#!/bin/sh
#
# This script outputs "stdout" to stdout and "stderr" to stderr.
#
# Try it like this and observe the differences:
#
# out-vs-err.sh 2>&1 >/dev/null
# out-vs-err.sh >/dev/null 2>&1
#
# See <http://stackoverflow.com/questions/10508843/what-is-dev-null-21/10508862#comment48709328_10508843>
checking build system type... x86_64-apple-darwin14.0.0
checking host system type... x86_64-apple-darwin14.0.0
checking for --enable-universalsdk... no
checking for --with-universal-archs... 32-bit
checking MACHDEP... darwin
checking EXTRAPLATDIR... $(PLATMACDIRS)
checking for --without-gcc... yes
checking for gcc... clang
checking whether the C compiler works... no
configure: error: in `/private/tmp/python-50OT/Python-2.7.7':
#!/usr/bin/env ruby
require 'twitter_ebooks'
# This is an example bot definition with event handlers commented out
# You can define as many of these as you like; they will run simultaneously
Ebooks::Bot.new("zigg_ebooks") do |bot|
# Consumer details come from registering an app at https://dev.twitter.com/
# OAuth details can be fetched with https://github.com/marcel/twurl
@mattieb
mattieb / otr.txt
Last active August 29, 2015 13:59
OTR fingerprint
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I am zigg on the Freenode IRC network (irc.freenode.net), and my
OTR fingerprint is A70E860E D07F0F4E 45AE0274 1F981806 8B3F562E.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBAgAGBQJTkIC5AAoJEKtGgj/PvysTLVcQAIp03kV+nQse7stwf96eWg4x
@mattieb
mattieb / playbook.yml
Created April 1, 2014 01:37
First attempt to provision and configure a droplet with Ansible
# First attempt to provision and configure a Digital Ocean droplet
# using Ansible.
#
# After you run this the first time, you have to fill in the droplet
# id it prints into the id= parameter of the digital_ocean task. From
# there on out it's idempotent.
- hosts: 127.0.0.1
connection: local
gather_facts: False