Skip to content

Instantly share code, notes, and snippets.

View kapb14's full-sized avatar
😤

Aleksandr Karushin kapb14

😤
View GitHub Profile
@kapb14
kapb14 / cors-nginx.conf
Created June 27, 2017 11:51 — forked from michiel/cors-nginx.conf
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
@kapb14
kapb14 / simpleUploadServer.py
Created June 23, 2017 09:41
simple Upload WebServer in pure python2
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
simpleUploadServer.py
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@kapb14
kapb14 / bx-change-dbhost.sh
Created April 28, 2017 16:40
Поменять адрес MySQL сервера в конфигах Битрикс. С поиском, проверками, бэкапами, откатом изменений (если что-то пошло не так)...
#!/bin/bash
if [[ -z $1 ]]; then
NEW_DB="127.0.0.1"
else
NEW_DB="$1"
fi
DIR=$(pwd)
@kapb14
kapb14 / .multitailrc
Created April 26, 2017 11:29 — forked from shawing/.multitailrc
Multitail color-code each line based on it's http status code "family"
check_mail:0
# color-code each line based on it's http status code "family"
colorscheme:nginx
cs_re:green:^.* 20.? .*$
cs_re:cyan:^.* 30.? .*$
cs_re:yellow:^.* 40.? .*$
cs_re:red:^.* 50.? .*$
@kapb14
kapb14 / nginx-bitrix.conf
Created April 26, 2017 09:53 — forked from dragolabs/nginx-bitrix.conf
nginx configuration for bitrix cms
server {
listen 80;
server_name bitrix.example.com;
client_max_body_size 200m;
root /var/www/bitrix;
index index.html index.php;
user bitrix; #пользователь, под которым работает nginx. Желательно совпадение с пользователем apache
worker_processes 8; #8 одновременных процессов
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
worker_rlimit_nofile 10240; #максимальное число открытых файлов
events {
use epoll;
worker_connections 10240; #максимальное число соединений с одним процессом. Система может одновременно работать с max_clients = worker_processes * worker_connections, т.е. с 81920 соединений, в том числе статических файлов
}
@kapb14
kapb14 / cli.md
Created April 18, 2017 08:12 — forked from phrawzty/2serv.py
simple http server to dump request headers
$ curl -s -H "X-Something: yeah" localhost:8000 > /dev/null
$ python serv.py
ERROR:root:User-Agent: curl/7.37.1
Host: localhost:8000
Accept: */*
X-Something: yeah
@kapb14
kapb14 / parsing_arguments_with_bash.sh
Created April 5, 2017 14:27
использование параметров в bash скриптах используя 'getopts' и стандартный POSIX
#
# http://mywiki.wooledge.org/BashFAQ/035
#
getopts_lookup(){
while getopts "h?v:a:p:u:n:" OPTION "$@"; do
case "$OPTION" in
m) has_MSG=true; MSG="$OPTARG"; echo "MSG: $MSG" ;;
p) has_PHONE=true; PHONE="$OPTARG"; echo -e "PHONE: $PHONE \t OPTIND: $OPTIND" ;;
v) has_VERBOSE=true; VERBOSE="$OPTARG"; echo -e "VERBOSE: $VERBOSE \t OPTIND: $OPTIND" ;;
@kapb14
kapb14 / jira-behing-nginx-ssl
Created March 30, 2017 15:21 — forked from jtbonhomme/jira-behing-nginx-ssl
Atlassian JIRA behind nginx + SSL
# force HTTP to HTTPS - /etc/nginx/conf.d/nonssl.conf
server {
listen 80;
server_name jira.example.com;
access_log off;
return 301 https://$server_name$request_uri;
}
# /etc/nginx/conf.d/jira.conf
server {
<?php
$status = file_get_contents('/proc/' . getmypid() . '/status');
print $status . "\n";