Skip to content

Instantly share code, notes, and snippets.

View davidlonjon's full-sized avatar
🏠
Working from home

David Lonjon davidlonjon

🏠
Working from home
View GitHub Profile
@davidlonjon
davidlonjon / nohup-output-to-file.sh
Created September 26, 2016 05:55 — forked from umidjons/nohup-output-to-file.sh
Redirect nohup output to a file
# redirect output and errors into file output.log:
nohup some_command > output.log 2>&1&
# abbreviated syntax for bash version >= ver.4:
nohup some_command &> output.log
@davidlonjon
davidlonjon / Documentation.md
Created April 24, 2016 13:19 — 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
@davidlonjon
davidlonjon / gist:3771485984b799045b43
Created March 11, 2016 07:40 — forked from ssx/gist:2649191
WordPress: WP_Query $args Ultimate Reference
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
@davidlonjon
davidlonjon / pedantically_commented_playbook.yml
Created January 12, 2016 12:26 — forked from marktheunissen/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@davidlonjon
davidlonjon / pricing.txt
Created November 27, 2015 08:17 — forked from thbkrkr/pricing.txt
Amazon AWS vs Google Compute Engine (GCE) vs DigitalOcean vs OVH RunAbove
------------
Amazon (http://calculator.s3.amazonaws.com/index.html)
------------
type price CPU RAM Disk I/O EBS opt.
t2.micro 10$ 1 1.0 -- Low --
t1.micro 15$ 1 0.6 -- Very Low --
t2.small 10$ 1 2.0 -- Low --
m1.small 34$ 1 1.7 1 x 160 Low --
t2.medium 41$ 2 4.0 -- Low --
m3.medium 56$ 1 3.7 SSD 1 x 4 Moderate --
@davidlonjon
davidlonjon / NginxRedirect.md
Created November 7, 2015 08:39 — forked from esfand/NginxRedirect.md
Nginx Redirect

Redirect: Temporary and Permanent

Source

What is an HTTP Redirect?

HTTP redirection, or URL redirection, is a technique of pointing one domain or address to another. There are many uses for redirection, and a few different kinds of redirection to consider.

As you create content and administrate servers, you will often find the need to redirect traffic from one place to another. This guide will discuss the different use-cases for these techniques, and how to accomplish them in Apache and Nginx.

@davidlonjon
davidlonjon / autopgsqlbackup
Created October 25, 2015 05:14 — forked from matthewlehner/autopgsqlbackup
Auto PostgreSQL backup script.
#!/bin/bash
#
# PostgreSQL Backup Script Ver 1.0
# http://autopgsqlbackup.frozenpc.net
# Copyright (c) 2005 Aaron Axelsen <axelseaa@amadmax.com>
#
# This script is based of the AutoMySQLBackup Script Ver 2.2
# It can be found at http://sourceforge.net/projects/automysqlbackup/
#
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9
@davidlonjon
davidlonjon / gist:687cd7604f14aa986d78
Created October 18, 2015 03:07 — forked from getify/gist:7ae82fdc2e86bf66bcba
List of ES6 books either out or in progress...
@davidlonjon
davidlonjon / iptables.sh
Created October 9, 2015 13:43 — forked from thomasfr/iptables.sh
iptable rules to allow outgoing DNS lookups, outgoing icmp (ping) requests, outgoing connections to configured package servers, outgoing connections to all ips on port 22, all incoming connections to port 22, 80 and 443 and everything on localhost
#!/bin/bash
IPT="/sbin/iptables"
# Server IP
SERVER_IP="$(ip addr show eth0 | grep 'inet ' | cut -f2 | awk '{ print $2}')"
# Your DNS servers you use: cat /etc/resolv.conf
DNS_SERVER="8.8.4.4 8.8.8.8"
# Allow connections to this package servers
@davidlonjon
davidlonjon / post-receive.sh
Created October 9, 2015 13:16 — forked from ryansechrest/post-receive.sh
Git post-receive hook to deploy WordPress and plugins as submodules. It can also install Node.js modules with npm and vendor packages with Composer.
#!/bin/bash
# Created on 7/17/13 by Ryan Sechrest
# Deploys pushed branch from the origin repository to the web directory
if [[ (-n $1) && (-n $2) && (-n $3) ]]; then
# Set path to project directory
project_path="/var/www/domains/$2/$3"