Skip to content

Instantly share code, notes, and snippets.

View mslinn's full-sized avatar

Mike Slinn mslinn

View GitHub Profile
@mslinn
mslinn / gitbucket on ubuntu
Last active August 29, 2015 13:57
GitBucket Scripts
wget -O /opt/ https://github.com/takezoe/gitbucket/releases/download/1.12/gitbucket.war
java -jar /opt/gitbucket.war
@mslinn
mslinn / PS1.sh
Last active August 29, 2015 14:05
Bash prompt with user@server dirname gitBranch Play>
function parse_git_branch {
ref="$(git symbolic-ref HEAD 2> /dev/null)" || return
echo "("${ref#refs/heads/}")"
}
PS1=$'\033]0;\h: \W\007\[\033[0;32m\]\u@\h \W \[\033[0;33m\]$(parse_git_branch) \[\033[38;5;77m\]\u25B6\[\033[0m\]\[\033[00m\] '

Keybase proof

I hereby claim:

  • I am mslinn on github.
  • I am mslinn (https://keybase.io/mslinn) on keybase.
  • I have a public key whose fingerprint is CC79 299A EEF3 9D71 065A E9C5 7106 2721 5DEA F0F0

To claim this, I am signing this object:

@mslinn
mslinn / foreach.sh
Created September 4, 2014 14:11
Executes a command on all subdirectories one level down from the current directory. Expects to find a subdirectory of git projects
#!/bin/bash
set -eo pipefail
HIGHLIGHT="\e[01;34m"
NORMAL='\e[00m'
if [ -z "$2" ]; then
echo "Usage: $(basename $0) dirPattern command"
echo " Where dirPattern can be an absolute or relative path. If wildcards are used, enclose the dirPattern in single quotes"
@mslinn
mslinn / foreachr.sh
Last active August 29, 2015 14:06
Recursive foreach, expects to find a tree of git projects
#!/bin/bash
# From ScalaCourses.com Introduction to Play Framework with Scala course
# Execute a command in all git directories below current directory or specified directory
# Skips directories that contain a file called .ignore
#
# Usage:
# foreach . git pull
# foreach . git grep "word or phrase"
@mslinn
mslinn / plant.sh
Last active August 29, 2015 14:06
Clone an Activator template and initialize a Git repository for the new project
#!/bin/bash
# From ScalaCourses.com Introduction to Play Framework with Scala course
if [ -z "$1" ]; then
echo "Clone an Activator template and initialize a Git repository for the new project"
echo "Usage: $(dirname $0) templateName [repoName]"
echo "repoName defaults to templateName if not specified"
exit -1
fi
@mslinn
mslinn / BlendedEnums.scala
Last active August 29, 2015 14:06
Extends Java enums so Scala match statements work. The purpose of this code example is to show a generic way of extending multiple Java enums in a Scala program so Scala match statements work, while preserving all of the functionality of Java enums for use by Scala programs. That is why there are methods that are defined but not used. A macro co…
object BlendedEnums extends App {
import Day._
trait EnumLike[T] extends Ordered[T] {
def name: String
def compare(other: T): Int
def ordinal: Int
@mslinn
mslinn / installScala
Last active August 29, 2015 14:08
Installs Scala on Mac, Ubuntu and other Debian derivatives
#!/bin/bash
# Installs specified Scala version, and enables colorized REPL
SCALA_VERSION=2.11.4
if [ "$1" ]; then SCALA_VERSION=$1; fi
set -e
case "$OSTYPE" in
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
}
}
allprojects {
@mslinn
mslinn / build.gradle
Last active August 29, 2015 14:11
Another failed attempt
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
}
}
allprojects {