Skip to content

Instantly share code, notes, and snippets.

View oleggrishechkin's full-sized avatar

Oleg Grishechkin oleggrishechkin

View GitHub Profile

шаблон

// написать функцию, которая считает факториал числа (необходиом использовать рекурсию)

const factorial = (n) => {
  // код
};

console.log(factorial(0)); // 1

шаблон

// написать функцию-промисификацию для setTimeout

const promisedTimeout = (timeout) => {
  // код
};

promisedTimeout(1000).then(() => {

шаблон

// написать функцию, которая преобразует kebab-case в camelCase

const camelize = (string) => {
  // код
};

console.log(camelize('my-long-word')); // myLongWord
alias go='git checkout'
alias gs='git status'
alias sync='git add .;git commit --amend --no-edit;git push -f origin'
pull() {
git fetch --all;git checkout "$1";git reset --hard origin/"$1"
}
  • libreoffice
sudo add-apt-repository ppa:libreoffice/ppa
sudo apt install libreoffice
sudo apt install libreoffice-kde5
  • openvpn
  • git

    1. setup
    git config --global user.email [email protected]
    git config --global user.name "Oleg Grishechkin"
    git config --global core.editor "webstorm -w"
    
  • nvidia (manually)

    enable repo in software center

    sudo dnf update --refresh
    sudo dnf install gcc kernel-headers kernel-devel akmod-nvidia xorg-x11-drv-nvidia xorg-x11-drv-nvidia-libs xorg-x11-drv-nvidia-libs.i686
    

wait 5-10 minutes

// it's color parser snippet for https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/color/
// temp0 - tbody with colors
// returns tuple with [light css variables string, dark css variables string] - values can be copied to your css
Array.from(temp0)
.filter((node) => node.nodeName === 'TR')
.map((node) => {
const [lightNode, darkNode, nameNode] = Array.from(node.childNodes)
.filter((node) => node.nodeName === 'TD')
.slice(0, 3);

This function sum all numbers in string with this format:

2000 - apples
4000 - oranges
1000 - potatos

let sumNumbers = (value) => value.split('\n').map((el) => el.split(' ')).flat().reduce((res, el) => !isNaN(+el) ? res + +el : res, 0);
~/Downloads/ffmpeg -i ~/Downloads/input.mp4 -an -crf 28 -movflags faststart ~/Downloads/output.mp4