Skip to content

Instantly share code, notes, and snippets.

@nofxx
nofxx / errbit-unicorn.service
Created Jan 5, 2015
errbit unicorn systemd service
View errbit-unicorn.service
[Unit]
Description=Errbit Unicorn Server
Requires=mongodb.service
After=mongodb.service network.target
[Service]
# Change here: user, group and directory to errbit root
User=errbit
Group=errbit
WorkingDirectory=/var/www/apps/errbit
@marczych
marczych / gist:10524654
Last active Aug 29, 2015
Tmux git-scripts functions
View gist:10524654
#!/bin/sh
# Convenience functions to set the tmux session name based on branches/pull
# numbers and switches branches based on the session name.
#
# Depends on tmux and https://github.com/iFixit/git-scripts.
# (feature|hotfix) switch based on the session name.
function tswitch {
BRANCH=$(tmux display-message -p '#S' | sed 's/|.*$//')
@sturadnidge
sturadnidge / tmux-1.8-on-CentOS-6.x.txt
Last active Jun 20, 2019
Install tmux 1.8 on CentOS 6.x minimal (64bit)
View tmux-1.8-on-CentOS-6.x.txt
# download latest libevent2 and tmux sources, and extract them somewhere
# (thx bluejedi for tip on latest tmux URL)
#
# at the time of writing:
# https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
# http://sourceforge.net/projects/tmux/files/latest/download?source=files
#
# install deps
yum install gcc kernel-devel make ncurses-devel
@marczych
marczych / gist:3882918
Created Oct 13, 2012
Vim: Take the word under the cursor, append the current buffer's extension, and open it using find.
View gist:3882918
nnoremap <silent> <C-o> :call FindFile()<CR>
function! FindFile()
" Get the word under cursor.
let cursorWord = expand("<cword>")
" Get the current file name and keep only the extension.
let currentFile = expand("%")
let extPos = stridx(currentFile, ".")
" Append an extension only if the current file has an extension.
View tmux_cheatsheet.markdown

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@taf2
taf2 / reconnect-on-disconnect.js
Created Jul 1, 2011
mongoose node.js reconnect code
View reconnect-on-disconnect.js
var mongoose = require('mongoose');
var db = mongoose.connect("mongodb://localhost/testdb");
var reconnTimer = null;
function tryReconnect() {
reconnTimer = null;
console.log("try to connect: %d", mongoose.connection.readyState);
db = mongoose.connect("mongodb://localhost/testdb");
}
@naltatis
naltatis / facebook-xmpp.js
Created May 9, 2011
connecting to Facebook via node-xmpp
View facebook-xmpp.js
var client = new xmpp.Client({
jid: '-123456@chat.facebook.com', // where 123456 is the users facebook id
api_key: apiKey, // api key of your facebook app
secret_key: secretKey, // secret key of your facebook app
session_key: sessionKey // users current session key
});
// you can find more details here http://developers.facebook.com/docs/chat/
@SathyaBhat
SathyaBhat / gist:894012
Created Mar 30, 2011
Chrome extensions keyboard shortcut handler
View gist:894012
/*
Right here's the thing - for keyPress events to be run, you'll have to make use of
content scripts. Content scripts handle things at webpage & DOM level. You'll have
to do changes to your manifest:
*/
------------------------
manifest.json:
------------------------
/*
Note: don't replace manifest.json, add the relevant changes else
View Request.XDR.js
if (window.XDomainRequest) (function(){
var onLoad = function(){
cleanup(this.xhr);
this.response = {text: this.xhr.responseText, xml: this.xhr.responseXML};
this.success(this.response.text, this.response.xml);
};
var onError = function(){
cleanup(this.xhr);