Skip to content

Instantly share code, notes, and snippets.

@shkrid
shkrid / nginx-elasticsearch-proxy.conf
Created February 25, 2017 08:07 — forked from karmi/nginx-elasticsearch-proxy.conf
Route requests to ElasticSearch to authenticated user's own index with an Nginx reverse-proxy
# Run me with:
#
# $ nginx -p /path/to/this/file/ -c nginx.conf
#
# All requests are then routed to authenticated user's index, so
#
# GET http://user:password@localhost:8080/_search?q=*
#
# is rewritten to:
#
@shkrid
shkrid / install-comodo-ssl-cert-for-nginx.rst
Created February 23, 2017 06:34 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@shkrid
shkrid / Documentation.md
Created February 1, 2017 13:23 — forked from KartikTalwar/Documentation.md
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@shkrid
shkrid / parse-slow-log.sh
Created December 27, 2016 11:44 — forked from JCotton1123/parse-slow-log.sh
Parse php-fpm slow log
## Slow requests grouped by function call
cat /var/log/php-fpm/www-slow.log | grep -A 1 script_filename | \
grep -v script_filename | grep -v -e "--" | cut -c 22- | sort | uniq -c | sort -nr
## Slow requests grouped by minute
cat /var/log/php-fpm/www-slow.log | grep 'pool www' | \
cut -d' ' -f2 | sort | cut -d: -f1,2 | uniq -c
## Top 25 1 minute groups of slow requests
cat /var/log/php-fpm/www-slow.log | grep 'pool www' | cut -d' ' -f2 | \
root@orangepipcplus:~# apt-get install iptables-persistent dnsmasq
root@orangepipcplus:~# iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE
root@orangepipcplus:~# service netfilter-persistent save
wget -P /etc https://raw.githubusercontent.com/igorpecovnik/hostapd/master/hostapd.conf/hostapd.conf
root@orangepipcplus:~# cat /etc/hostapd.conf | grep "pass\|ssid"
ssid=SSID
wpa_passphrase=12345678
FROM phusion/baseimage
MAINTAINER YOUR NAME <YOUR EMAIL>
CMD ["/sbin/my_init"]
RUN apt-get update && apt-get install -y python-software-properties
RUN add-apt-repository ppa:nginx/stable
RUN apt-get update && apt-get install -y nginx
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
@shkrid
shkrid / kapture.sh
Last active December 28, 2017 15:41 — forked from nmarley/kapture.sh
OSX can capture WiFi packets using only tcpdump (and without needing a clunky interface such as KisMAC).Used for testing security strength of home WiFi setup.
#! /bin/bash
# This is for Mac OSX only.
# =============================================
# explanation of arguments used with 'tcpdump':
# =============================================
# -y IEEE802_11_RADIO => makes it capture __WIFI__ packets, turns resultant file
# into a dump which can be read by aircrack-ng, etc.
#
# -I => puts interface into monitor mode (required to capture packets)