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 / tmux.md
Last active August 29, 2015 14:08 — forked from andreyvit/tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@davidlonjon
davidlonjon / .jscsrc
Last active August 29, 2015 14:20
.jscsrc
{
"requireCurlyBraces": [ "if", "else", "for", "while", "do" ],
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"requireSpacesInFunctionDeclaration": {"beforeOpeningCurlyBrace": true},

Keybase proof

I hereby claim:

  • I am davidlonjon on github.
  • I am davidlonjon (https://keybase.io/davidlonjon) on keybase.
  • I have a public key whose fingerprint is 0BBE C470 E999 1456 82CC 8482 9088 BE9F D8D4 64DC

To claim this, I am signing this object:

@davidlonjon
davidlonjon / memcache.rb
Created July 27, 2015 16:12
Command line tool to list memcache keys and to get the value of a specific key
#!/usr/bin/env ruby
# Originally taken from https://gist.github.com/chriskk/3168935
# Only tested with ruby 1.9.3p551 (can be installed following the instructions at http://poincare101.herokuapp.com/post/25)
# It also requires 'Trollop' to be installed (See http://trollop.rubyforge.org/)
# Finally change this script permission to make it executable (chmod 755 memcache.rb)
require 'net/telnet'
require 'trollop'
opts = Trollop::options do
banner <<-EOS
@davidlonjon
davidlonjon / README.md
Last active August 29, 2015 14:26 — forked from hofmannsven/README.md
My simply Git Cheatsheet
# 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 / 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
@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 / 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 / gist:687cd7604f14aa986d78
Created October 18, 2015 03:07 — forked from getify/gist:7ae82fdc2e86bf66bcba
List of ES6 books either out or in progress...