Skip to content

Instantly share code, notes, and snippets.

@umuro
umuro / gemset.thor
Created August 20, 2012 13:08
Thor: Create new RVM gemsets by example for new Rails projects
# kate: syntax ruby;
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'rubygems'
require 'thor'
class Gemset < Thor
include Thor::Actions
@umuro
umuro / template_umur_demo_blog.rb
Created August 17, 2012 14:05
Rails 3 template to create a demo blog
# Usage example: rails new demo_blog -m template_umur_demo_blog.rb
# 2 points demonstrated
# - Templates are powerful. You can create even a working application
# - Ruby on Rails is very DRY. Code reads as if it's design
# Required gems
gem 'therubyracer', :platforms => :ruby, :group=>:assets #Rails need
gem 'inherited_resources'
gem 'has_scope'
@umuro
umuro / Ruby header.rb
Created June 4, 2012 10:51
Ruby colorize non-rb files. Enable ruby coloring on files that does not end with .rb
# kate: syntax ruby;
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Add those comments to colorize non-rb files automatically. It happens that not all ruby files have the rb extension.
@umuro
umuro / gist:1082722
Created July 14, 2011 15:54
Making a normal big normal linux volume spanning many NFS and/or SAMBA mounts. Simply create a gigantic volume across available shares over the network.
#### 1. Mount WD ShareSpace over NFS and cache it. Note the mount options, they are must.
#$ sudo apt-get install cachefsd
#### 2. Create 2 ext4 files systems
## e.g.
#$ dd if=/dev/zero of=/mnt/wd/book1.img bs=1 count=0 seek=2045G
#$ mkfs.ext4 -Lbook1 /mnt/wd/book1.img
#### 3. Merge them and enjoy big normal linux file system
#$ nano /etc/fstab
@umuro
umuro / gist:257831
Created December 16, 2009 13:50
Backup LINUX
# Regularly execute this to have a nice difference backup
# No Restore. Backups of different dates will be available as if normal folders.
# Just use them normally.
# On each backup the list of apt-get installed applications are dumped so that
# they can be restored simply. You don't wast space to backup the whole system.
echo Getting package selections
dpkg --get-selections >/home/packages.txt
TGT=/media/Elements-1 #!!!! Define your backup target here !!!!
@umuro
umuro / .bashrc.sh
Created March 24, 2009 16:34
My .bashrc; color prompt with current GIT and RVM info... And other improvements...
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
#[ -z "$PS1" ] && return
if [[ -n "$PS1" ]] ; then
# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoreboth
@umuro
umuro / .irbrc *.rb
Created March 18, 2009 16:34
IRB improvements: Command history, coloring, more shell like commands cd, pwd, dir, cat
# kate: syntax ruby;
# -*- mode: ruby -*-
# vi: set ft=ruby :
# IRB improvements: Command history, coloring, more shell like commands cd, pwd, dir, cat
# Use powerful shell commands
# dir
# dir '**/*.rb'
# cd 'app'
# pwd