Skip to content

Instantly share code, notes, and snippets.

🚀 Building Focus, RemoteHabits and something new

Brad Jasper bradjasper

🚀 Building Focus, RemoteHabits and something new
View GitHub Profile
bradjasper /
Last active September 27, 2020 08:59 — forked from leoleozhu/
SimpleHTTPServer different port
#!/usr/bin/env python
import SimpleHTTPServer
import SocketServer
PORT = 8919
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)

Keybase proof

I hereby claim:

  • I am bradjasper on github.
  • I am bradjasper ( on keybase.
  • I have a public key ASC6HgChDmmMjR1--b3QX6n2L3i85MshbOXBX1kDiq69oQo

To claim this, I am signing this object:

View gist:92702a740408a22c325ead0b736120ce
2016-04-22T23:00:52.225Z 0f521c85-08de-11e6-acfd-2177bd93f70f Got createRecurringJob event
"input": {
"jobType": "urls",
"urls": [
"schedule": "rate(5 minutes)"
bradjasper / gist:b2af4762756a5df20524
Created February 14, 2015 00:50
Build, Archive & Export Mac App from command line (rather than Xcode)
View gist:b2af4762756a5df20524
echo "Building Focus..."
echo "Cleaning up old archive & app..."
bradjasper / gist:212337463f826660fec2
Created February 1, 2015 21:46
Copy & restore Focus preferences
View gist:212337463f826660fec2
Here's how to copy & restore Focus preferences
1) (On old computer) Copy preferences file to desktop. This BradJasper.Focus.plist file saves all of your settings. You can back this up in Dropbox if you want.
cp ~/Library/Preferences/BradJasper.Focus.plist ~/Desktop/
2) (On new computer) Kill focus & preferences monitor
killall Focus; killall cfprefsd;
bradjasper / is_focus_active
Created January 9, 2015 19:18
Small BASH script to check if Focus is currently activated
View is_focus_active
ACTIVE_NETWORK=$(echo "open|||get Setup:/Network/Service/$(echo "open|||get State:/Network/Global/IPv4|||" | tr '|||' '\n' | scutil | grep "PrimaryService" | awk '{print $3}') |||" | tr '|||' '\n' | scutil | grep "UserDefinedName" | awk -F': ' '{print $2}')
FOCUS_BLACKHOLE_PID=$(ps aux | grep FocusBlackholeProxy | grep -v grep | awk '{print $2}')
PROXY_URL_OUTPUT=$(networksetup -getautoproxyurl "$ACTIVE_NETWORK")
if [[ $PROXY_URL_OUTPUT == *"focus"* ]]
echo "Focus is active!"
echo "Focus is not active"
bradjasper /
Last active August 29, 2015 14:09
Remove Focus
ACTIVE_NETWORK=$(echo "open|||get Setup:/Network/Service/$(echo "open|||get State:/Network/Global/IPv4|||" | tr '|||' '\n' | scutil | grep "PrimaryService" | awk '{print $3}') |||" | tr '|||' '\n' | scutil | grep "UserDefinedName" | awk -F': ' '{print $2}')
echo "Active network is '$ACTIVE_NETWORK'"
echo "Turning off active network PAC"
sudo networksetup -setautoproxystate "$ACTIVE_NETWORK" off
echo "Removing NSUserDefaults"
bradjasper / LICENSE
Last active August 29, 2015 14:07 — forked from jamztang/LICENSE
Copyright (c) 2013 Jamz Tang <>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
View itunesicon.rb
# encoding: utf-8
# Grab iTunes Icon - Brett Terpstra 2014 <>
# Retrieve an iOS app icon at the highest available resolution
# All arguments are combined to create an iTunes search
# The icon for the first result, if found, is written to a filename based on search terms
# example:
View gist:7436681
# ANSI color codes
RESET="\[\033[0m\]" # reset
HICOLOR="\[\033[1m\]" # hicolor
UNDERLINE="\[\033[4m\]" # underline
INVERSE="\[\033[7m\]" # inverse background and foreground
FBLACK="\[\033[30m\]" # foreground black
FRED="\[\033[31m\]" # foreground red
FGREEN="\[\033[32m\]" # foreground green
FYELLOW="\[\033[33m\]" # foreground yellow
FBLUE="\[\033[34m\]" # foreground blue