Skip to content

Instantly share code, notes, and snippets.

Daniel Simmons dansimau

Block or report user

Report or block dansimau

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dansimau
dansimau / google-maps-takeout-to-kml.py
Created Oct 18, 2018
Convert starred places from Google Maps to a KML document (via Google Takeout).
View google-maps-takeout-to-kml.py
"""
Takes a list of JSON files from Google Takeout's "Maps (Your Places)" and
converts them into KML documents.
"""
import json
import os
import simplekml
import sys
import unicodedata
import xml.sax.saxutils
@dansimau
dansimau / go-test-pretty.sh
Created Apr 10, 2017
Run `go test`, only displaying error output, plus print counts of all tests passed/failed/etc.
View go-test-pretty.sh
#!/bin/bash
#
# Runs `go test -v`, parses the output and only displays errors. Also displays
# a summary of tests passed/failed/skipped/etc.
#
set -o pipefail
declare buffer=
declare test_error=false
@dansimau
dansimau / RunParallel.go
Created Nov 20, 2016
RunParallel is a drop-in replacement for testify/suite.Run that runs all tests in parallel.
View RunParallel.go
// RunParallel is a drop-in replacement for testify/suite.Run that runs
// all tests in parallel.
//
// It uses reflection to create a new instance of the suite for each
// test
func RunParallel(t *testing.T, userSuite suite.TestingSuite) {
if _, ok := userSuite.(suite.SetupAllSuite); ok {
t.Log("Warning: SetupSuite exists but not being run in parallel mode.")
}
if _, ok := userSuite.(suite.TearDownAllSuite); ok {
@dansimau
dansimau / supervise.sh
Created Nov 14, 2016
process supervisor in bash
View supervise.sh
#!/bin/bash
#
# Spawn a process and restart it if it exits.
#
declare -i exit_code
declare -i pid
_cleanup() {
echo "[$(date)]: sending TERM to pid $pid"
kill -TERM $pid
@dansimau
dansimau / go.sh
Last active Nov 30, 2017
Bash functions for navigating Go workspaces ("Go-go!")
View go.sh
#
# Change to the directory of the specified Go package name.
#
gg() {
paths=($(g "$@"))
path_index=0
if [ ${#paths[@]} -gt 1 ]; then
c=1
@dansimau
dansimau / go-get-version.sh
Last active Nov 14, 2016
Like `go get`, but specify a commit ref in the package spec
View go-get-version.sh
#!/bin/bash
#
# Same as `go get` but you can specify a git commit ref.
#
set -e
#
# Resolve the path to the Go workspace from GOPATH.
#
_go_workspace() {
@dansimau
dansimau / foo.go
Created Apr 11, 2016
mockery generation test
View foo.go
package foo
type FooInterface interface {
FooFunc()
}
@dansimau
dansimau / LICENSE
Last active Mar 11, 2016 — forked from jamesarosen/git-merge-button.md
GitHub's Merge Button™ from the command line
View LICENSE
Copyright (c) 2016 Daniel Simmons
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
View bar.go
package foo
type Interface interface {
foo()
}
View revert-lights-out.py
from Foundation import CFPreferencesSetValue
from Foundation import CFNotificationCenterPostNotification
from Foundation import CFNotificationCenterGetDistributedCenter
from Foundation import kCFPreferencesAnyApplication
from Foundation import kCFPreferencesCurrentUser
from Foundation import kCFPreferencesCurrentHost
# Remove offending preference
CFPreferencesSetValue('AppleInterfaceStyle', None, kCFPreferencesAnyApplication,
kCFPreferencesCurrentUser, kCFPreferencesCurrentHost)
You can’t perform that action at this time.