This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# TROUBLESHOOTING: | |
# If /bin/echo doesn't exist _and_ echo -n doesn't work, then this | |
# script fails. A more graceful fallback to not dropping the trailing | |
# newline in pipes would also work, but this hasn't been necessary yet. | |
usage () { cat <<'EOF' 1>&2 | |
lsowners [OPTIONS] [--] [DIRS...] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
usage () { | |
cat 1>&2 <<ENDUSAGE | |
Usage: slackmsg [OPTIONS] -t<URL> [--] MESSAGE | |
Options: | |
-t|--target URL The Slack URL to send a message to. (required) | |
-d|--dry-run Print the payload and curl request only. | |
-i|--stdin Read the MESSAGE from standard input. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Usage: lsdep [PACKAGE...] | |
# | |
# Example (list github.com/foo/bar and package dir deps [the . argument]) | |
# $ lsdep github.com/foo/bar . | |
# | |
# By default, this will list dependencies (imports), test imports, and test | |
# dependencies (imports made by test imports). You can recurse further by | |
# setting TESTIMPORTS to an integer greater than one, or to skip test | |
# dependencies, set TESTIMPORTS to 0 or a negative integer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To be sourced in either zsh or bash | |
# cdv works better if you use zsh and cd is synonymous with pushd | |
# vendor_subpath looks for any vendor directory in the current directory and in any directory above it. If found, it | |
# will search that directory first for an exact match and then the shortest inexact match for the path given (arg 1). | |
# | |
# E.g., vendor_subpath foo/bar will search first for an exact vendor/foo/bar directory. If none is found, it will then | |
# try to find vendor/*foo/bar* and pick the shortest. | |
vendor_subpath () { | |
( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2016 Noel Cower. All rights reserved. | |
// Use of this source code is governed by a BSD-style license that can be found | |
// at the end of the file. | |
// This file is intended to demonstrate writing a general-purpose HTTP handler | |
// where the input and output are known to be JSON, follow a particular error | |
// convention, and so on. It falls apart in particular with GET requests where | |
// request bodies are uncommon, at best. | |
// | |
// The responder handlers mimic gRPC's error code/response format, but does not |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Stamp | |
" Maps S (shift+s) to replace the current word under the cursor with whatever's | |
" in the given (or default) register. | |
function! s:Stamp(reg) | |
if a:reg == "" | |
let a:reg = v:register | |
endif | |
execute "let l:v = @" . a:reg | |
exec "norm! viw\"" . a:reg . "p" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"io" | |
"io/ioutil" | |
"log" | |
"net" | |
"net/http" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
export API="${API:-$(git config gitlab.endpoint)}" | |
export TOKEN="${TOKEN:-$(git config gitlab.token)}" | |
export API="${API%*/}" | |
export self="${BASH_SOURCE[0]}" | |
if [[ -z "$API" ]] || [[ -z "$TOKEN" ]] ; then | |
cat <<-EOF 1>&2 | |
API and TOKEN environment variables must be set, or you need to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set_order () { | |
local oarg="$1" | |
case "$oarg" in | |
commits|c) | |
order=1 | |
;; | |
lines|l) | |
order=2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type glogWriter func(...interface{}) | |
func (fn glogWriter) Write(d []byte) (n int, err error) { | |
n = len(d) | |
if fn != nil { | |
fn(string(d)) | |
} | |
return n, err | |
} |