Skip to content

Instantly share code, notes, and snippets.

View bradjasper's full-sized avatar
💭
🚀 Building Focus, RemoteHabits and something new

Brad Jasper bradjasper

💭
🚀 Building Focus, RemoteHabits and something new
View GitHub Profile
@bradjasper
bradjasper / http-server.py
Last active September 27, 2020 08:59 — forked from leoleozhu/http-server.py
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 (https://keybase.io/bradjasper) on keybase.
  • I have a public key ASC6HgChDmmMjR1--b3QX6n2L3i85MshbOXBX1kDiq69oQo

To claim this, I am signing this object:

2016-04-22T23:00:52.225Z 0f521c85-08de-11e6-acfd-2177bd93f70f Got createRecurringJob event
{
"input": {
"jobType": "urls",
"urls": [
"http://google.com"
]
},
"schedule": "rate(5 minutes)"
}
@bradjasper
bradjasper / gist:b2af4762756a5df20524
Created February 14, 2015 00:50
Build, Archive & Export Mac App from command line (rather than Xcode)
#!/bin/bash
BASE_DIR=$HOME/Projects/focus
BUILD_DIR=$BASE_DIR/Builds
FOCUS_ARCHIVE=$BUILD_DIR/Focus.xcarchive
FOCUS_APP=$BUILD_DIR/Focus.app
echo "Building Focus..."
echo "Cleaning up old archive & app..."
@bradjasper
bradjasper / gist:212337463f826660fec2
Created February 1, 2015 21:46
Copy & restore Focus preferences
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
bradjasper / is_focus_active
Created January 9, 2015 19:18
Small BASH script to check if Focus is currently activated
ACTIVE_NETWORK=$(echo "open|||get Setup:/Network/Service/$(echo "open|||get State:/Network/Global/IPv4|||d.show" | tr '|||' '\n' | scutil | grep "PrimaryService" | awk '{print $3}') |||d.show" | 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"* ]]
then
echo "Focus is active!"
else
echo "Focus is not active"
@bradjasper
bradjasper / remove_focus.sh
Last active August 29, 2015 14:09
Remove Focus
#!/bin/bash
ACTIVE_NETWORK=$(echo "open|||get Setup:/Network/Service/$(echo "open|||get State:/Network/Global/IPv4|||d.show" | tr '|||' '\n' | scutil | grep "PrimaryService" | awk '{print $3}') |||d.show" | 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
bradjasper / LICENSE
Last active August 29, 2015 14:07 — forked from jamztang/LICENSE
Copyright (c) 2013 Jamz Tang <jamz@jamztang.com>
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
#!/usr/bin/ruby
# encoding: utf-8
#
# Grab iTunes Icon - Brett Terpstra 2014 <http://brettterpstra.com>
#
# 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:
# 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