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
| // | |
| // !!WARNING: Not recommended for production code!! | |
| // | |
| public class ClassLoaderActivity extends Activity | |
| { | |
| public void onCreate(Bundle savedInstanceState) | |
| { | |
| // file.jar has a dex'd "classes.dex" entry that you can generate with "dx" from any number of JARs or class files | |
| ClassLoader dexLoader = new DexClassLoader("/path/to/file.jar", getCacheDir().getAbsolutePath(), null, getClassLoader()); | |
| setAPKClassLoader(dexLoader); |
| #!/bin/bash | |
| #Author Jobin Joseph | |
| #Blog : nixhive.com | |
| #Bio : JobinJoseph.com | |
| #Bitbucket credentials | |
| bbuser='Username_here' | |
| bbpass='password_here' | |
| fname=`date +%F_%H_%M` |
| #!/usr/bin/env python | |
| import dbus | |
| import collections | |
| import sys | |
| import os | |
| if __name__ == "__main__": | |
| if len(sys.argv) < 2: | |
| print "Usage: mumble-broadcast <message>" | |
| sys.exit(1) |
| #!/bin/sh | |
| #----------------------------------------------------------------------------------------# | |
| # Hex over TCP with Echo and Netcat # | |
| #----------------------------------------------------------------------------------------# | |
| echo -n -e "x01x18x03" | nc 192.168.1.4 80 | |
| # The -n supresses outputting the trailing newline. | |
| # The -e enables the interpretation of backslash escapes -- allowing us to send hex codes. |
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
| # /etc/network/interfaces | |
| # | |
| auto lo | |
| iface lo inet loopback | |
| # device: eth0 | |
| iface eth0 inet manual | |
| # IPv4 bridge | |
| # (connect ONLY your firewall/router KVM instance here, this is the WAN device!) |
| # dump | |
| pg_dump testdb | pv -c -s $(psql -tc "SELECT pg_database_size('testdb')") -N dump | gzip > testdb.sql.gz | |
| # restore | |
| pv testdb_20120501.sql.gz | zcat | psql testdb |
| #!/bin/sh | |
| ####################################################### | |
| # Another great script by: # | |
| # _ , _ # | |
| # / ) _, _ |) /|/_) ,_ _ _ # | |
| # / / | / |/\ | \/ | / \_| | |_/|/| |/ # | |
| # /__/\/|_/\__/| |/|(_/ |/\_/ \/ \/ | |_/|_/ # | |
| # (| # | |
| # # |