Skip to content

Instantly share code, notes, and snippets.

View glavk's full-sized avatar
🏠
Working from home

Eugene Selivanov glavk

🏠
Working from home
  • Flowwow
  • 14:30 (UTC +06:00)
View GitHub Profile
@glavk
glavk / curl.md
Created October 10, 2020 18:07 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@glavk
glavk / tmux.md
Created October 30, 2020 15:36 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@glavk
glavk / README.md
Created December 19, 2020 15:56 — forked from oodavid/README.md
Backup MySQL to Amazon S3

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

log_format postdata '$time_local $request $request_body';
location = /path {
access_log /var/log/nginx/postdata.log postdata;
proxy_pass http://localhost:8080; # <= set your port
}
@glavk
glavk / GeoIP Block NGINX Ubuntu 20.04.md
Created January 18, 2023 04:12 — forked from dunderrrrrr/GeoIP Block NGINX Ubuntu 20.04.md
Allow or block GeoIP in Nginx on Ubuntu 20.04

GeoIP Block NGINX Ubuntu 20.04

Block or filter IPs based on location in Nginx (tested on 1.18.0) on Ubuntu 20.04.

Install Nginx modules

To make use of the geographical filtering, we must first install the Nginx GeoIP module as well as the GeoIP database containing the mappings between visitors’ IP addresses and their respective countries. To do so, let’s execute:

$ sudo apt install libnginx-mod-http-geoip geoip-database
@glavk
glavk / s3_janitor.sh
Last active May 22, 2023 14:15 — forked from eduardogspereira/s3_janitor.sh
Delete files from S3 that are older than X days.
#!/bin/bash
# You need to uncomment two lines for the script work.
# Please check the logic before use it.
main () {
#aws s3 ls $BUCKETNAME | grep -v ' PRE ' | grep -v ' 0 ' > data.txt
UNIXDAYS=$(date -d "$DAYS days ago" +%s)
while read LINE
do
@glavk
glavk / nginx_fastcgi_errors.md
Created May 7, 2024 05:27 — forked from CMCDragonkai/nginx_fastcgi_errors.md
NGINX: Common FastCGI Errors involving PHP-FPM

Common FastCGI Errors involving PHP-FPM

  1. 504 Gateway Timeout

    upstream timed out (110: Connection timed out) while reading response header from upstream
    

Means NGINX timed out reading the HTTP response header from upstream. This