Skip to content

Instantly share code, notes, and snippets.

View natestone's full-sized avatar

Nate Stone natestone

View GitHub Profile
@joseluisq
joseluisq / resize_disk_image.md
Last active April 16, 2024 11:18
How to resize a qcow2 disk image on Linux

How to resize a qcow2 disk image on Linux

This example takes olddisk.qcow2 and resizes it into newdisk.qcow2, extending one of the guest's partitions to fill the extra space.

1. qcow2 format

1.1. Verify the filesystems of olddisk.qcow2

# Load the contents of the receipt file
receipt_file = open('./receipt_data.bin', 'rb').read()
# Use asn1crypto's cms definitions to parse the PKCS#7 format
from asn1crypto.cms import ContentInfo
pkcs_container = ContentInfo.load(receipt_file)
# Extract the certificates, signature, and receipt_data
certificates = pkcs_container['content']['certificates']
signer_info = pkcs_container['content']['signer_infos'][0]
@rafaelrinaldi
rafaelrinaldi / README.md
Last active January 22, 2021 09:04
`.mov` to `.gif` using QuickTime and Photoshop

.mov to .gif using QuickTime and Photoshop

This is my prefered way to create GIF animations for demos and whatnot.

Steps

  1. QuickTime » File » New Screen Recording
  2. Select area to record » Start recording your thing
  3. File » Export » Select max resolution available » Save
  4. Photoshop » Import » Video Frames to Layers (no need to follow step 2 if not on retina screen)
@xanf
xanf / AjaxAuthenticationListener.php
Created June 8, 2011 19:20
AJAX auth errors listener for Symfony2
<?php
namespace Application\ProdrepHelperBundle\Component\Event;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
/**
*/
class AjaxAuthenticationListener
@HenrikJoreteg
HenrikJoreteg / JS Util solution using underscore.js
Created October 22, 2010 21:20
Rather than creating some other util global, just extend underscore.js with any additional methods you want.
// If you don't use underscore.js, use it (http://documentcloud.github.com/underscore/)
// Then, use underscore's mixin method to extend it with all your other utility methods
// like so:
_.mixin({
escapeHtml: function () {
return this.replace(/&/g,'&amp;')
.replace(/>/g,'&gt;')
.replace(/</g,'&lt;')
.replace(/"/g,'&quot;')
.replace(/'/g,'&#39;');