Skip to content

Instantly share code, notes, and snippets.

@andreipak
andreipak / gist:2731597
Created May 19, 2012 17:28 — forked from mhawksey/gist:1106744
Bunch of Google Apps Script snippets for getting social bookmark/share counts. Used in http://mashe.hawksey.info/2011/07/shared-counts/
/*
All code apart from getPlusones()
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@andreipak
andreipak / tmux.cheat
Created February 15, 2013 10:39 — forked from afair/tmux.cheat
========================================== WINDOW (TAB)
TMUX COMMAND ==========================================
==========================================
List ^b w
List tmux ls Create ^b c
New -s <session> Rename ^b , <name>
Attach att -t <session> Last ^b l (lower-L)
Rename rename-session -t <old> <new> Close ^b &
Kill kill-session -t <session>
Goto # ^b <0-9>
RVM home page: http://rvm.beginrescueend.com
Install RVM
------------
See http://rvm.beginrescueend.com/rvm/install/
bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
Install rvm for all users
#!./bin/knife exec
# A knife exec script to change chef node's name, preserving all the attributes.
#
# Usage: knife exec rename-node.rb old-name new-name
#
# Script retrieves the Node object, changes its 'name' attribute,
# creates new Node object with updated name and rest of attributes
# untouched. Then it deletes old Node and Client objects from
# database, and logs into the server to update it:
# vim: ft=sh:ts=4:sw=4:autoindent:expandtab:
# Author: Avishai Ish-Shalom <avishai@fewbytes.com>
# We need to specify GNU sed for OS X, BSDs, etc.
if [[ "$(uname -s)" == "Darwin" ]]; then
SED=gsed
else
SED=sed
fi
@andreipak
andreipak / knife.sh
Created May 20, 2013 08:14 — forked from nukemberg/knife.sh
bash completion for Chef's knife command (updated for 0.10)
# vim: ft=sh:ts=4:sw=4:autoindent:expandtab:
# Author: Avishai Ish-Shalom <avishai@fewbytes.com>
# We need to specify GNU sed for OS X, BSDs, etc.
if [[ "$(uname -s)" == "Darwin" ]]; then
SED=gsed
else
SED=sed
fi

Compiling/Installing Node 0.8.4 (and Python 2.6, required by Node) on CentOS 5

Update system packages -- will migrate system forward to CentOS 5.8. (Optional?)

$ sudo yum update

Install the EPEL Repo:

@andreipak
andreipak / _knife
Created February 24, 2014 19:56 — forked from ywatase/_knife
#compdef knife
_knife_all_subcommand_with_desc () {
_subcommands=(${(@f)"$(knife --help | perl -e 'while(<>){/\A\*\*\s(.+)(?:\sCOMMANDS)?\s\*\*\s*\z/ or next; (my $desc = lc($1))=~s/\s+commands//;($line = <>)=~/knife\s($desc)/; print qq{$1\n$desc\n};}')"})
_1st_arguments=(${(k)_subcommands})
}
_knife_subsubcommand() {
_2nd_arguments=(${(@f)"$(knife $1 --help | perl -nle "/^knife\\s$1\\s(.*)/; print \$1;")"})
}
@andreipak
andreipak / onchange.sh
Created February 28, 2014 06:17 — forked from senko/onchange.sh
#!/bin/bash
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <senko.rasic@dobarkod.hr>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of