This file contains 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
scala> val target = 8; val l = List(1,2,3,4,4) ; (for(x <- l; y <- l) yield { x + y }).exists(_==target) | |
target: Int = 8 | |
l: List[Int] = List(1, 2, 3, 4, 4) | |
res24: Boolean = true |
This file contains 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
# in the instantclient dir with the .so or .dylib files | |
#go to instantclient dir with the .so files and | |
ln -s libclntsh.so.12.1 libclntsh.so | |
#on macos: | |
ln -s libclntsh.dylib.12.1 libclntsh.dylib |
This file contains 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 | |
export APP_ENV=xyztest | |
export SBT_OPTS=" -Dpidfile.path=/dev/null -Dconfig.file=conf/$APP_ENV.conf -Dlogger.resource=logback-${APP_ENV}.xml -Dlogback.configurationFile=conf/logback-${APP_ENV}.xml $SBT_OPTS" | |
sbt "; set fork in run := false ; run-main script.MyFooScript" |
This file contains 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
// Something simple to build a useful exception message and avoid NPE from getCause.getMessage | |
object ExceptionMessageBuilder { | |
def mkExceptionMessage(e: Throwable): String = { | |
e.getCause match { | |
case null => e.getMessage | |
case t: Throwable => s"${e.getMessage} cause:${mkExceptionMessage(t)}" | |
} | |
} |
This file contains 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
\n | |
Request Details:\n | |
url: %{url_effective}\n | |
num_redirects: %{num_redirects}\n | |
content_type: %{content_type}\n | |
response_code: %{response_code}\n | |
remote_ip: %{remote_ip}\n | |
\n | |
Timing Analysis:\n | |
time_namelookup: %{time_namelookup}\n |
This file contains 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
docker run -d --net=host --cap-add SYS_PTRACE \ | |
-v /proc:/host/proc:ro \ | |
-v /sys:/host/sys:ro \ | |
-p 19999:19999 titpetric/netdata |
This file contains 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
# Connect to ruby process | |
gdb `which ruby` <pid> | |
# Run GC | |
p rb_eval_string("GC.start") | |
# Count each Object class | |
p rb_eval_string("$gdb_objs = Hash.new 0") | |
p rb_eval_string("ObjectSpace.each_object {|o| $gdb_objs[o.class] += 1}") | |
p rb_eval_string("$stderr.puts($gdb_objs.inspect)") |