Skip to content

Instantly share code, notes, and snippets.

View leonidkuznetsov18's full-sized avatar
:electron:
stay hungry, stay foolish

Leonid Kuznetsov leonidkuznetsov18

:electron:
stay hungry, stay foolish
View GitHub Profile

Setup multiple git identities & git user informations

/!\ Be very carrefull in your setup : any misconfiguration make all the git config to fail silently ! Go trought this guide step by step and it should be fine 😉

Setup multiple git ssh identities for git

  • Generate your SSH keys as per your git provider documentation.
  • Add each public SSH keys to your git providers acounts.
  • In your ~/.ssh/config, set each ssh key for each repository as in this exemple:
{
"meta": { "theme": "onepage-plus" },
"basics": {
"name": "Леонід Кузнєцов",
"label": "Software Engineer",
"picture": "",
"email": "js.leonid.kuznetsov@gmail.com",
"phone": "",
"url": "https://leonidkuznetsov.now.sh",
"summary": "Я – інженер програмного забезпечення з більш ніж 10-ма роками досвіду в розробці веб додатків/browser extension/mobile apps/SSR/SSE/Hybrid Apps та з пристрастю до фронтенд-розробки, створюю високопродуктивні та зручні у використанні додатки. Мій досвід в UI/UX дизайні та архітектурі дозволив мені працювати над різноманітними проектами, включаючи відеострімінг, крипторозробку, відеочати, системи автопілоту, текстовий аналіз та машинне навчання. Маю магістерський ступінь у галузі комп'ютерних наук і відмінні навички співпраці та комунікації. Вмію знаходити та вирішувати проблеми, налагоджувати та діагностувати помилки, створювати доступні та багаторазові UI. Постійно шукаю можливості для покращення програмних продуктів, роблячи їх простими та ефективним
@leonidkuznetsov18
leonidkuznetsov18 / knn.js
Created December 18, 2022 20:17
KNN algorithm by lodash
const outputs = [
[10, .5, 16, 1],
[200, .5, 16, 4],
[350, .5, 16, 4],
[600, .5, 16, 5],
]
const predictionPoint = 300;
const k = 3
function cropImage(cropMode, sourceWidth, sourceHeight, targetD) {
let result = {};
if (cropMode === 'Fill') {
result.width = targetD;
result.height = targetD;
if (sourceWidth > sourceHeight) {
result.type = 'landscape';
} else if (sourceWidth < sourceHeight) {
result.type = 'portrait';
@leonidkuznetsov18
leonidkuznetsov18 / get_image_size_type.js
Created December 18, 2022 12:05
Get image size type
function getImageSizeType(width, height) {
if (width > height) {
return 'landscape';
} else if (width < height) {
return 'portrait';
} else {
return 'square';
}
}
@leonidkuznetsov18
leonidkuznetsov18 / pdf_to_word.js
Created December 18, 2022 11:48
PDF to Word converter
// Load the PDF as a Blob
const file = await fetch('path/to/pdf.pdf').then(res => res.blob());
// Convert the PDF to a base64-encoded data URI
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => {
const base64 = reader.result;
// Create a new Blob from the data URI
@leonidkuznetsov18
leonidkuznetsov18 / word_to_pdf.js
Created December 18, 2022 11:46
Convert word to pdf
const doc = new jsPDF();
// Load the Word file as a Blob
const file = await fetch('path/to/word.docx').then(res => res.blob());
// Convert the Word file to a base64-encoded data URI
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => {
const base64 = reader.result;
@leonidkuznetsov18
leonidkuznetsov18 / password_generator.js
Created December 18, 2022 11:42
React password generator
import React, { useState } from 'react';
function PasswordGenerator() {
const [password, setPassword] = useState('');
const [length, setLength] = useState(8);
const [includeSpecialCharacters, setIncludeSpecialCharacters] = useState(true);
const [easyToRead, setEasyToRead] = useState(true);
const [easyToSay, setEasyToSay] = useState(true);
function generatePassword() {
@leonidkuznetsov18
leonidkuznetsov18 / detect_standard.js
Last active December 18, 2022 10:43
Detect ETH token standard
async function detectStandard() {
// Check if the contract implements the ERC-20 interface
if (implementsERC20(abiERC20)) {
return 'ERC-20';
}
// Check if the contract implements the ERC-721 interface
if (implementsERC721(abiERC721)) {
return 'ERC-721';
}
const data = [
{
"name": "path",
"children": [
{
"name": "to",
"children": [
{
"name": "file1",
"value": true,