Skip to content

Instantly share code, notes, and snippets.

View bartgee's full-sized avatar

Bart Grzybicki bartgee

  • private
  • Poland
  • 22:45 (UTC +02:00)
View GitHub Profile
@bartgee
bartgee / gist:8f8e182386b2157df5b5f100ff67cc0e
Created September 12, 2016 14:06
Resizing a filesystem using qemu-img and fdisk

Occasionally we will deploy a virtual instance into our KVM infrastructure and realize after the fact that we need more local disk space available. This is the process we use to expand the disk image. This process assumes the following:

  • You're using legacy disk partitions. The process for LVM is similar and I will describe that in another post.
  • The partition you need to resize is the last partition on the disk.

This process will work with either a qcow2 or raw disk image. For

@bartgee
bartgee / webscrap.py
Last active July 23, 2018 02:47
Simple introduction to web scraping in Python. Not perfect, but you get an idea how it goes...
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# author Bart Grzybicki <bgrzybicki@gmail.com>
from lxml import html
import requests
OUT_FILE = u'linuxtoday.txt'
def main():
@bartgee
bartgee / cross-platform-sleep.cpp
Created May 23, 2014 23:24
cross-platform sleep function not consuming any CPU usage
#include <iostream>
#ifdef WIN32
#include <windows.h>
#else
#include <unistd.h>
#endif // win32
using namespace std;
void sleepcp(int milliseconds);