Skip to content

Instantly share code, notes, and snippets.

sudo pg_dropcluster --stop 12 main
sudo pg_createcluster --locale ru_RU.UTF-8 --start 12 main
@IgorShayderov
IgorShayderov / gist:c403ede33781f78863a23270a7dbbd6c
Created August 13, 2021 21:03
Remove no-ref local branches
git branch --merged >/tmp/merged-branches && \nano /tmp/merged-branches && xargs git branch -d </tmp/merged-branches
/* 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 {
@IgorShayderov
IgorShayderov / rails http status codes
Created January 20, 2021 10:47 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
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
@IgorShayderov
IgorShayderov / Docker-1.txt
Last active January 16, 2021 23:39
Docker managing database(postgres)
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
Подключаемся к СУБД.
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
### 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
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,
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