Skip to content

Instantly share code, notes, and snippets.

View mariusbutuc's full-sized avatar
🌏

Marius Butuc mariusbutuc

🌏
  • Toronto, ON
  • 05:59 (UTC -04:00)
View GitHub Profile
#
# = Capistrano database.yml task
#
# Provides a couple of tasks for creating the database.yml
# configuration file dynamically when deploy:setup is run.
#
# Category:: Capistrano
# Package:: Database
# Author:: Simone Carletti <[email protected]>
# Copyright:: 2007-2010 The Authors
@mariusbutuc
mariusbutuc / deploy.rb
Created February 28, 2013 20:32
`deploy:setup` is successful, yet `deploy:cold` / `deploy:check` fail
require 'bundler/capistrano'
default_run_options[:pty] = true
set :application, 'example'
# repo
set :scm, :git
set :repository, "[email protected]:mariusbutuc/#{application}.git"
set :branch, 'master'
# deploy
@mariusbutuc
mariusbutuc / chef_solo_bootstrap.sh
Last active December 14, 2015 05:58 — forked from ryanb/chef_solo_bootstrap.sh
Bootstrap Chef Solo
#!/usr/bin/env bash
# Apt-install various things necessary for Ruby etc.,
# and remove optional things to trim down the machine.
apt-get -y update
apt-get -y upgrade
apt-get -y install linux-headers-$(uname -r) build-essential
apt-get -y install zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev
apt-get -y install vim
apt-get -y install git-core
@mariusbutuc
mariusbutuc / events.js
Created February 6, 2013 16:54
How Marius understood Node's single threaded asynchronous-ness & events
var events = require('events');
var eventEmitter = new events.EventEmitter()
function mainLoop() {
console.log('starting application');
eventEmitter.emit('AppStart');
console.log('Running App');
eventEmitter.emit('AppRun');
[express (master)]$ node app.js
/Users/marius/Projects/spa/explore-node/express/app.js:2
var app = express();
^
TypeError: object is not a function
at Object.<anonymous> (/Users/marius/Projects/spa/explore-node/express/app.js:2:11)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
@mariusbutuc
mariusbutuc / .bashrc
Created December 1, 2012 17:27
Make git nicer
# Git tab completion
source ~/git-completion.bash
# Show branch in status line
PS1='[\W$(__git_ps1 " (%s)")]\$ '
export PROMPT_COMMAND='echo -ne "\033]0;${PWD/#$HOME/~}\007"'
@mariusbutuc
mariusbutuc / gist:4138546
Created November 24, 2012 05:21 — forked from davatron5000/gist:2254924
Static Site Generators

Backstory: I decided to crowdsource static site generator recommendations, so the following are actual real world suggested-to-me results. I then took those and sorted them by language/server and, just for a decent relative metric, their Github Watcher count. If you want a heap of other projects (including other languages like Haskell and Python) Nanoc has the mother of all site generator lists. If you recommend another one, by all means add a comment.

Ruby

@mariusbutuc
mariusbutuc / moodle2_backup.sh
Created November 22, 2012 17:55
BDU: Take online backup of MOODLE2 and store it in S3 script.
#!/bin/sh
###########################################################
#
# Take online backup of MOODLE2 and store it in S3 script.
#
###########################################################
echo '\n\n################# New MOODLE2 backup ################################################################' >> moodle2_backup.log
export DATABASE=MOODLE2
#!/bin/bash
# Argument = -e email -u username -i initials -v
usage()
{
cat << EOF
usage: $0 options
This script creates a new dev/test user on imcloud-devtest.torolab.ibm.com.
@mariusbutuc
mariusbutuc / devtest.sh
Created October 31, 2012 02:25
My first "real" bash script
#! /bin/bash
clear
case "$2" in
master) branches=(test develop master);;
dev) branches=(test develop);;
*) branches=(test);;
esac
for branch in ${branches[*]}