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
DO $$ | |
DECLARE | |
start_lsn pg_lsn; | |
end_lsn pg_lsn; | |
wal_bytes_diff numeric; | |
time_diff numeric; | |
bytes_per_second numeric; | |
start_time timestamp; | |
end_time timestamp; | |
BEGIN |
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 | |
# preferences | |
# set DEBUG to "-v" or "" -- it will | |
# 1. activate shell tracing | |
# 2. be passed to curl as an argument | |
if [ -z "$DEBUG" ]; | |
then |
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
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
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
document.querySelectorAll('[role="checkbox"][aria-checked="false"]').forEach(x => x.click()) |
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
(function(){ | |
var hideIfMatches = (matcher) => (node) => { | |
if(node.querySelector(".file-header").getAttribute("data-path").match(matcher)) | |
node.style.display = "none" | |
} | |
var fileNodes = document.querySelectorAll("#files .file") | |
var matcher = RegExp(prompt("Hide files when path matches regex:", "^reference.*")) | |
fileNodes.forEach(hideIfMatches(matcher)) | |
})() |
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
case class Foo ( | |
fooInt: Int, | |
fooString: String | |
) | |
val theFoos = Seq( | |
Foo(0, "hello"), | |
Foo(1, "goodbye"), | |
Foo(2, "") | |
) |
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
import org.scalatest.FunSpec | |
class ScopedSpec extends FunSpec { | |
trait SpecScope { | |
val x = 1 | |
} | |
implicit val scopeConstructor = ScopeFactory(new SpecScope {}) |
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
import java.util.UUID | |
// given this machinery | |
trait Translator[-I, +O] { | |
def translate(i: I): O | |
} | |
object TypeProjector { | |
implicit class Translatable[T](i: T) { | |
def project[U](implicit translator: Translator[T, U]): U = translator.translate(i) |
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
import scala.concurrent.Future | |
implicit val ec = scala.concurrent.ExecutionContext.global | |
def future(name: String): Future[String] = { | |
println(s"constructing $name") | |
Future { | |
Thread.sleep(1000) | |
println(s"resolved $name") | |
name |
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 | |
# | |
# preferences | |
# set DEBUG to "-v" or "" -- it will | |
# 1. activate shell tracing | |
# 2. be passed to curl as an argument | |
if [ -z "$DEBUG" ]; |
NewerOlder