Skip to content

Instantly share code, notes, and snippets.

select pid,
usename,
pg_blocking_pids(pid) as blocked_by,
query as blocked_query
from pg_stat_activity
where cardinality(pg_blocking_pids(pid)) > 0;
@hotzen
hotzen / pom.xml
Last active August 22, 2022 09:22
example pom to package one jar including pre-supplied jar-dependencies - uses https://gist.github.com/hotzen/2da60295a410589078086b7f06af3fee
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>VENDOR</groupId>
<artifactId>foobar</artifactId>
<version>3.6</version>
<name>FOOBAR</name>
<properties>
@hotzen
hotzen / assembly.xml
Last active August 22, 2022 09:23
include pre-supplied jar files in maven-assembly-plugin - to be used in conjunction with https://gist.github.com/hotzen/d4667f4a7109f03b008d73e60f8e41d9
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>jar-with-system-dependencies</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
test("boxBlurKernel should return the correct value on an interior pixel " +
"of a 3x3 image with radius 1") {
val src = new Img(3, 3)
src(0, 0) = 0; src(1, 0) = 1; src(2, 0) = 2
src(0, 1) = 3; src(1, 1) = 4; src(2, 1) = 5
src(0, 2) = 6; src(1, 2) = 7; src(2, 2) = 8
def check(x: Int, y: Int, expected: Int) =
assertResult(expected, s"boxBlurKernel($x, $y, 1)")( boxBlurKernel(src, x, y, 1) )