Skip to content

Instantly share code, notes, and snippets.

View cronfy's full-sized avatar
🎯
Focusing

Олег Петрачев cronfy

🎯
Focusing
  • Санкт-Петербург
View GitHub Profile
@cronfy
cronfy / cleanup.sh
Created July 26, 2018 12:23
Smoothly remove large number of files, by batches/sec
#!/bin/sh
# Удаляем по 20 файлов в секунду. За 3 часа плавно удалим 200k файлов.
# Пригодится, когда нужно обновить кеш картинок на сайте, но нельзя удалить сразу весь кеш,
# потому что сайт ляжет из-за генерации новых картинок.
find ./ -type f | while sleep 1 ; do
CNT=0
while read line ; do
CNT=$(($CNT + 1))
@cronfy
cronfy / lrp.sh
Created July 20, 2018 18:11
ssh proxy livereload to docker
#!/usr/bin/env bash
docker_host=$1
if [ -z "$docker_host" ] ; then
echo "Syntax: `basename $0` <docker_host>" >&2
exit 1
fi
ssh localhost -R 127.0.0.1:35729:$docker_host:35729
@cronfy
cronfy / convertShortOpenTags.sh
Last active September 26, 2017 16:33 — forked from peterjaap/convertShortOpenTags.sh
PHP: Replace short open tag <? with full form <?php
# Uncomment last line if you want to replace <?= with <?php echo
find . -type f -iname '*.php' -print0 |
xargs -0 sed -i \
-e 's/<? /<?php /g' \
-e 's/<?$/<?php/' \
-e 's/<?\/\//<?php \/\//g' \
-e 's/<?\/\*/<?php \/\*/g' \
# -e 's/<?\=/<?php echo /g'
@cronfy
cronfy / dl-cloud-mail-ru.sh
Last active April 1, 2024 16:58
Download file from cloud.mail.ru from linux console with bash script
#!/usr/bin/env bash
# Скрипт по загрузке публичных файлов с Облака mail.ru. Поддерживается докачка.
# v1.0.5 от 2022-05-30
#
# ЕСЛИ СКРИПТ НЕ РАБОТАЕТ
#
# 1. Убедитесь, что файл доступен публично. Возможна загрузка только публичных файлов.
# 2. Mail.ru время от времени меняет внутрянку, не очень сильно, но требуется адаптация скрипта.
# Если скрипт не работает, просьба сделать работающий форк и скинуть ссылку в комментарии.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cronfy
cronfy / icon-padding.svg
Created February 14, 2017 12:46
SVG icon with padding
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cronfy
cronfy / .htaccess
Last active July 23, 2021 19:44 — forked from donnykurnia/.htaccess
.htaccess 503 Техническое обслуживание сайта (maintenance page)
AddDefaultCharset utf-8
ErrorDocument 503 /maintenance.html
RewriteEngine On
RewriteBase /
# uncomment and set your ip to allow your ip to enter
#RewriteCond %{REMOTE_ADDR} !1\.2\.3\.4
# block requests to site, but allow let's encypt generation
@cronfy
cronfy / maintenance.html
Last active June 6, 2023 19:44 — forked from pitch-gist/gist:2999707
HTML: Техническое обслуживание сайта (503) (Simple Maintenance Page)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Техническое обслуживание</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
@cronfy
cronfy / remove_closing_tags.sh
Last active February 10, 2017 05:31 — forked from lorenzo/remove_closing_tags.sh
Script to remove all closing ?> php tags in a folder
#!/bin/bash
###
echo "Use PHP_CodeSniffer: https://github.com/squizlabs/PHP_CodeSniffer"
echo
echo "Rules:"
echo " * PSR2.Files.ClosingTag"
echo " * PSR2.Files.EndFileNewline"
echo " * Generic.Files.LineEndings"