This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.
Step 1 - Enable NBD on the Host
modprobe nbd max_part=8
| class Class: | |
| pass | |
| x = Class() | |
| x.something = 42 | |
| print(x.something) # 42 |
| urlencode() { | |
| # urlencode <string> | |
| old_lc_collate=$LC_COLLATE | |
| LC_COLLATE=C | |
| local length="${#1}" | |
| for (( i = 0; i < length; i++ )); do | |
| local c="${1:$i:1}" | |
| case $c in |
| require 'benchmark' | |
| require 'Functional' | |
| Benchmark.bmbm 30 do |bm| | |
| f = Functional.new | |
| bm.report( "define fib 1" ) { f.define( :fib, 1 ) { 1 } } | |
| bm.report( "define fib 2" ) { f.define( :fib, 2 ) { 1 } } | |
| bm.report( "define fib Fixnum" ) { f.define( :fib, Fixnum ) {|n| fib(n-1) + fib(n-2) } } | |
| # How to print the stacktrace from anywhere : | |
| # 1° | |
| #------------------------------------------------------------------------------ | |
| module Kernel | |
| def print_stacktrace | |
| raise | |
| rescue | |
| puts $!.backtrace[1..-1].join("\n") | |
| end |