Skip to content

Instantly share code, notes, and snippets.

View TheLastCicada's full-sized avatar

Zachary Brown TheLastCicada

View GitHub Profile
@TheLastCicada
TheLastCicada / print_headers.php
Last active May 20, 2016 23:53
Print http headers in PHP
header('Cache-Control: private, max-age=0, no-cache'); // no caching on the php page
echo '<pre>';
print_r($_SERVER);
@TheLastCicada
TheLastCicada / id_rsa.pub
Last active August 29, 2015 14:22
Public keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDtI/I2t8HlkgAxynv0AzRnFu2/jjIKsV15F8KpNOp9YGwszqARYZVz0cetcMhV9m9uR5iCAX3NDDp3shE8bMGLmVs7Slka6RieVknUvJXwcsQ7nVbsyU/UrePfsgMfPyJo7exGFqENsvT0sricQEqSXL9OIJ4fkkCpor4lJr4cNEm18H5SGOvlaQflB0+/tZTDDmB0Q4pIFNjOyWBW0lwmErDfrB8Mg3ykvEVQB5eRpO0D2DysqUEk6ENcPnXr9JLYLUfjRxa4NqG0kjQtmTopwhU9uhgXBdnSRPsKoUdxry46+3IIt6wwmt18yAqqqX049FdNY3pJsi/pK4vWbA7r root@Fileserver
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTke3Au0dR/gnl+QEBhhWQ6SMgHaPJ3a3Q0FcRw3qIHuF8BH6auUCSv9FU0D77kiGkjThmWAHDMVuVjX9AhbS8Sq8wfk2oqQYhiDggvMAQkKkGblixbmIzYgrwdetuGThnHVA/pUNGeWaCK1V2/FHLVdrp5lUd0f1FzYank/6GGYuGJCa0K59aYdhcZCyvKLOREFF3fokLZLwXBLNkhkZZ/FPNLORBe1Xg5bv3FVKwUtH3dZ2jio+PmsdNENTN+QbCyifHPMrTYt6I4zUOG7mk5hEr091uTguWpLB4BPvNQ/KsTtOwl2HlfUnXyp2xI7fQiANTUKNal2ATL7A90gEf zacharybrown@zacharys-air
@TheLastCicada
TheLastCicada / gist:090e51fb4f58da5113da
Last active August 29, 2015 14:17
Nginx ES config
server {
listen 80 default;
server_name search.yourdomain.com;
# Elasticsearch private endpoint
location /private {
# IP of the webserver you want to be able to do everything
allow 24.84.205.111;
deny all;
@TheLastCicada
TheLastCicada / block_brute_address.php
Last active August 29, 2015 14:07
BruteProtect Fail2ban integration. This includes the mu-plugin, fail2ban filter, and fail2ban config for jail.local
<?php
/**
* Plugin Name: Block Brute Plugins
* Description: Custom magic
* Version: 1.0
* Author: Eric Mann
* Author URI: http://10up.com
* License: MIT
*/
function block_brute_address( $ip_address ) {
@TheLastCicada
TheLastCicada / my-sites-search.php
Created July 31, 2014 02:31
@trepmal's My Sites Search plugin for wordpress multisite menus with too many sites
<?php
/*
* Plugin Name: My Sites Search
* Plugin URI: trepmal.com
* Description: https://twitter.com/trepmal/status/443189183478132736
* Version:
* Author: Kailey Lampert
* Author URI: kaileylampert.com
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@TheLastCicada
TheLastCicada / Nginx_Codex
Created June 29, 2014 19:31
Codex Nginx Page
{{Stub}}
While the LAMP stack is very popular (Linux + Apache + MySQL + PHP) for powering WordPress, a lot of people have started using Nginx in place of Apache. This page aims to help those looking to configure WordPress with Nginx.
Before you consider using Nginx, be aware that PHP APC or a similar opcode cache with a WordPress caching plugin is going to offer significant performance improvements over just switching from Apache to nginx. If you aren't already using a PHP opcode cache and WordPress caching plugin, Nginx will do little for your WordPress-based website's performance. WordPress development is intertwined with the Apache world, and as a result, support for Nginx-based setups is limited; but it is growing. Factor these things into your decision to use Nginx.
This is '''not going to cover''' how to install and configure Nginx, so this assumes that you have already installed Nginx and have a basic understanding of how to work with it.
'''Note''': This has been tested on and known to work with
@TheLastCicada
TheLastCicada / WP Cache Test
Created June 10, 2014 23:12
Caching vs No Caching
Before:
Transactions: 675 hits
Availability: 100.00 %
Elapsed time: 119.88 secs
Data transferred: 9.48 MB
Response time: 15.89 secs
Transaction rate: 5.63 trans/sec
Throughput: 0.08 MB/sec
Concurrency: 89.46
@TheLastCicada
TheLastCicada / TheLastCicada.com nginx.conf
Last active August 29, 2015 13:59
TheLastCicada.com Nginx file
user www-data;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
server {
##DM - uncomment following line for domain mapping
#listen 80 default_server;
server_name example.com *.example.com ;
##DM - uncomment following line for domain mapping
#server_name_in_redirect off;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
server {
##DM - uncomment following line for domain mapping
#listen 80 default_server;
server_name example.com *.example.com ;
##DM - uncomment following line for domain mapping
#server_name_in_redirect off;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;