Skip to content

Instantly share code, notes, and snippets.

@pragmasoft-ua
pragmasoft-ua / dialog.html
Created July 21, 2023 15:23
dialog deep linking
<!DOCTYPE html>
<html lang="en">
<head>
<title>Dialog demo</title>
<script type="module">
/**
* @param url URL | Location
* @returns HTMLDialogElement | undefined
*/
function currentDialog(url) {
@pragmasoft-ua
pragmasoft-ua / settings.json
Last active June 9, 2023 10:10
Graalvm native compilation: Open VSCode settings, search terminal.integrated.profiles.windows, add the following to allow native build tools shell
"x64 Native Tools VS 2019": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [
"/d",
"/k",
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat",
"amd64"
const {BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend} = Recharts;
const data = [
{name: 'Page A', uv: 4000, pv: 2400, amt: 2400},
{name: 'Page B', uv: 3000, pv: 1398, amt: 2210},
{name: 'Page C', uv: 2000, pv: 9800, amt: 2290},
{name: 'Page D', uv: 2780, pv: 3908, amt: 2000},
{name: 'Page E', uv: 1890, pv: 4800, amt: 2181},
{name: 'Page F', uv: 2390, pv: 3800, amt: 2500},
{name: 'Page G', uv: 3490, pv: 4300, amt: 2100},
];
const {BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend} = Recharts;
const data = [
{name: 'Page A', uv: 4000, pv: 2400, amt: 2400},
{name: 'Page B', uv: 3000, pv: 1398, amt: 2210},
{name: 'Page C', uv: 2000, pv: 9800, amt: 2290},
{name: 'Page D', uv: 2780, pv: 3908, amt: 2000},
{name: 'Page E', uv: 1890, pv: 4800, amt: 2181},
{name: 'Page F', uv: 2390, pv: 3800, amt: 2500},
{name: 'Page G', uv: 3490, pv: 4300, amt: 2100},
];
create table timetest(a timestamp, b timestamp);
insert into timetest values(TIMESTAMP WITH TIME ZONE '2017-03-01 01:00:00+00', TIMESTAMP WITH TIME ZONE '2017-03-01 03:00:00+02');
select * from timetest where a = b;
a | b
---------------------+---------------------
2017-03-01 03:00:00 | 2017-03-01 03:00:00
(1 row)
select extract(timezone from a), a, extract(timezone from b), b from timetest where a = b;
ERROR: timestamp units "timezone" not supported
drop table timetest;
@pragmasoft-ua
pragmasoft-ua / psql_tstzrange_example.sql
Created March 3, 2017 14:32
postgresql tstzrange, conversion and distinct
create table seat_day (activated tstzrange);
create index activated_idx on seat_day using gist(activated);
insert into seat_day values('[2017-03-03 14:30, 2070-03-03 15:30]');
insert into seat_day values('[2017-03-06 15:30, 2070-03-06 16:30]');
insert into seat_day values('[2017-03-08 16:00, 2070-03-08 17:00]');
insert into seat_day values('[2017-03-10 14:30, 2070-03-10 15:30]');
with activated as
@pragmasoft-ua
pragmasoft-ua / docker_events.sh
Last active May 6, 2020 23:59 — forked from freshjones/gist:b0713263033df8cc9f44
bash script to monitor and do something with docker events
#!/bin/sh
docker events --filter 'event=start' --filter 'event=stop' | while read event
do
container_id=`echo $event | sed 's/.*Z\ \(.*\):\ .*/\1/'`
echo $container_id