Skip to content

Instantly share code, notes, and snippets.

View tomfun's full-sized avatar

Greg tomfun

  • itrdev
  • ukraine
View GitHub Profile
@tomfun
tomfun / плов.md
Created February 7, 2018 20:12
Рецепт плова по-домашнему

Рецепт Плова

Ингридиенты

  • Казан (3л)
  • Мясо (600г)
  • Рис (300г)
  • Лук
  • Морковь
  • Масло подсолнечное
  • Чеснок
  • Приправы, соль

Article Introduction: Navigating Database Technologies for Hierarchical and Social Network Data Management

Overview

In today's digital landscape, efficient data management is pivotal, especially when dealing with complex structures like trees and graphs. These structures, foundational in computer science, dictate how data is stored, accessed, and manipulated across various platforms, from social networks to organizational systems. This article provides a comprehensive exploration of tree and graph structures and their implementation in different database systems, assessing their effectiveness in contexts ranging from hierarchical data management in traditional databases to sophisticated relationship mapping in graph databases.

Tree and Graph: A Comparative Study of Data Structures

Tree Structure
@tomfun
tomfun / index.js
Last active October 3, 2023 13:02
Print the shape of input with used values
const printValues = (data) => {
const getType = (value) => {
if (Array.isArray(value)) return 'array';
if (null === value) return 'null';
return typeof value;
};
const initResult = () => ({ _type: new Set([]), _values: new Set() })
const updateValues = (result = initResult(), item) => {
const type = getType(item);

end-to-end encryption

In order to use end-to-end encryption, it is enough to use a browser extension - it uses open pgp - open source for encryption and keys and just inserts a button to gmail :)

https://youtu.be/aAXIqnjbc-M?t=106 Mymail-Crypt for Gmail at chrome store

quite radical, simple, but it can fall off :)

there is a more reliable way, but you have to manually encrypt it - another extension

Pessimistic Locking in Node.js with TypeORM

In this article, we will explore pessimistic locking, its main aspects, and how to implement it in Node.js using TypeORM. Pessimistic locking is a strategy to prevent concurrent access to a resource by obtaining exclusive access to the resource before making any changes. This approach ensures that other transactions cannot modify the locked resource until the lock is released.

We will use a practical example to demonstrate how to implement pessimistic locking in a Node.js application using the TypeORM library. Our example will focus on a payment processing scenario, where multiple processes might attempt to update the status of a payment concurrently.

Good ppa`s

  • add-apt-repository ppa:nextcloud-devs/client
  • add-apt-repository ppa:phoerious/keepassxc
  • add-apt-repository ppa:git-core/ppa
  • add-apt-repository ppa:andol/curl-http2

Linux mint base ubuntu table

Mint Ubuntu Proof
@tomfun
tomfun / gen_new_client.sh
Last active June 7, 2023 14:38
how to: tls client nginx
#!/bin/sh
echo $1
echo "optional questions is: A challenge password, An optional company name, Enter Export Password, Enter Import Password"
mkdir -p client/$1
# Create the Client Key and CSR
# личный ключ клиента, только ему самому стоит его знать. если софт поддерживает пассфраз (как ниже), лучше его использовать.
openssl genrsa -des3 -out client/$1/key.key 2048

https://raspberrypi.stackexchange.com/questions/8265/btrfs-root-filesystem-on-raspbian

sudo apt install btrfs-progs initramfs-tools

'btrfs' | sudo tee -a /etc/initramfs-tools/modules

sudo mkdir -p /etc/initramfs-tools/hooks ; sudo mkdir -p /etc/initramfs-tools/scripts/local-premount ; sudo cp /usr/share/initramfs-tools/hooks/btrfs /etc/initramfs-tools/hooks ; sudo cp /usr/share/initramfs-tools/scripts/local-premount/btrfs /etc/initramfs-tools/scripts/local-premount; sudo chmod +x /etc/initramfs-tools/hooks/btrfs /etc/initramfs-tools/scripts/local-premount/btrfs

https://forums.raspberrypi.com/viewtopic.php?t=10532&sid=506b6601ef85b73e2e6cafc95f4636c6&start=50

@tomfun
tomfun / plural.js
Created August 23, 2016 12:31
JavaScript russian plural function
function getNoun(number, one, two, five) {
let n = Math.abs(number);
n %= 100;
if (n >= 5 && n <= 20) {
return five;
}
n %= 10;
if (n === 1) {
return one;
}
@tomfun
tomfun / README.md
Created July 25, 2022 13:18
Пример работы с пайтон проектом