Skip to content

Instantly share code, notes, and snippets.

@whiteinge
whiteinge / fabfile.py
Created Nov 13, 2009
Example fabric script with VirtualBox automation
View fabfile.py
# -*- coding: utf-8 -*-
"""MyCompany Fabric script.
* Deploy code
* Set up a local development environment
There are two ways to deploy the myrepo code:
1. :func:`deploy` will do a full virtualenv installation/update and expand a
tarball of the specified git revision (defaults to HEAD) to a timestamped
View wordpress.rb
require 'rubygems'
require 'sequel'
require 'fileutils'
# NOTE: This converter requires Sequel and the MySQL gems.
# The MySQL gem can be difficult to install on OS X. Once you have MySQL
# installed, running the following commands should work:
# $ sudo gem install sequel
# $ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
@substack
substack / mkdir_p.js
Created Nov 20, 2010
mkdir -p in node.js
View mkdir_p.js
var path = require('path');
var fs = require('fs');
module.exports = function mkdirP (p, mode, f) {
var cb = f || function () {};
if (p.charAt(0) != '/') { cb('Relative path: ' + p); return }
var ps = path.normalize(p).split('/');
path.exists(p, function (exists) {
if (exists) cb(null);
@katta
katta / mvncolor.sh
Created Jun 15, 2011
Script to add colors to maven output
View mvncolor.sh
#!/usr/bin/env bash
# Formatting constants
export BOLD=`tput bold`
export UNDERLINE_ON=`tput smul`
export UNDERLINE_OFF=`tput rmul`
export TEXT_BLACK=`tput setaf 0`
export TEXT_RED=`tput setaf 1`
export TEXT_GREEN=`tput setaf 2`
export TEXT_YELLOW=`tput setaf 3`
@kmpm
kmpm / fabfile.py
Created Sep 8, 2011
Fabric deployment of Node.js on Ubuntu
View fabfile.py
from __future__ import with_statement
from fabric.api import env
from fabric.api import *
from fabric.contrib.console import confirm
from fabric.contrib.project import upload_project
import ubuntu
import protobuf
@marcinb
marcinb / bbc_recipes.coffee
Created Oct 7, 2011
Chicken soup recipes
View bbc_recipes.coffee
page = require('webpage').create()
injectjQuery = ->
# phantom allows to dynamically inject any javascript
# into page context.
# Make sure you add jquery to your script dir.
page.injectJs './jquery.js'
# ALWAYS do that when injecting jQuery into other page
page.evaluate ->
@devudilip
devudilip / SUBLIME TEXT2 INSTALLATION
Created Oct 22, 2011
HOW TO INSTALL SUBLIME TEXT 2 ON UBUNTU 11.10
View SUBLIME TEXT2 INSTALLATION
#BECOME SUPER USER#
sudo -i
#add sublime to repository#
add-apt-repository ppa:webupd8team/sublime-text-2
#update#
@boriscy
boriscy / install-ruby-debug-ubuntu-ruby-1.9.3
Created Nov 1, 2011
ruby-debug in ruby-1.9.3 and ubuntu
View install-ruby-debug-ubuntu-ruby-1.9.3
#To install ruby-debug on Ubuntu ruby-1.9.3 you need to download from http://rubyforge.org/frs/?group_id=8883
linecache19-0.5.13.gem
ruby_core_source-0.1.5.gem
ruby-debug19-0.11.6.gem
ruby-debug-base19-0.11.26.gem
#Then in your console
export RVM_SRC=/your/path/to/ruby-1.9.3
View gist:1391824
/**
* Copyright (c) 2011 Red Hat, Inc.
*
* This software is licensed to you under the GNU General Public License,
* version 2 (GPLv2). There is NO WARRANTY for this software, express or
* implied, including the implied warranties of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
* along with this software; if not, see
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
*
@emk
emk / apache-logs-hive.sql
Created Jan 3, 2012
Apache log analysis with Hadoop, Hive and HBase
View apache-logs-hive.sql
-- This is a Hive program. Hive is an SQL-like language that compiles
-- into Hadoop Map/Reduce jobs. It's very popular among analysts at
-- Facebook, because it allows them to query enormous Hadoop data
-- stores using a language much like SQL.
-- Our logs are stored on the Hadoop Distributed File System, in the
-- directory /logs/randomhacks.net/access. They're ordinary Apache
-- logs in *.gz format.
--
-- We want to pretend that these gzipped log files are a database table,