Skip to content

Instantly share code, notes, and snippets.

View xvaara's full-sized avatar

Jukka Raimovaara xvaara

View GitHub Profile
xvaara / delete_by_segmentby.sql
Created October 12, 2022 09:22
timescaledb delete from compressed hypertable with segmentby
View delete_by_segmentby.sql
CREATE OR REPLACE FUNCTION delete_segmentby(_tbl regclass, _col varchar, _id anyelement, OUT result integer)
_schema varchar := (SELECT nspname
FROM pg_catalog.pg_class AS c
JOIN pg_catalog.pg_namespace AS ns
ON c.relnamespace = ns.oid
WHERE c.oid = _tbl);
_table_name varchar := (
xvaara / lazy-component.vue
Created September 13, 2022 03:26
vue lazy componennt
View lazy-component.vue
minWidth: '1px',
minHeight: '1px',
<slot v-if="show" />
xvaara / memory-stats.vue
Last active November 10, 2021 14:32
monitor v8 memory usage in chrome based browsers.
View memory-stats.vue
<div ref="el" class="stats" :style="style">
<div class="memory">
Mem: {{ memory }}
<svg :viewBox="'0 0 60 '+chartHeight" class="chart" :style="'height: ' + chartHeight + 'px;'">
xvaara / postgraphiql.ts
Last active October 28, 2021 06:06
Dark mode for PostgraphiQL
View postgraphiql.ts
const graphiqlBrandingTweak = {
["postgraphile:graphiql:html"](html: string) {
console.log("Applying GraphiQL Branding Tweak...");
return html.replace(
`<style type="text/css">
@media (prefers-color-scheme: dark) {
html {
filter: invert(1) hue-rotate(180deg);
xvaara / apollo.js
Last active November 8, 2020 19:28
View apollo.js
const ROOT_URL = process.env.ROOT_URL;
const httpEndpoint = `${ROOT_URL}/graphql`;
export default (context) => {
// console.log("apollo", context);
return {
httpEndpoint: httpEndpoint,
headers: { "CSRF-Token": context.$config.token }
xvaara / bencmark.sql
Created September 19, 2018 19:10
Benchmark PL/pgSQL, PL/v8, PL/lua-ng
View bencmark.sql
DROP TABLE IF EXISTS accumulator_lua;
CREATE TABLE accumulator_lua (id BIGSERIAL PRIMARY KEY, new_value INT, sum_previous INT);
DROP TABLE IF EXISTS accumulator_lua_pre;
CREATE TABLE accumulator_lua_pre (id BIGSERIAL PRIMARY KEY, new_value INT, sum_previous INT);
DROP TABLE IF EXISTS accumulator_v8;
CREATE TABLE accumulator_v8 (id BIGSERIAL PRIMARY KEY, new_value INT, sum_previous INT);
DROP TABLE IF EXISTS accumulator_plpgsql;
xvaara / index_stats.sql
Last active October 14, 2017 23:13
TimescaleDB index stats
View index_stats.sql
con.consrc as chunk_constraint,
c.reltuples AS num_rows,
pg_size_pretty(pg_relation_size(quote_ident(t.schemaname)::text || '.' || quote_ident(t.tablename)::text)) AS table_size,
pg_size_pretty(pg_relation_size(quote_ident(t.schemaname)::text || '.' || quote_ident(indexrelname)::text)) AS index_size,
CASE WHEN indisunique THEN 'Y'
xvaara /
Created February 23, 2017 23:21

Keybase proof

I hereby claim:

  • I am xvaara on github.
  • I am xvaara ( on keybase.
  • I have a public key ASDqYcEr-yFp4UUtT9Uo_oBL7UHluZSaFJduF0VKPa_wLwo

To claim this, I am signing this object:

xvaara / output.txt
Created April 8, 2012 08:34
my output from wg8 install
View output.txt
Linux debian 2.6.32-5-amd64 #1 SMP Thu Mar 22 17:26:33 UTC 2012 x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun Apr 8 10:27:03 2012
xvaara /
Created April 6, 2012 10:33
install webgui 8 on debian stable
# run on a clean debian stable
# install webgui 8, using my little tweaks to get things going.
# xdanger
#percona mysql 5.5
gpg --keyserver hkp:// --recv-keys 1C4CBDCDCD2EFD2A
gpg -a --export CD2EFD2A | apt-key add -
echo "deb squeeze main" >> /etc/apt/sources.list