Skip to content

Instantly share code, notes, and snippets.

View kapb14's full-sized avatar
😤

Aleksandr Karushin kapb14

😤
View GitHub Profile
@kapb14
kapb14 / python_json_pretty_print.sh
Last active June 29, 2017 12:13 — forked from phyous/install_simple_pretty_print.sh
An useful alias to enable simple pretty printing of json data with builtin python module.
# Add alias to bash shell
echo "alias json='python -mjson.tool'" >> ~/.bashrc
# Add alias for zsh shell
echo "alias json='python -mjson.tool'" >> ~/.zshrc
@kapb14
kapb14 / nginx.conf
Created June 27, 2017 16:16 — forked from phpdude/nginx.conf
Nginx image filter + caching of results.
location /resize {
alias /tmp/nginx/resize;
set $width 150;
set $height 100;
set $dimens "";
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) {
set $width $1;
set $height $2;
set $image_path $3;
@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 / .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 / 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 {
@kapb14
kapb14 / 0_reuse_code.js
Created May 15, 2014 10:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console