Skip to content

Instantly share code, notes, and snippets.

@islander
islander / fsck_qcow2.md
Last active June 8, 2024 07:42
Recover a qcow2 image using fsck

Recover a qcow2 image using fsck

Load network block device module:

# modprobe nbd max_part=8

Poweroff machine:

# virsh destroy virtual-machine

@dpapathanasiou
dpapathanasiou / SchemaSpy-HOWTO.md
Last active February 17, 2024 19:45
How to use SchemaSpy to generate the db schema diagram for a PostgreSQL database

SchemaSpy is a neat tool to produce visual diagrams for most relational databases.

Here's how to use it to generate schema relationship diagrams for PostgreSQL databases:

  1. Download the jar file from here (the current version is v6.1.0)

  2. Get the PostgreSQL JDBC driver (unless your installed version of java is really old, use the latest JDBC4 jar file)

  3. Run the command against an existing database. For most databases, the schema (-s option) we are interested in is the public one:

@c00kiemon5ter
c00kiemon5ter / pcp
Created February 11, 2012 01:21
cp wrapper with a progressbar
#!/bin/bash
current=0
completed=0
read -r total _ < <(/bin/du -bc "${@:1:${#}-1}" | tail -n1)
/bin/cp $@ &
while (( current != total )); do
@rsvp
rsvp / country.sh
Created January 22, 2012 01:42
country.sh : look-up country name, its ISO code or foreign exchange currency symbol. Necessary data is contained within this Linux bash script, so it's very fast.
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2012-01-15
#
# _______________| country : look-up country ISO code or currency symbol.
#
# Usage: country [term] ["iso"|"fx"]
# where "fx" is foreign exchange,
# "iso" is the default option,
# term is case-insensitive regular expression.
#