Skip to content

Instantly share code, notes, and snippets.

View niwinz's full-sized avatar

Andrey Antukh niwinz

View GitHub Profile
@niwinz
niwinz / PROMPT.md
Created April 30, 2026 09:11
Prompt: Migrate a Legacy UI Component to Modern Syntax

Migrate a Legacy UI Component to Modern Syntax

You are migrating ONE legacy ClojureScript React component in the Penpot frontend (frontend/src/app/main/ui/) to the modern component syntax. Perform the migration step by step for a single component only.

Context

Legacy components:

  • Name does NOT end with * (e.g., my-component)
  • Defined with (mf/defc my-component ...)
  • Often use ::mf/wrap-props false (props passed as raw JS object)
@niwinz
niwinz / objects_map2.clj
Last active September 26, 2025 08:54
Neested serialization strategy based map (TransitMap, ObjectsMap)
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) KALEIDOS INC
(ns app.common.types.objects-map2
"Implements a specialized map-like data structure for store an UUID =>
OBJECT mappings. The main purpose of this data structure is be able
to serialize it on fressian as byte-array and have the ability to
@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";