Skip to content

Instantly share code, notes, and snippets.

View mongris's full-sized avatar

M mongris

  • Auckland, New Zealand
View GitHub Profile

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

If you encounter errors like this ``fatal error: 'stdlib.h' file not foundon Yosemite and Xcode 6.0.1, your/usr/include/` is probably missing.

Try this command on Terminal:

sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include /usr/include
@mongris
mongris / boot.js
Last active August 29, 2015 14:07 — forked from jdx/boot.js
// This script will boot app.js with the number of workers
// specified in WORKER_COUNT.
//
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var cluster = require('cluster');
var workerCount = process.env.WORKER_COUNT || 2;
// Defines what each worker needs to run

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@mongris
mongris / gist:4dbd0a9b7f0c5dcd741d
Last active September 2, 2015 23:26 — forked from danielgtaylor/gist:0b60c2ed1f069f118562
Moving to ES6 from CoffeeScript

Moving to ES6 from CoffeeScript

I fell in love with CoffeeScript a couple of years ago. Javascript has always seemed something of an interesting curiosity to me and I was happy to see the meteoric rise of Node.js, but coming from a background of Python I really preferred a cleaner syntax.

In any fast moving community it is inevitable that things will change, and so today we see a big shift toward ES6, the new version of Javascript. It incorporates a handful of the nicer features from CoffeeScript and is usable today through tools like Babel. Here are some of my thoughts and issues on moving away from CoffeeScript in favor of ES6.

While reading I suggest keeping open a tab to Babel's learning ES6 page. The examples there are great.

Punctuation

Holy punctuation, Batman! Say goodbye to your whitespace and hello to parenthesis, curly braces, and semicolons again. Even with the advanced ES6 syntax you'll find yourself writing a lot more punctuatio

@mongris
mongris / git-subdir.sh
Created February 21, 2013 11:42
Detach subdirectory into separate Git repository from: http://stackoverflow.com/a/9510944
#!/bin/bash
#
# git-subdir.sh
#
git clone --no-hardlinks $1 $2
cd $2
git filter-branch --subdirectory-filter $2 --prune-empty --tag-name-filter cat HEAD -- --all
@mongris
mongris / git-rmsubdir.sh
Created February 21, 2013 11:49
Remove sub directory from git: git-rmsubdir.sh gitrepo subdir
#!/bin/bash
#
# git-rmsubdir.sh
#
cd $1
git filter-branch --index-filter "git rm -r -f --cached --ignore-unmatch $2" --prune-empty HEAD
@mongris
mongris / private.xml
Created February 22, 2013 05:25
private.xml for KeyRemap4MacBook
<?xml version="1.0"?>
<root>
<item>
<name>F19 to F19</name>
<appendix>(F19 to Hyper (ctrl+cmd+opt) + F19 Only, F19)</appendix>
<identifier>private.f192f19</identifier>
<autogen>
--KeyOverlaidModifier--
KeyCode::F19,
KeyCode::COMMAND_L,
#!/bin/bash
#
# Install Postgres 9.2 on a clean Ubuntu 12.04
"""
LC_ALL issue
comment out the AcceptEnv LANG LC_* line in the remote /etc/ssh/sshd_config file.
sudo apt-get install language-pack-en-base
sudo dpkg-reconfigure locales
comment out the SendEnv LANG LC_* line in the local /etc/ssh/ssh_config file.