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
# IDEA Ignores #
################
*.iml
*.ipr
*.iws
.idea/
out/
local.properties
# Generic Android ignores #
@davidlonjon
davidlonjon / update-hostname.sh
Last active November 8, 2015 13:41
Update hostname
#!/bin/bash
# Update hostname
# by David Lonjon (@davidlonjon)
#
# The script update a machine hostname.
# reboot is required after running this script
#
# LICENSE: GPLv2+
#
# INSTALLATION:
@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"
@davidlonjon
davidlonjon / zshrc
Created October 4, 2015 10:02 — forked from hangyan/zshrc
check tools installed via brew on mac
function brew_check() {
brew $2 info $1 | grep -q "Not installed"
}
function brew_install() {
tool=$(echo $1 | awk '{print $1}')
cask=$(echo $1 | awk '{print $2}')
brew_check $tool $cask
[[ $? -eq 0 ]] && echo -e "Installing $tool..." && brew $cask install $tool
# activewindow.scpt - track your active window and Chrome web page on OSX
# USAGE:
# while true; do osascript activewindow.scpt | tee -a log.log; sleep 1; done
# LICENSE: Public Domain
set _url to ""
tell application "System Events"
set _app to name of first application process whose frontmost is true
end tell
@davidlonjon
davidlonjon / README.md
Last active August 29, 2015 14:26 — forked from hofmannsven/README.md
My simply Git Cheatsheet