Skip to content

Instantly share code, notes, and snippets.

@redoPop
redoPop / .gitignore
Created June 18, 2010 22:08
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@eliOcs
eliOcs / gist:3514963
Created August 29, 2012 16:10
Missing parameter middleware for Restify (Node.js)
server.use((function () {
var
/**
* Checks if a request parameter has been defined.
*/
contains = function (parameter) {
return this.params[parameter] !== undefined;
},
/**
@UtahDave
UtahDave / saltsample_09252012_01
Created September 26, 2012 02:54 — forked from l2ol33rt/saltsample_09252012_01
Saltstack sample of using states and pillars for users
Here is a sample of how I am currently dealing with users.
Big thanks to uggedal! I used his user states as an example: https://github.com/uggedal/states
###
# How to create password hashes
###
python -c "import crypt; print crypt.crypt('password', '\$6\$SALTsalt\$')"
###
@nz
nz / gist:6322673
Created August 23, 2013 18:46
Basic sketch for renaming an index in Elasticsearch
# create an index with some state (in this case, a mapping)
curl -X POST localhost:9200/test-original -d '{"mappings":{"wine":{"properties":{"designation":{"type":"string"},"full_name":{"type":"string"},"winery":{"type":"string"},"style":{"index":"no","type":"string"},"vintage":{"index":"no","type":"string"},"restaurant_ids":{"index":"no","type":"string"},"appellation":{"type":"string"},"vineyard_name":{"type":"string"},"variety_id":{"index":"no","type":"string"},"country":{"type":"string"}}}}}'
# => {"ok":true,"acknowledged":true}
# verify the mapping
curl localhost:9200/test-original/_mapping
# => {"test-original":{"wine":{"properties":{"appellation":{"type":"string"},"country":{"type":"string"},"designation":{"type":"string"},"full_name":{"type":"string"},"restaurant_ids":{"type":"string","index":"no"},"style":{"type":"string","index":"no"},"variety_id":{"type":"string","index":"no"},"vineyard_name":{"type":"string"},"vintage":{"type":"string","index":"no"},"winery":{"type":"string"}}}}}
# copy the inde
@tomeduarte
tomeduarte / gist:6340205
Last active August 22, 2024 14:20
Sample (and simple) NGINX configuration as a load-balancer, using SaltStack's peer communication to retrieve list of backend servers.
# /srv/salt/shared/nginx/files/sites-available/default.lb
upstream app_nodes {
# Build list of backend servers
# using peer communication as the mine is cached and slow to pick up new hosts
{% for server,ips in
salt['publish.publish'](
'G@roles:appnode',
'network.ip_addrs', expr_form='compound').items() -%}
# host: {{ server }}
{% for ip in ips -%}
@plentz
plentz / nginx.conf
Last active May 21, 2025 05:22
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@benschw
benschw / Dockerfile
Last active October 1, 2018 18:30
MySQL Docker Container
FROM ubuntu
RUN dpkg-divert --local --rename --add /sbin/initctl
RUN ln -s /bin/true /sbin/initctl
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get -y install mysql-client mysql-server
@sroegner
sroegner / gist:8337806
Created January 9, 2014 17:04
salt-cloud provider config example with vpc
myprovider:
provider: ec2
ssh_interface: private_ips
id: JHHJHUHLLJLKKLK>NKLL
key: 'lnjfelvehvho4of24fn2nf02[fn3ov3sfk'
private_key: /etc/salt/automation.pem
keyname: automation
securitygroupid:
- sg-abcdef12
- sg-abcdef13
@deian
deian / gist:f2de2f1c33580ed1b3fd
Created May 25, 2014 01:56
Using OpenPGP.JS to verify signature of a file
"use strict";
var fs = require('fs');
var path = require('path');
var assert = require('assert');
var async = require('async');
var crypto = require('crypto');
var pgp = require('openpgp');
@parente
parente / install_latest_docker.sh
Last active February 6, 2022 17:35
Install Docker latest on Ubuntu 14.04 with AUFS as the storage driver
#!/bin/bash
sudo apt-get update
sudo apt-get -y install linux-image-extra-$(uname -r)
sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\ > /etc/apt/sources.list.d/docker.list"
sudo apt-get update
sudo apt-get -y install lxc-docker