Skip to content

Instantly share code, notes, and snippets.

View devsigner's full-sized avatar

Cedric Darricau devsigner

  • France
View GitHub Profile

How to resize VM

first Shut down the virtual machine

virsh shudown image.qcow2

then Resize the image with

qemu-img resize image.qcow2 +SIZE

@devsigner
devsigner / SnippetFile
Created November 28, 2015 17:11
Ruby Hash with Range key
# Hash with range keys
#---------------------
# ex:
# h = range_hash({})
# h[1..3] = 'v1'
# h[8..12] = 'v2'
#=> { 1..3 => 'v1', 8..12 => 'v2' }
#
# h[2..5] #=> 'v1'
# h[4..6] #=> nil
(function($){
//Finding min and max values in array from http://snippets.dzone.com/posts/show/769
Array.prototype.min = function(){ return Math.min.apply({},this) };
Array.prototype.max = function(){ return Math.max.apply({},this) };
$.fn.masonry = function() {
this.each(function() {
var wall = $(this);
#---------------------
# how to use:
# h = range_hash({})
# h[1..3] = 'v1'
# h[8..12] = 'v2'
# h #=> { 1..3 => 'v1', 8..12 => 'v2' }
#
# h[2..5] #=> 'v1'
# h[4..6] #=> nil
@devsigner
devsigner / .a_README.markdown
Created June 14, 2014 22:10 — forked from jondkinney/README.md
jondkinney's console vim setup

Console VIM and Tmux setup compatible with Mac OS X and Linux.

Disclaimer: This file is called .a_README.markdown so that it'll appear first in the gist view (sorry for the horrible name)

Installation

Because this script prompts for user input, you have to execute it in a bit of an odd way. From a new command prompt simply copy and paste the following command and press return:

Console VIM and Tmux setup compatible with Mac OS X and Linux.

Disclaimer: This file is called .a_README.markdown so that it'll appear first in the gist view (sorry for the horrible name)

Installation

Because this script prompts for user input, you have to execute it in a bit of an odd way. From a new command prompt simply copy and paste the following command and press return:

@devsigner
devsigner / setup_load_paths.rb
Created October 29, 2012 17:07
in config/ : set RVM version for passneger.
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
begin
gems_path = ENV['MY_RUBY_HOME'].split(/@/)[0].sub(/rubies/,'gems')
ENV['GEM_PATH'] = "#{gems_path}:#{gems_path}@global"
require 'rvm'
RVM.use_from_path! File.dirname(File.dirname(__FILE__))
rescue LoadError
raise "RVM gem is currently unavailable."
end
end
@devsigner
devsigner / gist:3965107
Created October 27, 2012 15:40 — forked from nhocki/gist:1164315
Reverse proxy for passenger in apache server
# In the apps root directory run
# http://blog.phusion.nl/2010/09/21/phusion-passenger-running-multiple-ruby-versions/
# passenger start -a localhost -p 3000 -e production -d
<VirtualHost *:80>
ServerName ranking.timehub.net
DocumentRoot /the/path/to/the/app/public
PassengerEnabled off
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/