Skip to content

Instantly share code, notes, and snippets.

View demidovsky's full-sized avatar

Dmitry Demidovsky demidovsky

View GitHub Profile
$args = аргументам в строке запроса;
$arg_name = аргументу name в строке запроса;
$binary_remote_addr = адресу клиента в бинарном виде, длина её значения всегда 4 байта;
$content_length = строке "Content-Length" в заголовке запроса;
$content_type = строке "Content-Type" в заголовке запроса;
$cookie_name = cookie name;
$document_root = значению директивы root для текущего запроса;
$document_uri = $uri;
$host = строке "Host" в заголовке запроса или имени сервера, на который пришёл запрос, если этой строки нет;
$hostname = имени хоста;
@demidovsky
demidovsky / mysql2sqlite.sh
Created September 10, 2018 11:00 — forked from esperlu/mysql2sqlite.sh
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
version: '3'
services:
web:
image: gcr.io/.../project-node
restart: always
logging:
options:
max-size: "10M"
max-file: "10"
ports:
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
Right-click on the right side, and add a new DWORD (32-bit) Value
Set the value name to DisableTaskOffload and the value data to 1
Open Network Connections.
Right-click the icon of the Network card and select Properties.
In Networking tab, click Configure… button.
In the next window, switch to Advanced tab.
Click the Large Send Offload Version 2 (IPv4) and change the value to Disabled.
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');

Check all non-Apple installed services:

launchctl list | grep -v com.apple

Get active services:

grep -B 1 -A 1 "active count = 1$" <<< "$(launchctl dumpstate)"
@demidovsky
demidovsky / default
Created September 27, 2019 10:46
nginx + certbot (letsencrypt) config example
#/etc/nginx/sites-enabled/default
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
server {
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.