This file contains 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
#!/bin/bash | |
NET_NAME=apps-nw | |
for i in `docker network inspect -f '{{range .Containers}}{{.Name}} {{end}}' ${NET_NAME}`; do | |
docker network disconnect -f ${NET_NAME} ${i}; | |
done; | |
if [[ $1 == "disconnect" ]]; then | |
exit |
This file contains 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
# ШАГ 1 | |
# | |
# Копируем файлы npm-менеджера во временный каталог и запускаем установку пакетов | |
# Эти действия нужно разместить одними из первых, до копирования в образ исходных кодов | |
# Идея такая: докер использует слоеную файловую систему (каждый образ-слой), причем кеширует промежуточные слои. | |
# Если файлы ./package.json ./package-lock.json не менялись, то при создании образа докер | |
# просто пропустит этот шаг, а в консоли будет "образ взят из кеша" | |
# Если же файлы изменились (а это происходит значительно реже, чем меняются файлы исходных кодов проекта), | |
# то шаг будет выполнен. | |
# Если до этого шага разместить какие-то действия, которые меняют прошлые слои, то кеширование работать не будет, |
This file contains 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 | |
// Работа на сервере ЭЦП: подписание, получение тумбы, хеш файла | |
namespace Sign; | |
use | |
\Exception as Exception, | |
\DateTime as DateTime, | |
\DateTimeZone as DateTimeZone, |
This file contains 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
#!/bin/bash | |
# Скрипт проверки скидки на одном сайте | |
for i in `seq 100 999`; do | |
curl -s 'https://site.ru/cart_items.json' -H 'Cookie: first_current_location=%2Fproduct%2Fuvelichitelnye-ochki-big-vision; first_referer=; referer=; current_location=%2Fproduct%2Fuvelichitelnye-ochki-big-vision; c_id=601121f6c756970ed0f55cab351c9577; convead_cart_info=%7B%22count%22%3A0%2C%22price%22%3A0%7D; product_ids=87330068; giftd_v=; ins__3=33696000; ins__1=15552000; ins_marketru=2853971ef1f9f1588db503783c69891c; gcart=[{"id":147850700,"quantity":1,"price":650}]; request_method=PUT; cart=%7B%22comment%22%3Anull%2C%22delivery_date%22%3Anull%2C%22delivery_description%22%3Anull%2C%22delivery_from_hour%22%3Anull%2C%22delivery_price%22%3A0.0%2C%22delivery_title%22%3Anull%2C%22delivery_to_hour%22%3Anull%2C%22number%22%3Anull%2C%22payment_description%22%3Anull%2C%22payment_title%22%3Anull%2C%22items_count%22%3A1%2C%22items_price%22%3A650.0%2C%22order_lines%22%3A%5B%7B%22added_at%22%3A0%2C%22comment%22%3A%22%22%2C%22id%22%3Anull% |
This file contains 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 | |
/** | |
* Написать функцию которая из этого массива | |
*/ | |
$data1 = [ | |
'parent.child.field' => 1, | |
'parent.child.field2' => 2, | |
'parent2.child.name' => 'test', | |
'parent2.child2.name' => 'test', | |
'parent2.child2.position' => 10, |
This file contains 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
test |
This file contains 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 | |
// Работа с MySQL | |
class DataBaseMysqli { | |
private $dbId; | |
private static $instance; | |
public function getDB() { // 2 альтернативных путя создания объекта | |
if(isset(self::$instance)) return self::$instance; | |
$config = BASignContainer::_()->getDBConfig(); |
This file contains 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
SELECT t.name, t.slug, taxonomy.description, term2.desc FROM | |
ph_terms AS `t` | |
JOIN ph_term_taxonomy AS `taxonomy` ON (taxonomy.term_id = t.term_id AND taxonomy.taxonomy = 'post_tag') | |
JOIN dev_letsmed.terms AS `term2` ON (term2.name = t.name); | |
UPDATE ph_term_taxonomy AS `taxonomy` | |
JOIN ph_terms AS `t` ON (taxonomy.term_id = t.term_id AND taxonomy.taxonomy = 'post_tag') | |
JOIN dev_letsmed.terms AS `term2` ON (term2.name = t.name) | |
SET taxonomy.description = term2.desc | |
WHERE taxonomy.description = ''; |
This file contains 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
// http://habrahabr.ru/post/204628/ | |
function DateGuess($scope) { | |
$scope.data = {}; | |
$scope.data.answer = ""; | |
$scope.data.examples = [ | |
{title: "Мыть машину через 2 дня в 11"}, | |
{title: "Поздравить с ДР через год в 12:30"}, | |
{title: "Записаться на пятницу"}, | |
{title: "Проснуться 2 января"}, |
This file contains 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
// functions.php | |
function getZeroSectionContent($id, $header) { | |
$doc = p_wiki_xhtml($id); | |
$headerReg = preg_quote($header, '/'); | |
if(preg_match('~<h[1-6].*?>\s*' . $headerReg . '\s*<\/h[1-6]>~ui', $doc, $m, PREG_OFFSET_CAPTURE)) { | |
$start = $m[0][1]; | |
$section = substr($doc, 0, $start); |