This file contains hidden or 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
| sudo pg_dropcluster --stop 12 main | |
| sudo pg_createcluster --locale ru_RU.UTF-8 --start 12 main |
This file contains hidden or 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
| git branch --merged >/tmp/merged-branches && \nano /tmp/merged-branches && xargs git branch -d </tmp/merged-branches |
This file contains hidden or 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
| /* clears the 'X' from Chrome */ | |
| input[type="search"]::-webkit-search-decoration, | |
| input[type="search"]::-webkit-search-cancel-button, | |
| input[type="search"]::-webkit-search-results-button, | |
| input[type="search"]::-webkit-search-results-decoration { | |
| display: none; | |
| } | |
| /* clears the 'X' from Internet Explorer */ | |
| input[type=search]::-ms-clear { |
This file contains hidden or 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 status code symbols for Rails | |
| Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
| Status Code Symbol | |
| 1xx Informational | |
| 100 :continue | |
| 101 :switching_protocols | |
| 102 :processing |
This file contains hidden or 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
| docker run --rm --name postgres -d -e POSTGRES_PASSWORD=12345 -v ~/db:/var/lib/postgresql/data postgres:13.1-alpine | |
| Создает postgres в фоне(-d), postgres требует наличие переменной окружения с паролем(-e), | |
| подключаем том (-v). Последний параметр - до : локальная папка, а после папка до postgres в контейнере. | |
| docker exec -it postgres bash | |
| Подключение к контейнеру postgres. | |
| psql -U postgres | |
| Подключаемся к СУБД. |
This file contains hidden or 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
| require 'rails_helper' | |
| RSpec.describe TodosController, :type => :controller do | |
| describe "GET #index" do | |
| #describe "POST #create" do | |
| #describe "GET #show" do | |
| #describe "PATCH #update" do (or PUT #update) | |
| #describe "DELETE #destroy" do | |
| #describe "GET #new" do |
This file contains hidden or 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 79.143.30.92 port 80 protocol http | |
| then restart | |
| if 3 restarts within 5 cycles then timeout |
This file contains hidden or 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. | |
| CREATE DATABASE test_guru; | |
| CREATE TABLE categories( | |
| id serial PRIMARY_KEY | |
| title varchar(50) | |
| ); | |
| CREATE TABLE tests( | |
| id serial PRIMARY_KEY, | |
| title varchar(50), | |
| level int, |
This file contains hidden or 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. | |
| 1) | |
| ncat -C httpbin.org 80 | |
| GET /anything HTTP/1.1 | |
| Host: httpbin.org | |
| HTTP/1.1 200 OK | |
| Date: Thu, 26 Mar 2020 23:15:18 GMT | |
| Content-Type: application/json | |
| Content-Length: 287 |