Skip to content

Instantly share code, notes, and snippets.

View andreisfedotov's full-sized avatar
🧘‍♂️
Keep moving forward!

Andrei Fedotov andreisfedotov

🧘‍♂️
Keep moving forward!
View GitHub Profile
@andreisfedotov
andreisfedotov / README.md
Created August 22, 2024 21:32 — forked from Horat1us/README.md
Разворачивание PostgreSQL для локальной разработки

PostgreSQL 12 Docker

Требования

  • docker >= 18
  • docker-compose
  1. Создать папку Docker в домашней директории
mkdir ~/Docker && mkdir ~/Docker/postgres
@andreisfedotov
andreisfedotov / undo-template.cmd
Created April 2, 2023 11:38
undo merge commit (local and remote)
git push -f origin <last_known_good_commit>:<branch_name>
git reset --hard <last_known_good_commit>
@andreisfedotov
andreisfedotov / kill-all-docker-containers.ps1
Created August 15, 2022 12:39
Stop and Remove all Docker containers
Write-Output "CONTAINERS LIST:"
docker container ls
Write-Output "`n`nSTOPPING:"
docker stop $(docker ps -a -q)
Write-Output "`n`nREMOVING:"
docker rm $(docker ps -a -q)
Write-Output "`n`nCONTAINERS LIST:"
@andreisfedotov
andreisfedotov / index.html
Created November 8, 2019 15:20
Loading indicator
<!DOCTYPE html>
<html>
<head>
<title>Loading</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<section class="loading">
<section class="circle"></section>
<section class="circle"></section>
@andreisfedotov
andreisfedotov / Feature.cs
Created May 20, 2019 10:14
Is feature disabled?
[DataMember]
private bool IsFeatureDisabled
{
get { return (Feature & (byte)IntegratedProducts.DisabledFlag) > 0; }
set
{
Feature = value
? (byte)(Feature | (byte) IntegratedProducts.DisabledFlag)
: (byte)(Feature & (byte.MaxValue ^ (byte) IntegratedProducts.DisabledFlag));
}
find "$1" -maxdepth 1 -type f -iname "*$2*" #поиск файлов, в имени которых есть введенные символы
rm -f `find "$1" ! -name "*$2*" -type f -exec rm -f {} \;` #удаление файлов, которые не содержат введенные символы
enum Items : byte
{
DisabledFlag = 1 << 7;
One = 1;
Two = 2;
Three = 5;
}
//=========
public static downloadcsv(data: any, exportFileName: string) {
const csvData = this.convertToCSV(data);
const blob = new Blob([csvData], { type: 'text/csv;charset=utf-8;' });
if (navigator.msSaveBlob) { // IE 10+
navigator.msSaveBlob(blob, this.createFileName(exportFileName));
} else {
const link = document.createElement('a');
if (link.download !== undefined) { // feature detection
// Browsers that support HTML5 download attribute
static compare2Objects(x, y) {
const leftChain = [];
const rightChain = [];
let p;
// remember that NaN === NaN returns false
// and isNaN(undefined) returns true
if (isNaN(x) && isNaN(y) && typeof x === 'number' && typeof y === 'number') {
return true;
}
// Compare primitives and functions.
export default class VectorOperations {
public static addition(vec1: number[], vec2: number[]) {
let res = [];
for (let i = 0; i < vec1.length; i++) {
res.push(vec1[i] + vec2[i]);
}
return res;
}