Instantly share code, notes, and snippets.

printf '%s\n' "$NEW_IDS" | ssh "$@" "
umask 077 ;
mkdir -p .ssh && cat >> .ssh/authorized_keys || exit 1 ;
if type restorecon >/dev/null 2>&1 ; then restorecon -F .ssh .ssh/authorized_keys ; fi"
View create_logback_appenders.groovy
def tmpl = {
<appender name="${it.toUpperCase()}_FILE"
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>\${LOG_PATH}/old/${it.toLowerCase()}_%d{yyyy-MM-dd, aux}/${it.toLowerCase()}.%d{yyyy-MM-dd-HH}.gz</fileNamePattern>

curl often used options

  • -X {method} where method is {GET,POST,HEAD,etc.} (Default: GET)
  • -v verbose mode
  • -o to_file/-O save output to_file or use server-provided filename
    • -J use filename from header
  • -L follow Location header when 3xx code returns
  • -#/--progress-bar use simple progress bar (single-line) instead of default download info
  • -s silent mode
interface DemoInterface {
HelloMsg sayHelloImpl(AddresseeRequest request);
@RequestMapping(value = "/hello")
default HelloMsg sayHello(@RequestBody AddresseeRequest request) {
return sayHelloImpl(request);
##### ea - alias for editing aliases
#When setting up a new aliases file, or having creating a new file.. About every time after editing an aliases file, I source it. This alias makes editing alias a
#bit easier and they are useful right away. Note if the source failed, it will not echo "aliases sourced".
#Sub in gedit for your favorite editor, or alter for ksh, sh, etc.
alias ea='gedit ~/.bash_aliases; source ~/.bash_aliases && source $HOME/.bash_aliases && echo "aliases sourced --ok."'
View pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation=""
View completable_futures_allOf_example.groovy
import groovy.transform.Canonical
import java.util.concurrent.CompletableFuture
import java.util.function.Function
import java.util.function.Supplier
final long serviceExecutionTime = 1000
def rand = new Random()
def initVal = rand.nextInt(100)
View completable-futures.groovy
import java.util.concurrent.CompletableFuture
import java.util.concurrent.TimeUnit
import java.util.function.Supplier
Supplier treeItemSupp = { sleep(50); '`treeItem`' }
Supplier eventItemSupp = { sleep(100); ' `event`'; new RuntimeException('bam!') }
Supplier l10nItemSupp(String treeItem) { return {sleep(200); " `l10n($treeItem)`"} as Supplier }
.thenCompose({ str ->
View pom.xml
View table.filter.lua
-- table.filter({"a", "b", "c", "d"}, function(o, k, i) return o >= "c" end) --> {"c","d"}
-- @FGRibreau - Francois-Guillaume Ribreau
-- @Redsmin - A full-feature client for Redis
table.filter = function(t, filterIter)
local out = {}
for k, v in pairs(t) do
if filterIter(v, k, t) then out[k] = v end