Skip to content

Instantly share code, notes, and snippets.

Erlang honors cgroup CPU quota from Erlang 23. But when less than 1 CPU is used, schedulers_online will be cores number(see below k8s 0-5).

docker

$ docker run --rm -it --cpu-period 100000 --cpu-quota 100000 erlang:23 bash
root@3f793576001a:/# erl
Erlang/OTP 23 [erts-11.0.2] [source] [64-bit] [smp:4:1] [ds:4:1:10] [async-threads:1] [hipe]
@vishal2376
vishal2376 / FlipAnimation.kt
Created April 25, 2024 17:16
Card Flip Animation using Jetpack Compose
package com.vishal2376.animations.ui.theme
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.EaseInOut
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
@erratir
erratir / popup.js
Last active April 27, 2024 03:20
CromeExtension popup.js: Отправляет сообщение в контент скрипт
/**
* Отправляет сообщение в контент скрипт.
* Вызвается из обработчика (например клик по кнопке), на вход принимает событие evt из которого получаем evt.target.id
* Т.е. индентифицируем кнопку на которой произошло событие и отправляем и ее id в качестве темы сообщения
* В content.js соответсвенно добавляем слушатель:
* chrome.runtime.onMessage.addListener((msg, sender, response) => { // тут код if (msg.subject === ..) });
* @param {event} evt
* @return {Promise<void>}
*/
let sendMsgToContent = async function (evt) {
// ==UserScript==
// @name Photopea Premium
// @namespace http://tampermonkey.net/
// @version 2024-02-03
// @description Unlock Photopea Premium by patching their JS
// @author mat
// @match https://www.photopea.com/
// @match https://www.photopea.com/?utm_source=homescreen
// @icon https://www.google.com/s2/favicons?sz=64&domain=photopea.com
// @grant GM_webRequest
@erratir
erratir / MVC.js
Last active April 27, 2024 03:19
MVC (Model-View-Controller) pattern example https://codepen.io/erratir/pen/aboqxKZ
// https://codepen.io/erratir/pen/aboqxKZ
// MVC — Controller — создает модель и отображение и знакомит их между собой, дальше модель и отображение общаются напрямую
// user-view.js
const render = (html) => {
const element = document.createElement(`div`);
element.innerHTML = html;
return element;
};
@erratir
erratir / MVP_example.js
Last active April 27, 2024 03:18
MVP (Model-View-Presenter) pattern example https://codepen.io/erratir/pen/xxKYevd
// https://codepen.io/erratir/pen/xxKYevd
// MVP — Presenter — создает модель и отображение, после чего отвечает за связывание их между собой:
// слушает изменения в каждом из них и вызывает обновления
// user-view.js
const render = (html) => {
const element = document.createElement(`div`);
element.innerHTML = html;
return element;
};
@erratir
erratir / index.html
Last active April 27, 2024 03:18
Event Emitter - паттерн: https://codepen.io/erratir/pen/dybEVPO
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
<input type="text">
@weibeld
weibeld / telegram-api.pdf
Last active April 27, 2024 03:18
Telegram CLI Commands
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@patshaughnessy
patshaughnessy / gist:70519495343412504686
Last active April 27, 2024 03:11
How to Debug Postgres using LLDB on a Mac
This note explains how to build Postgres from source and setup to debug it using LLDB on a Mac. I used this technique to research this article:
http://patshaughnessy.net/2014/10/13/following-a-select-statement-through-postgres-internals
1. Shut down existing postgres if necessary - you don’t want to mess up your existing DB or work :)
$ ps aux | grep postgres
pat 456 0.0 0.0 2503812 828 ?? Ss Sun10AM 0:11.59 postgres: stats collector process
pat 455 0.0 0.0 2649692 2536 ?? Ss Sun10AM 0:05.00 postgres: autovacuum launcher process
pat 454 0.0 0.0 2640476 304 ?? Ss Sun10AM 0:00.74 postgres: wal writer process
pat 453 0.0 0.0 2640476 336 ?? Ss Sun10AM 0:00.76 postgres: writer process
@angelblasco
angelblasco / Estructura PL_SQL
Last active April 27, 2024 03:11
Plantillas PL/SQL
DECLARE
/* aqui van las variables */
BEGIN
/* estructura del programa, sentencias SQL */
EXCEPTION
/* manejo de excepciones */
END;
/* final del bloque */