Skip to content

Instantly share code, notes, and snippets.

View mslinn's full-sized avatar

Mike Slinn mslinn

View GitHub Profile
@mslinn
mslinn / prs
Last active February 12, 2020 20:18
Bash script to apply PRs from Scala Steward to a GitHub repo
#!/bin/bash
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
NO_COLOR="\[\033[0m\]"
dependencyName() {
echo "$3"
}
@mslinn
mslinn / play28template
Last active December 14, 2019 00:33
bash script that automatically does the necessary steps for creating a new Play Framework project from play28-template
#!/bin/bash
# Clones play28-template and starts a new SBT project
# Optional argument specifies name of directory to place the new project into
DIR=play28template
if [ "$1" ]; then DIR="$1"; fi
git clone https://github.com/mslinn/play28-template.git "$DIR"
cd "$DIR"
@mslinn
mslinn / idea
Created October 13, 2019 19:37
WSL launch script for IntelliJ IDEA
#!/bin/bash
set -eo pipefail
idea2 "$@" &
@mslinn
mslinn / play27Template
Created September 30, 2019 18:28
bash script that automatically does the necessary steps for creating a new Play Framework project from play27Template
#!/bin/bash
# Clones play27Template and starts a new SBT project
# Optional argument specifies name of directory to place the new project into
DIR=play27Template
if [ "$1" ]; then DIR="$1"; fi
git clone https://github.com/mslinn/play27Template.git "$DIR"
cd "$DIR"
rm -rf .git
@mslinn
mslinn / wtj
Created June 23, 2019 03:35
Bash script to display and change Microsoft Terminal color scheme for Ubuntu tabs
#!/bin/bash
WTJ="/mnt/c/Users/mslinn/AppData/Local/Packages/Microsoft.WindowsTerminal_8wekyb3d8bbwe/RoamingState/profiles.json"
if [[ -z"$1" ]]; then # Display the color schemes
echo -n "Color scheme for this tab is "
jq -r '.profiles[] | select(.name=="Ubuntu") | .colorScheme' "$WTJ"
echo "Color scheme values are:"
jq -r '.schemes[] | .name' "$WTJ" | sort | uniq
else # Set the color scheme
X="$( jq '(.profiles[] | select(.name=="Ubuntu") | .colorScheme)="$1"' "$WTJ" )"
@mslinn
mslinn / cronTest
Last active March 22, 2026 12:03
Run a cron job manually and immediately
#!/bin/bash
# Execute a user crontab entry with the proper environment
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
env -i bash --noprofile --norc -c "$DIR/cronTest2 $USER"
@mslinn
mslinn / .cadenzaClient.json
Last active May 1, 2019 01:34
Bash incantation for defining whiptail radiolist programmatically
{
"activeDatabase": "localhost",
"databases": [
{
"name": "production",
"PGDB": "asdf",
"PGHOST": "asfd",
"PGPASSWORD": "asf",
"PGPORT": "asdf",
"PGUSER": "asf"
@mslinn
mslinn / buildAlmond
Last active August 14, 2019 00:54
Almond Installation Builder
#!/bin/bash
ALMOND_VERSION=0.4.0
INSTALL_PATH=/tmp
SCALA_VERSION=2.12.9
unset OVERWRITE
function help {
echo "${1}$(basename $0) - Build Almond installer and execute it, then deletes installer and lists the Jupyter kernels.
almond is a Scala kernel for Jupyter. See https://almond.sh/docs
@mslinn
mslinn / c:\wsl\git.bat
Created April 26, 2019 04:42
Run WSL git from native Windows apps
@echo off
rem Taken from https://stackoverflow.com/a/54106424/553865
setlocal enabledelayedexpansion
set command=%*
set find=C:\Users\%USERNAME%\AppData\Local\Temp\git-commit-msg-.txt
set replace=/mnt/c/Users/%USERNAME%/AppData/Local/Temp/git-commit-msg-.txt
call set command=%%command:!find!=!replace!%%
echo | C:\Windows\System32\bash.exe -c 'git %command%'
@mslinn
mslinn / less
Last active April 21, 2019 08:31
View GitHub Markdown files in a console
#!/bin/bash
function help {
echo "View GitHub markdown files in a console using less.
1. Install pandoc and lynx.
a. For Ubuntu (and WSL): sudo apt install pandoc lynx
b. For MacOS: brew install pandoc lynx
2. Name the this script as less and save it somewhere on the PATH, for example /usr/local/bin.