This file contains hidden or 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
import java.util.* | |
import kotlin.reflect.KClass | |
/** | |
* Produces a new map that represents a merge of [source] into [this], returning an immutable view. Map leaves will be | |
* overwritten from [source] into [this]. | |
* | |
* @param source Nested [Map<String,Any>] that will be merged over [this]. Must be [Map<String,Any>] | |
* | |
* @throws IllegalArgumentException When [source] causes a [ClassCastException] caused by a non-[String] key |
This file contains hidden or 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 | |
# To launch blindly and with great trust: | |
# $ bash <(curl -s https://gist.githubusercontent.com/jason-stiefel/57f55a14d3f47931edf03a0dd56a5e83/raw/btc_jimmysong.sh) | |
# Or pass a command and start a shell if you'd rather skip jupyter launch: | |
# $ bash <(curl -s https://gist.githubusercontent.com/jason-stiefel/57f55a14d3f47931edf03a0dd56a5e83/raw/btc_jimmysong.sh) bash | |
set -euox pipefail | |
mkdir -p ${PWD}/sandbox ${PWD}/cache ${PWD}/local |
This file contains hidden or 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 -euo pipefail; shopt -s inherit_errexit | |
# Dont. | |
export MYVAR=$(exit 1) && echo "I'll run because bash is kind of unpredictable" | |
# Do. | |
declare MYVAR | |
MYVAR=$(exit 1) && echo "I wont run because ... well whatever." |
This file contains hidden or 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 | |
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | |
TARGET_HOST="${TARGET_HOST:?"You must define TARGET_HOST"}" | |
PASSWORD_FILE="${PASSWORD_FILE:?"You must define PASSWORD_FILE"}" | |
EAP_PROXY_IMAGE="${EAP_PROXY_IMAGE:-"pbrah/eap_proxy-udmpro:v1.1"}" | |
HC_CONTAINER_NAME="eap_proxy-healthcheck" | |
UDM_CONTAINER_NAME="eap_proxy-udmpro" |
This file contains hidden or 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
# Resolves an absolute path regardless of distribution or arch. | |
absPath() { | |
python -c "import os,sys; print os.path.abspath(sys.argv[1])" ${1} | |
} |
This file contains hidden or 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
set softtabstop=4 shiftwidth=4 expandtab autoindent smartindent |
This file contains hidden or 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
import java.io.*; | |
import java.util.*; | |
import java.util.stream.*; | |
import com.google.common.collect.ImmutableMap; | |
/* | |
Given a list of flights (in any order), construct the trip that this list represents. For example, if we have a flight from San Francisco to Los Angeles and a flight from New York City to San Francisco, the trip is "NYC to SFO to LAX". | |
Assumptions: | |
- A city will only be visited once per trip. (you can't go back to a given city after visiting it). | |
- The list will only represent one single trip. |
This file contains hidden or 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 | |
echo "Writing DATATIME_* environment variables out to a properties file ..." | |
echo "" > ${DATATIME_HOME}/datatime.properties | |
for ENV in $(env); do | |
key="$( cut -d '=' -f 1 <<< "${ENV}" )" | |
val="$( cut -d '=' -f 2- <<< "${ENV}" )" | |
if [[ ${key} == DATATIME_* ]]; then | |
key=$(echo $key | tr _ . | tr '[:upper:]' '[:lower:]') | |
echo "Copying datatime.properties value from environment: ${key}" |
This file contains hidden or 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
# Call with a machine name to load the environment for that machine. Called | |
# without a machine name it will load a ~/.docker_env file into the shell | |
# environment and into launchctl | |
# | |
# Added a new var to the mix - DOCKER_HOST_IP | |
function useDockerMachine() { | |
if [ $# -eq 0 ]; then | |
if [ ! -f ~/.docker_env ]; then | |
>&2 printf "Error: No ~/.docker_env file exists. Specify machine to use.\n" | |
return |
This file contains hidden or 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
def tomorrow = new Date() + 1 | |
use (TimeCategory) { | |
def appointment = now + 1.week + 1.days + 15.hours + 10.minutes | |
def monday = new Date().with { it.clearTime(); it - it.calendarDate.dayOfWeek } | |
def recurringWeeklyForYear = (1..52).collect { monday + it.weeks } | |
} |
NewerOlder