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/sh | |
git config -f .gitmodules --get-regexp '^submodule\..*\.path$' | | |
while read path_key path | |
do | |
url_key=$(echo $path_key | sed 's/\.path/.url/') | |
url=$(git config -f .gitmodules --get "$url_key") | |
git submodule add $url $path | |
done |
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
## Nginx ### | |
check process nginx with pidfile /run/nginx.pid | |
start program = "/usr/sbin/service nginx start" | |
stop program = "/usr/sbin/service nginx stop" | |
if cpu > 60% for 2 cycles then alert | |
if cpu > 80% for 5 cycles then restart | |
if memory usage > 80% for 5 cycles then restart | |
if failed host 194.61.1.61 port 80 protocol http | |
then restart | |
if 3 restarts within 5 cycles then timeout |
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
# frozen_string_literal: true | |
require 'rails_helper' | |
RSpec.configure do |config| | |
config.use_transactional_fixtures = false | |
# DatabaseCleaner settings | |
config.before(:suite) do | |
DatabaseCleaner.clean_with(:truncation) |
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
Gistfile1 |
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
#показ ветки в командной строке | |
parse_git_branch() { | |
if ! git rev-parse --git-dir > /dev/null 2>&1; then | |
return 0 | |
fi | |
git_branch=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p') | |
echo "$git_branch" | |
} | |
PS1="${debian_chroot:+($debian_chroot)}\e[01;94mbranch:[\$(parse_git_branch)]\e[00m \e[02;31;01mjobs:\j\e[00m \e[01;32m\w\e[00m\n$: " |
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 | |
Первый попавшийся элемент в массиве | |
Подмассив, соответствующий условию выборки | |
Количество подходящих элементов | |
Случайный массив |
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
Что делает setState? | |
Обновляет состояние компонента | |
Возвращает текущее состояние компонента |
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/sh | |
PROJECT_BASE=/var/www/[project_name] | |
GIT_REPO=$PROJECT_BASE/shared/[project_name].git | |
TMP_GIT_CLONE=$PROJECT_BASE/shared/build | |
GEMFILE=$TMP_GIT_CLONE/Gemfile | |
PUBLIC_WWW=$PROJECT_BASE/current | |
mkdir -p $TMP_GIT_CLONE | |
git clone $GIT_REPO $TMP_GIT_CLONE |
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
INSERT INTO categories (title) VALUES | |
('Frontend'), | |
('Backend'), | |
('Other'); | |
INSERT INTO tests(title, level, categories_id) VALUES | |
('HTML', 1, 1), | |
('Rails', 2, 2), | |
('Django', 2, 2), | |
('MySQL', 3, NULL), |
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
GET /anything HTTP/1.1 | |
Host: httpbin.org | |
HTTP/1.1 200 OK | |
Access-Control-Allow-Credentials: true | |
Access-Control-Allow-Origin: * | |
Content-Type: application/json | |
Date: Fri, 06 Dec 2019 13:57:33 GMT | |
Referrer-Policy: no-referrer-when-downgrade | |
Server: nginx |
NewerOlder