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
cat >/tmp/demo-space-separated.sh <<'EOF' | |
#!/bin/bash | |
POSITIONAL=() | |
while [[ $# -gt 0 ]] | |
do | |
key="$1" | |
case $key in | |
-e|--extension) |
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
#!/usr/bin/env bash | |
# Mandatory: apt install nvme-cli | |
# Mount point (directory) | |
TARGET_MOUNT=/data/tmp | |
# Raid info | |
TARGET_RAID_DEVICE=/dev/md0 | |
TARGET_RAID_LABEL=RAID0 |
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 | |
killall Xcode | |
xcrun -k | |
xcodebuild -alltargets clean | |
dirs = ("$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache" | |
"$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache" | |
/Applications/Xcode.app | |
~/Library/Caches/com.apple.dt.Xcode |
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
#!/usr/bin/env bash | |
#################################################################################### | |
# Slack Bash console script for sending messages. | |
#################################################################################### | |
# Installation | |
# $ curl -s https://gist.githubusercontent.com/andkirby/67a774513215d7ba06384186dd441d9e/raw --output /usr/bin/slack | |
# $ chmod +x /usr/bin/slack | |
#################################################################################### | |
# USAGE | |
# Send message to slack channel/user |
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
# Add path permanently to environment machine | |
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\bin", "Machine") | |
# Add path permanently to environment user | |
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\bin", "User") |
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
cmd /c mklink "$LOCALAPPDATA\Microsoft\WindowsApps\edit" "C:\Program Files (x86)\Notepad++\notepad++.exe" |
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
// val e = (1 to 10 toList).mkString(",") | |
import org.apache.spark.sql.types._ | |
import org.apache.spark.sql.types.{DoubleType, StringType, StructField, StructType} | |
import org.apache.spark.sql.{Row, SparkSession} | |
// 2019-12-10 16:06:40,135 cask datab 0012 REST TRACE [com.kortlet.IEnferinend] (ajp-/192.168.0.1:8009-77) Invoke End | |
val regexRestBase = """(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2},\d{3})[\s\t]+(\w+)[\s\t]+(\w+)[\s\t]+(\d+)[\s\t]+(\w+)[\s\t]+(\w+)[\s\t](\[[\w\.]+\])[\s\t]+(\(.*\))[\s\t]+(.*)""".r |
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 | |
LOCAL_DIR=~/ | |
PROGRAM_NAME=my-jar-exe | |
HOST=$(hostname | cut -d "." -f 1) | |
PROGRAM_PIDS=$(jps -v | grep $PROGRAM_NAME | cut -d " " -f 1) | |
function insert_sqlite { | |
FILE=$2 |
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
static <T, E extends Exception> Consumer<T> handlingConsumerWrapper( | |
ThrowingConsumer<T, E> throwingConsumer, Class<E> exceptionClass) { | |
return i -> { | |
try { | |
throwingConsumer.accept(i); | |
} catch (Exception ex) { | |
try { | |
E exCast = exceptionClass.cast(ex); | |
System.err.println( |