Skip to content

Instantly share code, notes, and snippets.

View niwinz's full-sized avatar

Andrey Antukh niwinz

View GitHub Profile
@niwinz
niwinz / native-mem-tracking.md
Created March 7, 2023 12:41 — forked from prasanthj/native-mem-tracking.md
Native memory tracking in JVM

Enable native memory tracking in JVM by specifying the following flag

-XX:NativeMemoryTracking=detail

Know the <PID> of the java process

jps

To print ps based RSS

ps -p <PID> -o pcpu,rss,size,vsize

To print native memory tracking summary

@niwinz
niwinz / docker-compose.yml
Last active December 22, 2022 15:24
New Penpot docker-compose (in-development)
---
version: "3.5"
networks:
penpot:
volumes:
penpot_postgres_v15:
penpot_assets:
# penpot_traefik:
(ns user
(:require
[clojure.tools.namespace.repl :as r]
[clojure.core.async :as a]
[promesa.core :as p]
[promesa.exec :as px]
[promesa.exec.csp :as sp]
[promesa.protocols :as pt]
[promesa.util :as pu])
(:import
@niwinz
niwinz / README.md
Last active October 13, 2022 11:20
WASM experiments

README

How to compile:

clang example.c --target=wasm32 -O3 -msimd128 -nostdlib -Wl,--export-all -Wl,--no-entry -Wl,--allow-undefined --output example.wasm

How to run:

@niwinz
niwinz / broadcast-channel-es6.js
Created October 5, 2022 06:14 — forked from alexis89x/broadcast-channel-es6.js
Broadcast Channel API polyfill
/**
@class BroadcastChannel
A simple BroadcastChannel polyfill that works with all major browsers.
Please refer to the official MDN documentation of the Broadcast Channel API.
@see <a href="https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API">Broadcast Channel API on MDN</a>
@author Alessandro Piana
@version 0.0.6
*/
/*
@niwinz
niwinz / test.sql
Created September 27, 2022 12:18
Linked List in PostgreSQL (using recursive queries)
DROP TABLE task;
CREATE TABLE task (id bigint not null, parent_id bigint null);
-- Create many unrelated linked lists in the same table
INSERT INTO task values (1, null);
INSERT INTO task (id, parent_id)
SELECT i, i-1 FROM generate_series(2, 50000) AS t(i);
INSERT INTO task values (50001, null);
@niwinz
niwinz / uuidv7.c
Created July 28, 2022 20:30 — forked from fabiolimace/uuidv7.c
UUID v7 for C
#include <time.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/random.h>
#define UUID_T_LENGTH (16)
#define UNIX_TS_LENGTH (6)
#!/usr/bin/env bash
set -x
DOCKER_CLI_EXPERIMENTAL=enabled
ORG=${PENPOT_DOCKER_NAMESPACE:-penpotapp};
PLATFORM=${PENPOT_BUILD_PLATFORM:-linux/amd64};
IMAGE=${1:-backend};
DOCKER_IMAGE="$ORG/$IMAGE";
OPTIONS="--platform $PLATFORM -t $DOCKER_IMAGE:$PENPOT_BUILD_BRANCH";
@niwinz
niwinz / aws-ebs-test.md
Last active November 2, 2023 15:32
EBS Benchmark (gp3 vs gp2, and st1 just for comparison).

EBS Volume Type Benchmark

Tested volumes:

  • /dev/nvme1n1 (type: st1, size: 125gb, defaults)
  • /dev/nvme2n1 (type: gp3, size: 15gb, iops:3000, tp: 125MB/s)
  • /dev/nvme3n1 (type: gp2, size: 15gb, defaults (iops:100 burstable until 3000))

All volumes created from scrach, no gp2->gp3 conversion.

@niwinz
niwinz / java-signals-test.sh
Created October 21, 2020 07:32 — forked from nicoulaj/java-signals-test.sh
What signals can your JRE handle ?
#!/bin/bash
# Get temp dir
tmpdir=$(mktemp -d)
# Generate test
cat > ${tmpdir}/ListenToSignal.java <<EOF
import sun.misc.Signal;
import sun.misc.SignalHandler;
public class ListenToSignal {