Skip to content

Instantly share code, notes, and snippets.

@ansulev
ansulev / nginx-pcache-default.conf
Created July 12, 2018 14:24
Default config for NGINX reverse proxy cache with Apache.
#fix 504 gateway timeouts, can go in nginx.conf
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
#set the location of the cached files, zone, name, size (100 MB) and how long to cache for 600 minutes
proxy_cache_path /var/run/proxy-cache levels=1:2 keys_zone=WORDPRESS:10m max_size=100m
inactive=600m;
proxy_cache_key $scheme$host$request_uri;
@ansulev
ansulev / nginx-pcache-apache-hhvm-14.04.sh
Last active July 12, 2018 14:14
Install NGINX reverse proxy cache, with apache and HHVM on Ubuntu 14.04
#
# Install NGINX reverse proxy cache, with apache and HHVM on Ubuntu 14.04
#
# escalate privileges to avoid sudo on every command
sudo -s
# update and clean system
apt-get update -y && apt-get upgrade -y && apt-get dist-upgrade -y
apt-get autoremove -y && apt-get autoclean && apt-get clean
@ansulev
ansulev / sql2csv
Created June 27, 2018 17:16 — forked from mtth/sql2csv
Parse SQL dump into csv.
#!/usr/bin/env bash
# convert sql dumps to csv, tsv, ssv...
# also can filter fields using a sed pattern
# only works on linux
function usage
{
echo "usage: $0 [-sc CORES] [-o OUTFILE] [-p PATTERN] SQLFILE" 2>&1 && exit 1
}
@ansulev
ansulev / install-3proxy-debian-ubuntu.sh
Last active December 7, 2023 08:49
Install 3proxy on Debian 9 or Ubuntu 16.4
#
# Install and configure 3proxy for Ubuntu 16.04 or Debian 9
#
# Update the system and install build tools + fail2ban
apt update -y && apt upgrade -y && apt dist-upgrade -y
apt autoremove -y && apt autoclean -y && apt clean -y
apt -y install fail2ban software-properties-common
apt install -y build-essential libevent-dev libssl-dev
@ansulev
ansulev / wp-maintenance-mode.php
Last active July 7, 2018 07:24 — forked from digitalinkwell/maintenance-mode.php
Easy put WordPress in Maintenance Mode.
/*
* put this on the very bottom of the functions.php file of your theme
* or create manually .maintenance on your web root with desired message
*/
// Activate WordPress Maintenance Mode
function wp_maintenance_mode(){
if(!current_user_can('edit_themes') || !is_user_logged_in()){
wp_die('<h1 style="color:red">Website under Maintenance</h1><br />We are performing scheduled maintenance. We will be back online shortly!');
}
@ansulev
ansulev / db-export.php
Last active February 15, 2024 13:56
Export MySQL database with PHP only
<?php
/*
* Best way to export database using php script.
* Or add 5th parameter(array) of specific tables: array("mytable1","mytable2","mytable3") for multiple tables
*/
//ENTER THE RELEVANT INFO BELOW
$mysqlUserName = "Your Username";
$mysqlPassword = "Your Password";
$mysqlHostName = "Your Host";
$DbName = "Your Database Name here";
@ansulev
ansulev / pdostatement.php
Last active July 7, 2018 07:20
PDOStatement:execute - simplified $placeholder form
<?php
/*
*from
* http://php.net/manual/en/pdostatement.execute.php#111823
* simplified $placeholder form
*/
$data = ['a'=>'foo','b'=>'bar'];
$keys = array_keys($data);
@ansulev
ansulev / wps-pins.dict
Last active January 16, 2024 22:46
WPS Audit Pins Dictionaries
https://www.wifi-libre.com/topic-626-base-de-datos-wpspin-original-open-source-actualizada-page-4.html
http://www.downloadwireless.net/scripts-live/patrones_conocidos.txt
100 Pins:
https://drive.google.com/open?id=0BzKLb-Q5X_sbSmN0UXZrWnRFREE
500 Pins:
https://drive.google.com/open?id=0BzKLb-Q5X_sbdVhkSEEyRkU1azQ
1000 Pins:
@ansulev
ansulev / php-memcached-test.php
Last active November 11, 2020 13:38
PHP Memcached Server Test
<?php
// Test default memcached server. Load, then refresh.
if (class_exists('Memcache')) {
$meminstance = new Memcache();
} else {
$meminstance = new Memcached();
}
$meminstance->addServer("127.0.0.1",11211);
@ansulev
ansulev / wordpress-pinglist.txt
Last active July 10, 2018 08:15
WordPress ping list update - June 2017
http://bing.com/webmaster/ping.aspx
http://ping.blo.gs/
http://blog.goo.ne.jp/XMLRPC
http://blog.with2.net/ping.php
http://blogping.unidatum.com/RPC2
http://blogpingr.de/ping/rpc2
https://ping.blogs.yandex.ru/RPC2
http://blogsearch.google.co.cr/ping/RPC2
http://blogsearch.google.co.hu/ping/RPC2
http://api.moreover.com/ping