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
| - hosts: localhost | |
| gather_facts: no | |
| vars: | |
| site: example.com | |
| user: bob | |
| scheme: https | |
| env_path: "{{ playbook_dir }}/tmp/environment" | |
| ansible_connection: local | |
| tasks: | |
| - name: Create /etc/environment |
| 62,66c62,68 | |
| < $cacheObj = json_decode($cacheFile); | |
| < if(isset($cacheObj->$user)){ | |
| < return $cacheObj->$user; | |
| < }else{ | |
| < throw new Exception("User does not exist in cache_keys. Try regenerating the cache."); | |
| --- | |
| > if ( $cacheFile ) { | |
| > $cacheObj = json_decode($cacheFile); | |
| > if(isset($cacheObj->$user)){ |
| class Class: | |
| pass | |
| x = Class() | |
| x.something = 42 | |
| print(x.something) # 42 |
| 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) } } | |
| #!/bin/bash | |
| # Copyright (c) 2009 Frogstarr78 Software | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining | |
| # a copy of this software and associated documentation files (the | |
| # "Software"), to deal in the Software without restriction, including | |
| # without limitation the rights to use, copy, modify, merge, publish, | |
| # distribute, sublicense, and/or sell copies of the Software, and to | |
| # permit persons to whom the Software is furnished to do so, subject to |
| module MethodsLikeSmalltalkConditionals | |
| module Kernel | |
| def is_true | |
| Proc.new { yield } | |
| end | |
| def is_false | |
| Proc.new { yield } | |
| end | |
| end |
| #!/usr/bin/env ruby | |
| module HashLikeSmalltalkConditionals | |
| class ::Object | |
| def nil? hash | |
| hash[:if_false].call | |
| self | |
| end | |
| end |