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 / 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

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 / .jshintrc
Last active September 12, 2016 11:17
jshintrc
{
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
//
// This is a options template for [JSHint][1], using [JSHint example][2]
// and [Ory Band's example][3] as basis and setting config values to
// be most strict:
//
// * set all enforcing options to true
@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},
@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

Set Wordpress file permissions and FS method on localhost

On Mac OS X (Leopard), the Apache HTTP Server runs under the user account, _www which belongs to the group _www. To allow WordPress to configure wp-config.php during installation, update files during upgrades, and update the .htaccess file for pretty permalinks, give the server write permission on the files.

One way to do this is to change the owner of the wordpress directory and its contents to _www. Keep the group as staff, a group to which your user account belongs and give write permissions to the group.

Step 1

$ cd //Sites/
@davidlonjon
davidlonjon / gist:cc542ef54c35af2c637a
Last active August 29, 2015 14:03
iptables useful commands and info
# Cleaning rules
iptables -F // flush all chains
iptables -A INPUT -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -t nat -F
iptables -t mangle -F
iptables -X // delete all chains
# install persistent iptables
sudo apt-get install -y iptables-persistent
@davidlonjon
davidlonjon / gist:811e610e36568353e214
Last active August 29, 2015 14:03
web server - iptables firewall rules
*filter
# Base policy: Allow outgoing traffic and disallow any passthroughs
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
# Accepts all established inbound connections
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT -m comment --comment "allow already established connections"
# Default settings that all others account inherit
defaults
auth on
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
# Logging - uncomment either syslog or logfile, having both uncommented disables logging at all.
#syslog on
# Or to log to log own file
logfile /var/log/msmtp.log
@davidlonjon
davidlonjon / gist:5dbe61f4c3ddecd5ce73
Created July 11, 2014 05:32
Mobile Menu Button in Pure CSS
// Taken from http://www.alwaystwisted.com/post.php?s=2012-05-12-create-a-pure-css-menu-button
.btn {
position: relative;
margin-top:2%;
border: 2px solid black;
border-radius: 2px;
height: 36px;
width:36px;
}