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
| This is free and unencumbered software released into the public domain. | |
| Anyone is free to copy, modify, publish, use, compile, sell, or | |
| distribute this software, either in source code form or as a compiled | |
| binary, for any purpose, commercial or non-commercial, and by any | |
| means. | |
| In jurisdictions that recognize copyright laws, the author or authors | |
| of this software dedicate any and all copyright interest in the | |
| software to the public domain. We make this dedication for the benefit |
| class MainWidget(QtGui.QMainWindow): | |
| def __init__(self, parent=None): | |
| super(MainWidget, self).__init__(parent) | |
| self.setWindowTitle("FiFiFactory App") | |
| self.resize(720,480) | |
| self.setAcceptDrops(True) | |
| def dragEnterEvent(self, event): | |
| if event.mimeData().hasUrls(): | |
| event.accept() |
sudo apt-get install xfce4-session xfce4-goodies xrdp tigervnc-standalone-server/etc/xrdp/sesman.ini and /etc/xrdp/xrdp.ini may have to edited as in this gist, but it may work also with default configs1280x900 in the connection settings)~/.xsession and ~/.vnc/xstartup with the defaults in this gist in their home directory| # source this to set the dbus env in a gnome session | |
| export DISPLAY=:0 | |
| PID=$(pgrep gnome-session) | |
| export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-) | |
| # You may now configure things in gsettings, e.g. run vino: | |
| gsettings reset org.gnome.Vino network-interface | |
| gsettings set org.gnome.Vino enabled true | |
| gsettings set org.gnome.Vino prompt-enabled false |
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
| <?php | |
| function tinker(...$args) { | |
| // Because there is no way of knowing what variable names | |
| // the caller of this function used with the php run-time, | |
| // we have to get clever. My solution is to peek at the | |
| // stack trace, open up the file that called "tinker()" | |
| // and parse out any variable names, so I can load | |
| // them in the tinker shell and preserve their names. |
| #!/usr/bin/python | |
| def timeit(method): | |
| import time | |
| def timed(*args, **kw): | |
| ts = time.time() | |
| result = method(*args, **kw) | |
| te = time.time() | |
| if 'log_time' in kw: |
| #!/usr/bin/python | |
| def rosbagit(method): | |
| import subprocess | |
| import roslib.packages | |
| def cachable(method): | |
| def cache_call(*args, **kw): | |
| try: | |
| return method.__globals__[method] |
| @lxpanel --profile LXDE | |
| @pcmanfm --desktop --profile LXDE | |
| @point-rpi | |
| @xset s off | |
| @xset -dpms | |
| @xset s noblank | |
| @sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' ~/.config/chromium-browser/Default/Preferences | |
| @chromium-browser --noerrdialogs --disable-infobars --kiosk http://[YOUR_URL] --incognito | |
| #@xscreensaver -no-splash@ |