Skip to content

Instantly share code, notes, and snippets.

View niwinz's full-sized avatar

Andrey Antukh niwinz

View GitHub Profile
@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 / test-tuple.cpp
Created September 15, 2012 19:42
Boost.Python converter for C++ tuple
// Compile with:
// clang++ -std=c++11 -shared -l boost_python3 -I /usr/include/python3.2mu -fPIC -o bptuple.so tuple-test.cpp
#include <tuple>
#include <string>
#include <boost/python.hpp>
namespace py = boost::python;
using std::string;
@niwinz
niwinz / dinamic_inheritance.py
Created September 6, 2012 10:24
Dynamic Inheritance with python3
class DynamicInheritance(type):
"""
Dinamicaly modify class with some extra mixins.
"""
def __call__(cls, *args, **kwargs):
_mixins = kwargs.pop("_mixins", None)
if _mixins:
assert isinstance(_mixins, tuple), "_mixin patemeter must be a tuple"
@niwinz
niwinz / express.cljs
Created December 26, 2014 16:16
Lightweight sugar syntax for expressjs with clojurescript.
(ns express
"Ligweight interface to requirejs."
(:refer-clojure :exclude [set get])
(:require [cljs.nodejs :as node]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(def ^{:doc "Global express import."
@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);