Skip to content

Instantly share code, notes, and snippets.

View motionbug's full-sized avatar

Rob P motionbug

View GitHub Profile
@motionbug
motionbug / png2icns
Created October 9, 2018 13:51 — forked from djhaskin987/png2icns
Convert PNG file to ICNS file
# Stolen from here: http://stackoverflow.com/a/20703594/850326
#!/bin/sh
export POSIXLY_CORRECT=1
if [ -z "${1}" -o -z "${2}" ]
then
echo "Usage: ${0} <name> <original-png-location>"
fi
name=$1
@motionbug
motionbug / logged-bash-script-example.sh
Created August 9, 2018 12:28 — forked from benbuckman/logged-bash-script-example.sh
tee stdout to log inside bash script
#! /bin/bash
# concept from http://stackoverflow.com/a/3403786/267224
#############
# log to file
LOGFILE=/home/user/log/script.log
exec > >(tee -a $LOGFILE)
exec 2>&1
############
@motionbug
motionbug / setenv.sh
Last active September 13, 2015 18:16 — forked from terrancesnyder/setenv.sh
./setenv.sh - example setenv.sh with defaults set for minimal time spent in garbage collection
#! /bin/sh
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft
#!/usr/bin/python
import sys
import os, shutil
import subprocess
import os.path
from datetime import datetime
######################## Functions #########################
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars
@motionbug
motionbug / gist:3085136
Created July 10, 2012 17:55 — forked from jamesez/gist:3085058
Build Chrome dmg
#!/bin/bash -ex
# Mount disk image on temp space
mountpoint=`hdiutil attach -mountrandom /tmp -nobrowse googlechrome.dmg | awk '/private\/tmp/ { print $3 } '`
echo Mounted on $mountpoint
# Determine version number
version=`defaults read "$mountpoint/Google Chrome.app/Contents/Info.plist" CFBundleShortVersionString`
echo Google Chrome version $version
@motionbug
motionbug / com.adobe.Acrobat.Pro.plist
Created June 17, 2012 05:53 — forked from timsutton/com.adobe.Acrobat.Pro.plist
Suppress updates, offer to associate PDFs with Acrobat, EULA
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>10</key>
<dict>
<key>AVAlert</key>
<dict>
<key>Checkbox</key>
<array>
@motionbug
motionbug / postflight
Created June 15, 2012 18:53 — forked from rockpapergoat/postflight
create a recovery partition using apple's tools
#!/bin/bash
hdiutil attach -nobrowse -noverify /tmp/RecoveryHDUpdate.dmg
hdiutil attach -nobrowse -noverify /Volumes/RecoveryHDUpdate/RecoveryHDUpdate.pkg/RecoveryHDMeta.dmg
/tmp/RecoveryHDUpdate/RecoveryHDUpdate.pkg/Scripts/Tools/dmtest ensureRecoveryPartition / /Volumes/Recovery\ HD\ Update/BaseSystem.dmg 0 0 /Volumes/Recovery\ HD\ Update/BaseSystem.chunklist
hdiutil eject /Volumes/Recovery\ HD\ Update
hdiutil eject /Volumes/RecoveryHDUpdate
@motionbug
motionbug / launchdexample.xml
Created June 15, 2012 18:17 — forked from chrishulbert/launchdexample.xml
launchd example plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.mycompanyname.mydepartment.mytaskname</string>
<key>ProgramArguments</key>
<array>
<string>/Users/myuser/Dashboard/mytask.sh</string>
</array>