Skip to content

Instantly share code, notes, and snippets.

@brianmcdo
brianmcdo / gist:8159711
Last active June 10, 2020 10:07
Install/Uninstall ElasticSearch on Ubuntu/Debian using .deb package.
Remember to install the Java JRE first.
Please see the Elasticsearch website for the latest version: http://www.elasticsearch.org/download/
wget .deb file
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.9.deb
Install
sudo dpkg -i elasticsearch-0.90.9.deb
server {
listen 80;
server_name example.com;
root /src/path/to/laravel/public;
charset utf-8;
location /
{
index index.php index.html;
## Magento Standard Config
server {
listen 80;
listen 443 default ssl;
## SSL START ##
ssl_certificate /srv/certs/example.com/ssl-bundle.crt;
ssl_certificate_key /srv/certs/example.com/key.key;
ssl_session_cache shared:SSL:2m;
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
'AL'=>'ALABAMA',
'AK'=>'ALASKA',
'AS'=>'AMERICAN SAMOA',
'AZ'=>'ARIZONA',
'AR'=>'ARKANSAS',
## To create a custom config for a mod create a file with the same name
## as the jar file and append ".conf", for craftbukkit this would be
## "craftbukkit.jar.conf".
## The following config is an example that lists all possible options,
## without actually changing anything (it remaps the commands on
## themselves)
##
## General configuration. If this contains a setting called "file" the
## [commands], [start] and [parse_*] sections will be loaded from this
## other file
server {
listen 80; ## listen for ipv4; this line is default and implied
server_name munin.example.com;
location / {
alias /var/cache/munin/www/;
}
location ^~ /munin-cgi/munin-cgi-graph/ {
@brianmcdo
brianmcdo / preprocessor_fun.h
Created December 19, 2015 07:04 — forked from aras-p/preprocessor_fun.h
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@brianmcdo
brianmcdo / nginx-ssl
Created April 17, 2016 04:36
nginx-ssl
ssl_session_cache shared:ssl_session_cache:10m;
ssl_certificate /path/to/bundle.crt;
ssl_certificate_key /path/to/certificate.key;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
include sslconfig/conf;
@brianmcdo
brianmcdo / image-proxy.php
Last active March 12, 2019 20:56
Image Proxy PHP
<?php
class Proxy {
protected $allowed = [];
public function __construct()
{
if(!isset($_GET['url'])) {
header("HTTP/1.0 404 Not Found");