Skip to content

Instantly share code, notes, and snippets.

View koehn's full-sized avatar
🧐
Coaching

Brad Koehn koehn

🧐
Coaching
View GitHub Profile
@koehn
koehn / getip
Created November 24, 2013 15:38
Send the current IP address to stdout.
#!/bin/bash
CHECK_IP=`curl -m 30 http://checkip.dyndns.org/ 2> /dev/null`
if [ $? -ne 0 ]
then
echo Unable to get current IP address with curl >&2
exit 100
fi
echo $CHECK_IP | sed -e 's!.*: \(.*\)</body>.*!\1!'
@koehn
koehn / # protobuf - 2020-08-05_07-26-06.txt
Created August 5, 2020 14:02
protobuf on macOS 11.0 - Homebrew build logs
Homebrew build logs for protobuf on macOS 11.0
Build date: 2020-08-05 07:26:06
@koehn
koehn / diaspora-init
Created December 16, 2015 15:27
Required for my `/etc/init.d/diaspora` init script. Put this into `/home/diaspora/diaspora/diaspora-init`.
#!/bin/bash --login
shopt -s expand_aliases
export RAILS_ENV=production
export DB=postgres
cd /home/diaspora/diaspora
./script/server
@koehn
koehn / backup to encrypted diskimage on remote AFP server.sh
Last active September 25, 2017 19:36
Script for backing up a Mac OS X folder to an encrypted disk image on a remote AFP server. You must first create the encrypted disk image using Disk Utility. I recommend making it a sparsebundle for better use of space and performance. You can run this with cron and append the output to a log file. Modify the `rsync` command to exclude subdirect…
#!/bin/bash
echo =====================================
echo `date` Backing up Documents
# The URL to your remote AFP server. You can test your URL using command-K in the Finder.
AFP_URL=afp://user:password@afp.server.com/Share
# The place where the AFP server is mounted. By default this will be in /Volumes someplace.
AFP_DIRECTORY=/Volumes/Share
@koehn
koehn / diaspora
Last active August 14, 2016 18:50
Init file to start/stop Diaspora. Requires a file in /home/diaspora/diaspora/diaspora-init (see my gists for more). Hit me up on diaspora at bkoehn@diaspora.koehn.com if you have any questions.
#! /bin/sh
### BEGIN INIT INFO
# Provides: diaspora
# Required-Start: apache2
# Required-Stop:
# Should-Start:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Diaspora social networking pod server

Keybase proof

I hereby claim:

  • I am koehn on github.
  • I am koehn (https://keybase.io/koehn) on keybase.
  • I have a public key ASAxVSsmthQySpAjuJlqGcI4c5bVXQHf9H5bRcwT_fEchwo

To claim this, I am signing this object:

@koehn
koehn / cleanup.sh
Created July 1, 2016 18:32
Clean up dangling docker volumes
docker volume ls -qf dangling=true | xargs -r docker volume rm
@koehn
koehn / txt
Created March 7, 2016 20:02
Fix Mac Docker
Run the Docker Quickstart Terminal app
Run docker-machine restart default
Run eval $(docker-machine env default)
@koehn
koehn / GenericsQuiz.java
Last active January 3, 2016 09:39
Test your Java generics knowledge with this pop quiz: which are the valid statements?
import java.util.List;
public class GenericsQuiz {
List<Number> listOfNumber;
List<? extends Number> listOfExtendsNumber;
List<? super Number> listOfSuperNumber;
List<Integer> listOfInteger;
List<? extends Integer> listOfExtendsInteger;
List<? super Integer> listOfSuperInteger;
@koehn
koehn / quit.sh
Created January 4, 2014 16:48
A simple command-line utility to use AppleScript (neé OSAScript) to quit an application. Usage: `quit [Application Name]`
#!/bin/bash
osascript -e "tell application \"$1\" to quit"