Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mbierman's full-sized avatar

Michael Bierman mbierman

View GitHub Profile
@mbierman
mbierman / apigeeconsole.html
Created May 3, 2012 08:33
How to make an embedded Apigee console for API documentation
<iframe src="https://apigee.com/embed/console/twitter?v=2" height="100%" width="100%" scrolling="no"></iframe>
<!--
How to make an embedded Apigee API v2 Console
Simply go to https://apigee.com/togo and create a console. Then, you'll get an iframe code similar to the one above with your Console and you can embed anywhere you like.
The "?v=2" is a new way to get the latest Apigee Console. More details to come!
-->
HTTP/1.1 200 OK
Date:
Thu, 17 May 2012 00:53:35 GMT
Content-Length:
565
Set-Cookie:
rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Wed, 16-May-2012 00:53:36 GMT
Content-Type:
application/json
Connection:
@mbierman
mbierman / gist:3232063
Created August 2, 2012 00:57
AppleScript to preview the current file in TextWranger in Chrome.
-- Based on Sam Dutton's script (http://goo.gl/27XlZ)
-- which was based on Mike Piontek's script (http://goo.gl/SBkkL)
-- This is Chrome specific. See https://gist.github.com/3232318 for a Safari Script
tell application "TextWrangler" to set theFile to file of document 1
tell application "TextWrangler" to save document 1
set appleScriptPath to theFile as text
set currentURL to POSIX path of appleScriptPath
set currentURL1 to POSIX path of appleScriptPath
@mbierman
mbierman / gist:3232318
Created August 2, 2012 01:36
Preview HTML from TextWrangler in Safari
-- Based on Sam Dutton's http://goo.gl/27XlZ script
-- which was based on Mike Piontek's script http://goo.gl/SBkkL
-- this is Safari specific
-- see https://gist.github.com/3232063 for a Chrome Script.
tell application "TextWrangler" to set theFile to file of document 1
tell application "TextWrangler" to save document 1
set appleScriptPath to theFile as text
set currentURL to POSIX path of appleScriptPath
@mbierman
mbierman / SoundOutput.applescript
Last active December 10, 2015 03:58
Set the Audio Output on OSX
set asrc to (choose from list {"Internal Speakers", "Living Room", "Girl's Room", "Master Bedroom"} with title "Sound Picker" default items {"Internal Speakers"}) as text
if result is "false" then return
-- for debugging
-- display dialog "src is: " & asrc
tell application "System Preferences"
reveal anchor "output" of pane id "com.apple.preference.sound"
@mbierman
mbierman / pullme.bash
Created December 26, 2012 18:32
Bash script to pull a bunch of directories and exclude a few by name.
#!/bin/bash
START_HERE="/Users/mbierm1/git";
cd $START_HERE;
echo -e "\nPulling down latest for $START_HERE\n";
for d in $(find . -maxdepth 1 -mindepth 1 -type d -not \( -name dir_1 -o -name dir_2 \) ); do
echo -e "$d";
@mbierman
mbierman / mobile safari.applescript
Last active December 11, 2015 05:59
Open Mobile Safari to a particular URL, set the user agent to iPhone, and center on screen.
-- Sets Safari to iPhone user agent and loads mobile.walmart.comf
set theURL to "http://mobile.walmart.com"
tell application "Safari" to activate
tell application "Safari"
activate
try
tell window 1 to set current tab to make new tab with properties {URL:theURL}
on error
open location theURL
@mbierman
mbierman / TurnoffWifiwithDisplayPort
Last active December 20, 2015 10:39
Turn off Wifi if Display Ethernet is plugged in
-- note this assumes your wireless ethernet interface is en1
-- get the correct interface from the menu Apple|About This Mac|Network|Wi-Fi or from terminal using ifconfig -a
-- todo:
-- dynamically set the wifi
--
set makiaeawireedstatus to null
set makiaeawireedstatus to do shell script "networksetup -listallhardwareports"
@mbierman
mbierman / getnpr.sh
Last active April 10, 2021 01:49
Fetch NPR shows
#!/bin/bash
# Varibles
OS="$(uname -s | sed -e 's/Darwin/macos/g')"
MUSER=$(echo $USER | tr '[:upper:]' '[:lower:]' | awk '{for (i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) substr($i,2)} 1')
MACH=$(hostname -s)
PATH=$LOCATION:$PATH
UA="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 Safari/537.36"
MKDIR="mkdir -p"
LOCATION=$(dirname $0)
.date_overdue {
color: red;
border: 2px solid red;
padding-left: 20px;
padding-right:20px;
border-radius: 4px;
}
.date_future {