This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const normalizeAngle = (angle) => { | |
return angle > 0 ? angle % 360 : 360 - -(angle % 360); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$region_codes = [ | |
'01' => 'Республика Адыгея', | |
'02' => 'Республика Башкортостан', | |
'03' => 'Республика Бурятия', | |
'04' => 'Республика Алтай (Горный Алтай)', | |
'05' => 'Республика Дагестан', | |
'06' => 'Республика Ингушетия', | |
'07' => 'Кабардино-Балкарская Республика', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const declOfNum = (number, titles) => { | |
let cases = [2, 0, 1, 1, 1, 2]; | |
return titles[(number % 100 > 4 && number % 100 < 20) ? 2 : cases[(number % 10 < 5) ? number % 10 : 5]]; | |
} | |
// use: | |
const number = 100; | |
declOfNum(number, ['найдена', 'найдено', 'найдены']); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get update | |
sudo apt-get install postgresql postgresql-contrib | |
-- вход в пользователя постгрес -- | |
sudo -u postgres psql | |
-- выход -- | |
\q | |
-- создание пользователя -- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
😀 | |
😁 | |
😂 | |
🤣 | |
😃 | |
😄 | |
😅 | |
😆 | |
😉 | |
😊 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find /root -name "writetofile.php.*" -type f -delete | |
find ./content/ankety/ -name "*.txt" -type f -exec sed -i 's/Onmoderate\: 1/Onmoderate\: 0/g' {} + | |
sudo kill $(sudo lsof -t -i:3002) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os | |
import codecs | |
# pip3 install cchardet | |
import cchardet as chardet | |
def changeEncoding(folder, encode_to): | |
for root, dirs, files in os.walk(folder): | |
path = root.split(os.sep) | |
for file in files: |