Skip to content

Instantly share code, notes, and snippets.

@YuriiHoliuk
YuriiHoliuk / rpi_setup.sh
Last active January 10, 2024 11:52
rpi setup
#!/bin/bash
# apt update
sudo apt update
# sudo apt upgrade -y
# enable ssh
# sudo apt install openssh-server -y
# sudo ufw enable
# sudo ufw allow ssh
@YuriiHoliuk
YuriiHoliuk / resolver.code-snipets
Last active September 17, 2021 13:12
Website VSCode snippets
{
// Place your website workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
"Create resolver": {
"scope": "typescript",
@YuriiHoliuk
YuriiHoliuk / cloudSettings
Created December 27, 2019 09:30 — forked from vkryvytskyy/cloudSettings
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-12-27T09:24:45.333Z","extensionVersion":"v3.4.3"}
@YuriiHoliuk
YuriiHoliuk / MyObject.js
Created September 30, 2019 11:50
Own check like Array.isArray
const __MY_OBJECT_SPECIFIC_SYMBOL__ = Symbol.for(
"__MY_OBJECT_SPECIFIC_SYMBOL__"
);
function MyObject(data = null) {
this.data = data;
this[__MY_OBJECT_SPECIFIC_SYMBOL__] = true;
}
MyObject.isMyObject = function isMyObject(obj) {
const getByIndex = image => (i) => {
const x = i % image.width;
const y = Math.floor(i / image.width);
return { x, y, color: image.pixels[i] };
};
const getByCoords = image => (x, y) => {
const i = (y - 1) * image.width + x;
@YuriiHoliuk
YuriiHoliuk / calcAverage.js
Created April 6, 2019 10:26
Mate Academy TA test
/* eslint-disable */
'use strict';
const people = [
{"name": "Carolus Haverbeke", "sex": "m", "born": 1832, "died": 1905, "father": "Carel Haverbeke", "mother": "Maria van Brussel"},
{"name": "Emma de Milliano", "sex": "f", "born": 1876, "died": 1956, "father": "Petrus de Milliano", "mother": "Sophia van Damme"},
{"name": "Maria de Rycke", "sex": "f", "born": 1683, "died": 1724, "father": "Frederik de Rycke", "mother": "Laurentia van Vlaenderen"},
{"name": "Jan van Brussel", "sex": "m", "born": 1714, "died": 1748, "father": "Jacobus van Brussel", "mother": "Joanna van Rooten"},
{"name": "Philibert Haverbeke", "sex": "m", "born": 1907, "died": 1997, "father": "Emile Haverbeke", "mother": "Emma de Milliano"},
{"name": "Jan Frans van Brussel", "sex": "m", "born": 1761, "died": 1833, "father": "Jacobus Bernardus van Brussel", "mother":null},
const fs = require('fs');
const path = require('path');
fs.readdir(__dirname, (err, files) => {
if (err) {
return console.log(`Unable to scan directory: ${err}`);
}
const names = files
.map(name => name.split('.')[0])
.filter(name => name !== 'index')
@YuriiHoliuk
YuriiHoliuk / calculate.php
Created December 4, 2018 18:19
Calculate expression's result
echo (sqrt(pow(4, 10) - pow(19, 4)) * 2 * pow(pi(), 2))/(log(100, 10));
@YuriiHoliuk
YuriiHoliuk / PDFFiller PHP School 1.2 git.sh
Last active December 1, 2018 12:18
PDFFiller PHP School 1.2
#!/bin/bash
cd ~/ && mkdir php-homework-1.2 && cd $_
git init
touch file1.txt
git add -A && git commit -m 'file1'
touch file2.txt
git add -A && git commit -m 'file2'
git checkout -b staging
@YuriiHoliuk
YuriiHoliuk / PDFFiller PHP School 1.1 git.sh
Last active December 1, 2018 12:18
PDFFiller PHP School 1.1
#!/bin/bash
cd ~/ && mkdir php-homework-1.1 && cd $_
git init
touch file1.txt
git add -A && git commit -m 'file1'
touch file2.txt
git add -A && git commit -m 'file2'
git checkout -b development