Skip to content

Instantly share code, notes, and snippets.

@iredun
iredun / Semantic.md
Created March 18, 2021 09:39
Перевод для себя как писать коммиты по Semantic

Правила написания коммитов

Это вольный перевод, упрощенный местами Angular commit style

Каждое сообщение коммита состоит из заголовка, тела и колонтитула. Заголовок имеет специальный формат, который включает тип и тему:

<type>: <subject>
<BLANK LINE>
<body>
<BLANK LINE>
@iredun
iredun / youtube.txt
Created April 13, 2016 08:59
Youtube API get thumbnail image
Each YouTube video has 4 generated images. They are predictably formatted as follows:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg
The first one in the list is a full size image and others are thumbnail images. The default thumbnail image (ie. one of 1.jpg, 2.jpg, 3.jpg) is:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg
For the high quality version of the thumbnail use a url similar to this:
@iredun
iredun / dep.php
Created August 12, 2015 08:58
Получить список разделов и их подразделов в 1С - Битрикс
<?
$res = CIBlockSection::GetList(
Array('name' => 'asc'),
Array('IBLOCK_ID' =>'5' , 'ACTIVE' => 'Y')
);
while ($row = $res->GetNext())
{
echo $row['NAME'].'<br>';
$rsParentSection = CIBlockSection::GetByID($row['ID']);
if ($arParentSection = $rsParentSection->GetNext())
gource -1280x720 --seconds-per-day 0.1 --key --hide dirnames, -o - | ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset ultrafast -crf 1 -threads 0 -bf 0 output.mp4
@iredun
iredun / encoder.py
Created March 17, 2017 17:53
Python скрипт для рекурсивного перевода файлов(можно указать несколько типов файлов) из кодировки CP1251 в UTF8
import os, codecs
for (dir, _, files) in os.walk("./"):
for f in files:
path = os.path.join(dir, f)
if f.endswith(('php')):
if os.path.exists(path):
data = open(path, "rb").read()
print(path)
if data.startswith(codecs.BOM_UTF8):
continue
@iredun
iredun / files_line.sh
Created April 25, 2021 22:34
Получить список файлов с кол-вом строк в каждом файле и итого
find ./ -type f -name "*.py" | xargs wc -l
@iredun
iredun / sql.sql
Created January 18, 2021 12:26
Change root@localhost user password
alter user 'root'@'localhost' identified with mysql_native_password by 'PASS';
@iredun
iredun / rm.sh
Created October 9, 2020 14:45
Docker delete all dangling images
docker rmi $(docker images -f “dangling=true” -q)
@iredun
iredun / sslcurl.php
Created April 24, 2017 15:42
get ssl page php func
function getSslPage($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
@iredun
iredun / example.php
Created September 26, 2019 05:24
Быстрый экпорт в эксель, собираем массив $arrayData первый массив содержит заголовки таблиц, дальше массивы данных
<?
public function actionExportNumbersData()
{
ini_set("memory_limit", "-1");
set_time_limit(0);
$numbers = Numbers::find()->all();
$spreadsheet = new Spreadsheet();