Skip to content

Instantly share code, notes, and snippets.

View TheLastCicada's full-sized avatar

Zachary Brown TheLastCicada

View GitHub Profile
@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 / 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 / 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);
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTke3Au0dR/gnl+QEBhhWQ6SMgHaPJ3a3Q0FcRw3qIHuF8BH6auUCSv9FU0D77kiGkjThmWAHDMVuVjX9AhbS8Sq8wfk2oqQYhiDggvMAQkKkGblixbmIzYgrwdetuGThnHVA/pUNGeWaCK1V2/FHLVdrp5lUd0f1FzYank/6GGYuGJCa0K59aYdhcZCyvKLOREFF3fokLZLwXBLNkhkZZ/FPNLORBe1Xg5bv3FVKwUtH3dZ2jio+PmsdNENTN+QbCyifHPMrTYt6I4zUOG7mk5hEr091uTguWpLB4BPvNQ/KsTtOwl2HlfUnXyp2xI7fQiANTUKNal2ATL7A90gEf zacharybrown@zacharys-air
@TheLastCicada
TheLastCicada / headers.php
Last active January 10, 2017 01:10
Print Request HTTP Headers with PHP
<ul>
<?php
foreach($_SERVER as $h=>$v)
if(ereg('HTTP_(.+)',$h,$hp))
echo "<li>$h = $v</li>\n";
header('Content-type: text/html');
echo "<br> The current directory is: " . getcwd() . "\n";
?>
</ul>
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCvLhhCloYWHPdhArtOD80WguUeJTIlXOQ9/VjMgD5TfV3IYK29cyKiD7LtvDcwHavGZX+RLijxR9CuRfbswoKgyuWZz6Ls7RVGtMRzaNrTbol1zmwhmVswPKRoqaT2BBHKlG6bbUlFonP7YxYHBVo8vH2WJGoS4aniq0kn7ekW9uOwCM7EbplnZXE7kJAwLKF4p0PcmxARwzbvNvgz6LvANDbeROiWxii2IBoFGfL1Ov3/4xFrWGp37OlmCIKVc67hGjz8Zoj3qqt7Kiqk26Jn4anw0dRiqoad7gA+DrTbqhmV+iCpvJNWu7AF4gxX6tTOYENFjZhp4+eqBG9iiOgn thott@thorstens-pro.fritz.box
# netstat -an | grep 80
tcp 0 0 10.10.8.32:80 198.143.57.17:42857 SYN_RECV
tcp 0 0 10.10.8.32:80 198.143.57.17:42854 SYN_RECV
tcp 0 0 10.10.8.32:80 10.10.8.120:40116 SYN_RECV
tcp 0 0 10.10.8.32:80 198.143.57.17:42858 SYN_RECV
tcp 0 0 10.10.8.32:80 198.143.39.9:23772 SYN_RECV
tcp 0 0 10.10.8.32:80 198.143.46.1:42896 SYN_RECV
tcp 0 0 10.10.8.32:80 198.143.39.9:23782 SYN_RECV
tcp 0 0 10.10.8.32:80 198.143.39.9:23780 SYN_RECV
tcp 0 0 10.10.8.32:80 192.230.72.49:10645 SYN_RECV
# netstat -an | grep 80 | grep FIN_WAIT
tcp 0 0 ::ffff:10.10.8.32:80 ::ffff:198.143.37.113:37979 FIN_WAIT2
tcp 0 1 ::ffff:10.10.8.32:80 ::ffff:149.126.78.17:38165 FIN_WAIT1
tcp 0 1 ::ffff:10.10.8.32:80 ::ffff:198.143.33.81:47742 FIN_WAIT1
tcp 0 1 ::ffff:10.10.8.32:80 ::ffff:198.143.37.113:37981 FIN_WAIT1
tcp 0 1 ::ffff:10.10.8.32:80 ::ffff:198.143.33.89:40644 FIN_WAIT1
tcp 0 0 ::ffff:10.10.8.32:80 ::ffff:198.143.57.33:33563 FIN_WAIT2
tcp 0 17876 ::ffff:10.10.8.32:80 ::ffff:198.143.37.49:22712 FIN_WAIT1
tcp 0 17876 ::ffff:10.10.8.32:80 ::ffff:198.143.37.57:34413 FIN_WAIT1
tcp 0 1 ::ffff:10.10.8.32:80 ::ffff:198.143.37.57:34415 FIN_WAIT1
A little explanation for those who have no idea what NOBLOGREDIRECT is.
The define(‘NOBLOGREDIRECT’, ‘%siteurl%’); inside of the wp-config.php makes it so that when someone enters a subdomain that does not exist on your site to redirect to whatever url you wish it to. You can use this to have it either go to a specific FAQ page or directly back to the main root installation, anywhere you want to direct it. the %siteurl% can be replaced for example define(‘NOBLOGREDIRECT’, ‘http://frumph.net/FAQ/site-create’);
When someone in their browser tries to go to (for example) http://badsubdomain.frumph.net/ a subomain which doesn’t exist, it will go to what is defined in NOBLOGREDIRECT.
Without using NOBLOGREDIRECT the (for example) http://badsubdomain.frumph.net/ – which is a subdomain that doesn’t exist would direct to the signup page asking which reports whether or not the user can create the bad subdomain in question. This is fine, there’s nothing wrong with it redirecting to the signup page if someone put
@TheLastCicada
TheLastCicada / fixpw.php
Created September 7, 2018 20:34
Enhanced OneLogin Password Fix
<?php
/**
* This script search user with @@@nopass@@@ passwords and replace them by random passwords
*/
add_filter( 'send_password_change_email', '__return_false' );
$users = get_users();
foreach ($users as $user) {