Skip to content

Instantly share code, notes, and snippets.

@coderjo
coderjo / attach_cow_image.sh
Last active April 7, 2024 02:48
access a disk image read-only with a copy-on-write overlay to allow fsck or the like to write changes
#!/bin/bash
# usage: attach_cow_image.sh [imagefile] [cowfile] [devname]
# imagefile: path to the image file you want to load
# cowfile: path to the file to store writes into. If it doesn't exist, a sparse 1GB file will be created.
# devname: the name you want the drive to show up as in /dev/mapper
imgfile="$1"
cowfile="$2"
dmname="$3"
@nandhp
nandhp / robin-cascade.pl
Last active April 8, 2016 01:25
Compute estimated merge times for Robin chatrooms (robin-estmerge: Estimated merge times in 80 lines; robin-cascade: human-readable output and other computations)
#!/usr/bin/perl
use JSON;
use warnings;
use strict;
my $EST_TIERS = 0; # Estimate tiers of existing chats
my $T1_INTERVAL = -1;#9; # In seconds (8000->6000 in 5-9PM => 9 sec)
my @duration = (0, 1, 3, 7, 15, 31);
sub duration {
@skyscribe
skyscribe / .gdbinit
Created October 30, 2012 03:04
GDB init file to print STL containers and data members
#
# STL GDB evaluators/views/utilities - 1.03
#
# The new GDB commands:
# are entirely non instrumental
# do not depend on any "inline"(s) - e.g. size(), [], etc
# are extremely tolerant to debugger settings
#
# This file should be "included" in .gdbinit as following:
# source stl-views.gdb or just paste it into your .gdbinit file
@nandhp
nandhp / .lessfilter
Created September 22, 2011 21:31
lesspipe + source-highlight integration
#!/bin/sh
#
# .lessfilter - Custom rules for lesspipe
#
# GNU source-highlight
SRC=/usr/bin/source-highlight
SRCOPTS="-f esc --style-file=esc.style -i"
# Directory listings