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
function dumpGlobalVars() { | |
// usage: echo "<pre>".json_encode(dumpGlobalVars())."</pre>"; | |
// you may want to base64_encode($json) | |
// !!! WARNING: the result may contain sensitive data. prefer logging over echo to stdout !!! | |
$d=(array)$GLOBALS; | |
$removedFromSerializationText="***REMOVED_FROM_SERIALIZATION***"; | |
$d["_GET"]=$removedFromSerializationText; | |
$d["_POST"]=$removedFromSerializationText; | |
$d["_REQUEST"]=$removedFromSerializationText; | |
$d["_SERVER"]=$removedFromSerializationText; |
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
# list databases | |
$ SELECT datname FROM pg_database WHERE datistemplate = false; | |
# use database FOO_DB | |
$ \connect FOO_DB; | |
# list tables | |
$ \dt | |
# SELECT FROM TABLE | |
$ SELECT * FROM YOUR_TABLE; |
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
# see: https://kubernetes.io/docs/user-guide/kubectl-cheatsheet/ | |
brew upgrade kubernetes-cli | |
brew list kubectl --versions | |
brew info kubectl | |
brew switch kubectl 1.7.5 | |
# get current context | |
$ kubectl config current-context | |
# change current context |
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
@ActiveProfiles("test") | |
abstract class AbstractTest { | |
@Rule | |
val springMethodRule = SpringMethodRule() | |
companion object { | |
@ClassRule | |
val SPRING_CLASS_RULE = SpringClassRule() | |
} | |
} |
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
// https://github.com/ufoscout/docker-compose-wait | |
#!/bin/bash | |
set -e | |
timeout=${WAIT_HOSTS_TIMEOUT:-30} | |
waitAfterHosts=${WAIT_AFTER_HOSTS:-0} | |
waitBeforeHosts=${WAIT_BEFORE_HOSTS:-0} | |
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.List; | |
import java.util.Stack; | |
import java.util.stream.Collectors; | |
import java.util.stream.Stream; | |
public class StringMatcherApp { | |
public static void main(String[] args) { | |
String[] source = {"{}[]()", "{]}]"}; | |
System.out.println("source ..."); |
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
object SequenceExtensions | |
inline fun <T, R : Comparable<R>> Sequence<T>.sortedByDirection( | |
descending: Boolean, | |
crossinline selector: (T) -> R? | |
): Sequence<T> { | |
val comparator = if (descending) { | |
compareByDescending(selector) | |
} else { | |
compareBy(selector) |
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
package com.seb.util | |
import com.fasterxml.jackson.core.type.TypeReference | |
import com.fasterxml.jackson.databind.ObjectMapper | |
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper | |
import java.util.HashMap | |
object JsonUtil { |
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
class Hash | |
def map_kv(&block) | |
result_hash = Hash.new() | |
for k,v in self | |
result_item=block.call(k,v) | |
result_hash[result_item.fetch("key")]=result_item.fetch("value") | |
end | |
return result_hash | |
end | |
def map_v(&block) |
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
package com.example.util | |
import groovy.transform.CompileStatic | |
import groovy.transform.TypeChecked | |
import java.time.* | |
import java.time.format.DateTimeFormatter | |
@CompileStatic | |
@TypeChecked |