Skip to content

Instantly share code, notes, and snippets.

@shamil
shamil / mount_qcow2.md
Last active May 27, 2024 10:36
How to mount a qcow2 disk image

How to mount a qcow2 disk image

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
@ib-lundgren
ib-lundgren / github_flask_oauth2.py
Created September 10, 2013 10:53
Example of how to use Flask with requests-oauthlib to fetch a GitHub user profile using an OAuth 2 token.
from requests_oauthlib import OAuth2Session
from flask import Flask, request, redirect, session, url_for
from flask.json import jsonify
import os
app = Flask(__name__)
# This information is obtained upon registration of a new GitHub
client_id = "<your client key>"
@reyjrar
reyjrar / New-iTerm-Window.scpt
Created February 8, 2012 13:14
AppleScript to Open a New iTerm Window and bring it to the front
(*
* New-iTerm-Window.scpt
*
* Intended for use with QuickSilver
* I mapped option-y to running this script to create
* a new iTerm window on the current workspace
*
* Based on much Googling - very little "original" code here
* Comments/Suggestions to brad.lhotsky@gmail.com
*)
@mudge
mudge / nginx.conf
Created September 20, 2010 12:29
Nginx configuration to redirect requests for non-existent files to an external URI without using if.
# Redirect all requests for non-existent files to another web
# site, used on my own site to redirect people to my GitHub
# account page.
server {
server_name example.com;
location / {
try_files $uri $uri/index.html @external;
}
location @external {
rewrite ^ $scheme://anotherexample.com$request_uri redirect;
@endolith
endolith / A_weighting.py
Last active May 28, 2024 16:55
A-weighting audio files in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Translated from a MATLAB script (which also includes C-weighting, octave
and one-third-octave digital filters).
Author: Christophe Couvreur, Faculte Polytechnique de Mons (Belgium)
couvreur@thor.fpms.ac.be
Last modification: Aug. 20, 1997, 10:00am.
BSD license