Skip to content

Instantly share code, notes, and snippets.

View neilbutterworth's full-sized avatar

neilbutterworth

View GitHub Profile
@neilbutterworth
neilbutterworth / dynastr.c
Created December 19, 2012 15:44
read string from file, dynamically allocating memory
#include <stdlib.h>
#include <stdio.h>
char * read_line( FILE * f ) {
int cap = 32, next = 0, c;
char * p = malloc( cap );
while( 1 ) {
if ( next == cap ) {
p = realloc( p, cap *= 2 );
}
@neilbutterworth
neilbutterworth / backup.sh
Created December 13, 2012 15:42
my little backup script
#!bash
# backup directories listed in the .backup file of the user's home directory
# if the directory contains a makefile, run make clean to scrub any object
# and/or executable files that don't need backup
#
# backup is placed in a a dated zip archive - copying to removable media
# is not performed
# Copyright (C) 2008 Neil Butterworth