Skip to content

Instantly share code, notes, and snippets.

package org.jooq.mcve.test.java;
import lombok.SneakyThrows;
import lombok.experimental.UtilityClass;
import org.jooq.*;
import org.jooq.impl.*;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Blackhole;
@juriad
juriad / gist:5dc32e82f450121973f4eaf1e1ed125b
Created August 20, 2021 13:26
Long slow anomaly query
select now() - query_start, *
from pg_stat_activity
where state = 'active';
select pg_terminate_backend(pid)
from pg_stat_activity
where state = 'active'
and now() - query_start > '10 sec';
@juriad
juriad / index.js
Created May 28, 2021 02:33
Bulls and Cows index.js compatible alternative
function randomUnique(set, delka) {
if (delka > set.length) {
throw new Error("Cannot generate that many unique characters.");
}
const arr = [...set];
for (let i = 0; i < delka; i++) {
const r = i + Math.floor(Math.random() * (set.length - i));
[arr[i], arr[r]] = [arr[r], arr[i]];
}
return arr.slice(0, delka);
@juriad
juriad / Gradle
Created October 18, 2019 21:36
Consistent-versions with test fixtures
------------------------------------------------------------
Gradle 5.6.2
------------------------------------------------------------
Build time: 2019-09-05 16:13:54 UTC
Revision: 55a5e53d855db8fc7b0e494412fc624051a8e781
Kotlin: 1.3.41
Groovy: 2.5.4
@juriad
juriad / Alert
Created June 8, 2018 08:58
Chyba odeslání příspěvku
Chyba v JSONu.
adam@AJURASZEK:~/Downloads/update> diff update update_25/
Common subdirectories: update/cc3200 and update_25/cc3200
Common subdirectories: update/html and update_25/html
Common subdirectories: update/main and update_25/main
diff -W 183 update/sys.bin update_25/sys.bin
1c1
< 3101 003 001 001
---
> 3102 004 001 001
AJURASZEK:/home/adam # ntpdate -d time-a.nist.gov
15 Apr 10:00:35 ntpdate[19134]: ntpdate 4.2.8p11@1.3728-o (1)
Looking for host time-a.nist.gov and service ntp
129.6.15.28 reversed to time-a-g.nist.gov
host found : time-a-g.nist.gov
transmit(129.6.15.28)
transmit(129.6.15.28)
transmit(129.6.15.28)
transmit(129.6.15.28)
transmit(129.6.15.28)
@juriad
juriad / board.py
Created August 5, 2017 19:36
Game board update
def create_board(root, images, handler):
board = ttk.LabelFrame(root, text="Board")
handler = partial(handler, setter)
setters = [None] * 28
create_sub_board(board, images, 0, 13, 12, handler, setters)
setters[0] = create_stack_top(board, images, 7, partial(handler, 'bar', 'w'))
setters[25] = create_stack_bottom(board, images, 7, partial(handler, 'bar', 'b'))
@juriad
juriad / Various dialects
Last active April 13, 2017 09:15
Hibernate Lob
build/output/ddl.org.hibernate.dialect.Cache71Dialect.sql: create table "x" (
build/output/ddl.org.hibernate.dialect.Cache71Dialect.sql- "id" BigInt not null,
build/output/ddl.org.hibernate.dialect.Cache71Dialect.sql- "b" longvarbinary null,
build/output/ddl.org.hibernate.dialect.Cache71Dialect.sql- "c" varchar(255) null,
build/output/ddl.org.hibernate.dialect.Cache71Dialect.sql- "lb" longvarbinary null,
build/output/ddl.org.hibernate.dialect.Cache71Dialect.sql- "lc" longvarchar null,
build/output/ddl.org.hibernate.dialect.Cache71Dialect.sql- "ls" longvarchar null,
build/output/ddl.org.hibernate.dialect.Cache71Dialect.sql- "nlc" nclob null,
build/output/ddl.org.hibernate.dialect.Cache71Dialect.sql- "nls" nclob null,
build/output/ddl.org.hibernate.dialect.Cache71Dialect.sql- "s" varchar(255) null,
@juriad
juriad / graphml.py
Created March 26, 2017 19:53
Graph with Meta
from enum import Enum
class MetaItem(type):
def __new__(cls, name, bases, namespace, **kwds):
def named_adder(k):
def adder(self, val):
getattr(self, k).append(val)
val.set_parent(self)
return adder
def named_setter(k):