Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View cronfy's full-sized avatar
🎯
Focusing

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

🎯
Focusing
  • Санкт-Петербург
View GitHub Profile
@kerastinell
kerastinell / dl-cloud-mail-ru.sh
Last active May 12, 2022 18:58 — forked from cronfy/dl-cloud-mail-ru.sh
Download file from cloud.mail.ru from linux console with bash script
#!/usr/bin/env bash
# IMPORTANT: mail.ru sometimes changes internals, not too much, but script must be changed.
#
# If this script does not work:
# - see forks, may be there is a fix already,
# - if not, please post patch in comments or create a working fork of this gist.
# Thank you!
# ВАЖНО. mail.ru время от времени меняет внутрянку, не очень сильно, но требуется адаптация скрипта.
@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 время от времени меняет внутрянку, не очень сильно, но требуется адаптация скрипта.
# Если скрипт не работает, просьба сделать работающий форк и скинуть ссылку в комментарии.
@aaronbloomfield
aaronbloomfield / multiple-php-versions-on-ubuntu-16.04.md
Last active July 9, 2020 01:53
Running multiple PHP versions on Apache2 and Ubuntu 16.04

Setting up multiple apache2 instances on Ubuntu 16.04

PHP handling on apache is done via modules of one sort or another, and running multiple version is problematic on a single instance. The solution is to run two instances of apache on the same machine. This allows one instance to run PHP 7 (the default on 16.04), and another can run PHP 5. Since normal http/https is on ports 80 and 443, the second instance will run on ports 81 and 444. Since it is running on the same machine, all file system and database access is the exact same.

All the commands herein have to be run as root, or with sudo prefixed to the command.

  1. Read /usr/share/doc/apache2/README.multiple-instances

  2. Run sh ./setup-instance php5 from /usr/share/doc/apache2/examples, where php5 is the suffix for the second site; all commands for the second site will have that suffix. This will keep all of the same configuration for all sites on the new instance, including SSL certif

@marat-dimaev
marat-dimaev / bx_iblock_element_prop_display.php
Created August 7, 2016 20:40
Bitrix вывод значений свойств элемента инфоблока
\Bitrix\Main\Loader::includeModule('iblock');
$res = \CIBlockElement::GetList(
array(),
array('ID'=>$id,'ACTIVE'=>'Y','IBLOCK_ID'=>self::$IBLOCK_ID),
false,
array('nTopCount'=>1),
array("ID", "IBLOCK_ID", 'NAME','PREVIEW_PICTURE','DETAIL_PICTURE','PREVIEW_TEXT','PROPERTY_*')
);
if($res->SelectedRowsCount()) {
@r3verser
r3verser / AccessBehavior.php
Last active December 7, 2022 08:22
Yii2 Redirects all users to login (or any) page if not logged in, but allow access to some pages (like signup, password recovery etc.)
<?php
/*
* In configuration file
* ...
* 'as AccessBehavior' => [
* 'class' => 'app\components\AccessBehavior',
* 'allowedRoutes' => [
* '/',
* ['/user/registration/register'],
@orodley
orodley / extract_image.sh
Created July 24, 2014 09:25
Extract base64-encoded images from an HTML file.
for image in `grep --color=never -Po 'data:image/[^;]*;base64,\K[a-zA-Z0-9+/]*' foo.html`; do echo -n "$image" | base64 -di > `mktemp image_XXXX`; done
@d11wtq
d11wtq / docker-ssh-forward.bash
Created January 29, 2014 23:32
How to SSH agent forward into a docker container
docker run -rm -t -i -v $(dirname $SSH_AUTH_SOCK) -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK ubuntu /bin/bash
@lorenzo
lorenzo / remove_closing_tags.sh
Created June 1, 2011 06:42
Script to remove all closing ?> php tags in a folder
#!/bin/bash
# vim:ft=sh:ts=3:sts=3:sw=3:et:
###
# Strips the closing php tag `?>` and any following blank lines from the
# end of any PHP file in the current working directory and sub-directories. Files
# with non-whitespace characters following the closing tag will not be affected.
#
# Author: Bryan C. Geraghty <bryan@ravensight.org>
# Date: 2009-10-28