Skip to content

Instantly share code, notes, and snippets.

View ulidtko's full-sized avatar
💬
Organically produced code, hand-written no AI, minimal carbon footprint.

Maxim Ivanov ulidtko

💬
Organically produced code, hand-written no AI, minimal carbon footprint.
View GitHub Profile
@ulidtko
ulidtko / repr.js
Last active October 29, 2023 12:22 — forked from soapie/repr.js
A repr function for JS
'use strict';
/* Python-like repr() formatter for JS types, with recursion limit. */
/* Adapted from https://gist.github.com/soapie/6407618 */
function repr(x, max, depth) {
var ELIDED = "[..]";
if (depth === undefined) depth = 0;
if (max === undefined) max = 2;
if (isPrim(x))
return showPrim(x);
if (typeof x === 'function')
@ulidtko
ulidtko / http-watchdog-wrapper
Last active February 6, 2024 17:49
systemd WatchDog pinging HTTP healthcheck
#!/usr/bin/env python3
"""
https://gist.github.com/ulidtko/fdd7222bd7e85480fa201614fbc42faf
"""
import os
import subprocess
import sys
from time import sleep
from urllib.error import URLError
@ulidtko
ulidtko / fetch-aws-ecs-env.py
Created July 20, 2023 10:42
Fetch env-file from AWS ECS Service TD (Task Definition)
#!/usr/bin/env python3
import argparse
import datetime
import sys
import os.path
import boto3
import jinja2
@ulidtko
ulidtko / README.md
Last active May 17, 2022 11:03
Cinnamon 5.2.7 pagefaults lag

Since ~beginning of May 2022, the following symptom appeared.

After roughly a day of uptime, system exhibits pretty heavy lag: ~1s freeze every couple seconds. Input handling pauses (apart from hw cursor); extremely annoying.

That's on linux-lts 5.15.39-1.

Finding 1: dstat --vm shows exorbitant bursts of minor pagefaults (minpf), 61k per second, which correlate perfectly with the lag. Background level is tens to hundreds.

# Oh come on! It's 2020! Stop freezing on OOM, you *clumsy penguin* !
kernel.sysrq = 244
# = 128+64+32+16 +4
# 256+128+64+32+16+8+4+2+1
# ^ ^ ^ ^ ^ ^ ^ ^ ^
# | | | | | | | | |
# | | | | | | | | | 0 - disable every SysRq function.
# | | | | | | | | `- 1 - enable every SysRq function.
# | | | | | | | `--- 2 - enable control of console logging level
@ulidtko
ulidtko / Cargo.toml
Last active December 23, 2020 18:59
[package]
name = "foobar"
version = "0.1.0"
authors = ["max ulidtko <[email protected]>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rand = "0.8.*"

Keybase proof

I hereby claim:

  • I am ulidtko on github.
  • I am ulidtko (https://keybase.io/ulidtko) on keybase.
  • I have a public key ASAr8VkzXINuO7wo76vlXNnbteMe5ZwB9xq-bH4KOtigVQo

To claim this, I am signing this object:

@ulidtko
ulidtko / README.md
Last active August 14, 2020 10:16
Java TLS echo server

Dummy echo server with TLS in Java.

Usage

git clone https://gist.github.com/ulidtko/f44360b0ac15dd7d42e21de6b964ace5 java-tls-echoserv
cd java-tls-echoserv
javac TlsEchoServer.java
java TlsEchoServer 9011 ./java-pleasure.jks 123456 123456

#-- or, with verbose debug dump of the handshake:

@ulidtko
ulidtko / 20ms-GCidle-annotated-1kRPS.png
Last active July 2, 2020 16:02
GHC waiting on DB during GC
20ms-GCidle-annotated-1kRPS.png
#!/usr/bin/env python3
import argparse
import socket
import struct
from time import sleep
FRAG1 = b"""HTTP/1.0 200 OK\r
Server: netcat\r
Content-Type: text/plain\r