Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
if grep 'Ubuntu\|Debian' /etc/issue; then
echo "Debian based distro detected; installing RVM"
sudo apt-get install -y libqt4-gui libqt4-dev cmake libssl-dev libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
curl -L https://get.rvm.io | bash -s stable --autolibs=enabled --ruby
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
elif grep 'Fedora' /etc/issue; then
echo "Fedora detected, not installing RVM"
sudo yum install -y gcc-c++ qt-devel cmake ruby-devel rubygems qtwebkit-devel qtwebkit
@maran
maran / gist:3005828
Created June 27, 2012 18:20
hack it
#!/usr/bin/env bash
# echo "65536 * 3 + 256 * 2 + 25" | bc
if [[ -n "${BASH_VERSION:-}" ]] &&
(( 65536 * ${BASH_VERSINFO[0]} + 256 * ${BASH_VERSINFO[1]} + ${BASH_VERSINFO[2]} < 197145 ))
then
echo "BASH 3.2.25 required (you have $BASH_VERSION)"
exit 1
fi
@maran
maran / rollback.sh
Created September 1, 2011 15:20
Rollback to 1.3.2
#!/bin/bash
wget http://git.deluge-torrent.org/deluge/snapshot/deluge-1.3.2.tar.gz
tar -zxvf deluge-1.3.2.tar.gz
virtualenv ~/deluge
source ~/deluge/bin/activate
cd ~/deluge-1.3.2
sed -ibackup s/-dev// setup.cfg
python setup.py clean -a
python setup.py build
python setup.py install
@maran
maran / _rounded.sass
Created July 23, 2011 20:28
rounded corners
@mixin rounded-corner($radius: 5px)
-moz-border-radius: $radius
-webkit-border-radius: $radius
border-radius: $radius
@mixin rounded-top-left-corner($radius: 5px)
-moz-border-radius-topleft: $radius
-webkit-border-top-left-radius: $radius
border-top-left-radius: $radius
class Media
belongs_to :mediable, :polymorphic => true
end
class Project
has_many :media, :as => :mediable
end
class Post
has_many :media, :as => :mediable
#!/usr/bin/env ruby
#
# usage: script/server_restarter
#
# Rails autoloading, while nice in theory, frequently doesn't work. Since Rails 2.3+
# is so fast when completely reloading the server, I wrote this script to listen to the
# given directories, and kill/restart the server when any file is changed.
#
# It's quick, simple, and it reliably reloads your application when changes are made.
#
class SimpleMailer
require 'net/smtp'
attr_accessor :email_from, :email_to
def initialize(email_from, email_to)
@email_from, @email_to = email_from, email_to
end
def happy_mail
message = <<MSG
@maran
maran / Unattended Rails (Passenger, Ruby Enterprise) Stack
Created December 17, 2008 20:24
Unattended Rails (Passenger, Ruby Enterpise) Stack
#!/bin/bash
# Unattended REE/Passenger installation
# Source: http://weblog.brightlight-ict.nl/2008/12/unattended-passenger-ruby-enterprise-installation-on-ubuntu-8/
# 15/03/09 Updated to use latest r.e.e. and passenger 2.1 and rewrote bits thanks to the comments left on my blog. Thanks guys
if [ "$(whoami)" != "root" ]; then
echo "You need to be root to run this!"
exit 2
fi