Skip to content

Instantly share code, notes, and snippets.

@kjseefried
kjseefried / gist:8d0251b3b07e24d782e6
Last active August 29, 2015 14:06 — forked from anonymous/gist:5f97d8db71776b188820
better yet, just include a handful of function pointers into chan_t for each of the API methods that need more than the shared part of chan_t struct, initialize them on allocation and put type-specific code in these functions. It will make for a more compact, concise and localized code. (Edit 2) Here's what I mean with function pointers - https:…
typedef struct chan_t
{
pthread_mutex_t m_mu;
pthread_cond_t m_cond;
int closed;
void (* dispose)(struct chan_t * self);
...
} chan_t;
@kjseefried
kjseefried / ubuntu lvm clone-resize
Last active June 20, 2023 17:35 — forked from anonymous/gist:fdcbcc27278c287ce5e0
clone & resize Ubuntu Cloud image from 2GB to 40GB in 2 seconds
# time ./do-all.sh
+ lvcreate -kn -s -n ubunt2 /dev/k2/ubunt
Logical volume "ubunt2" created
+ lvresize -L 40G /dev/k2/ubunt2
Extending logical volume ubunt2 to 40.00 GiB
Logical volume ubunt2 successfully resized
+ echo -en 'd\nn\np\n\n\n\n\n\nw\nq\n'
+ fdisk /dev/k2/ubunt2
Command (m for help): Selected partition 1
[General]
arch=amd64
cleanup=true
noauth=true
ignorenativearch=true
unpack=true
aptsources=Debian
bootstrap=Debian
[Debian]