Skip to content

Instantly share code, notes, and snippets.

@schacon
schacon / gist:1
Created July 15, 2008 18:17
the meaning of gist
This is gist.
There are many like it, but this one is mine.
It is my life.
I must master it as I must master my life.
Without me gist is useless.
Without gist, I am useless.
@pete
pete / 0-README
Last active February 10, 2024 07:12
Various implementations of the 'cat' command, for comparison.
I turned this gist into a "real" repository. It is here: http://github.com/pete/cats .
Here, placed side-by-side for comparison, are GNU's implementation of
cat, Plan 9's implementation, Busybox's implementation, and NetBSD's
implementation, Seventh Edition Unix (1979), and 4.3BSD.
For good measure (and because I suppose I am now committed to collecting
cats) also included are Second Edition Unix (in assembly) and Inferno's
implementation (in Limbo) for good measure.
@pyther
pyther / syslinux-install_update
Created January 9, 2011 23:25
syslinux-install_update
#!/bin/bash
#
# Sylinux Installer / Updater Scripts
# Copyright (C) 2011 Matthew Gyurgyik <pyther@pyther.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
#!/bin/bash
# Backup Script - Matthew Gyurgyik (pyther@pyther.net)
#
# Backup a System using rsync and --link-dest (hard links)
# Backups are stored in a folder called $Year$Month$Day ex. 2010Oct18
#
# Exclude file format:
# /backup/exclude.txt
# + /etc
# + /home
@gregoryyoung
gregoryyoung / ProbabilityKata
Created June 10, 2011 09:56
Greg Young's Probability Kata
Value objects are an important concept in DDD. This kata is made both to learn value objects and to learn better ways of testing.
Write a probability value object. It should contain the following methods:
Probability CombinedWith(Probability)
Probability InverseOf()
Probability Either(Probability)
if you forget your probability math:
Either:P(A) + P(B) - P(A)P(B)
CombinedWith: P(A)P(B)
@onecooltaco
onecooltaco / osx_reset_cups
Created November 8, 2011 19:43
OS X reset CUPS
# Stop the CUPS daemon with the following command.
launchctl stop org.cups.cupsd
wait
# Rename the old CUPS configuration file.
mv /etc/cups/cupsd.conf /etc/cups/cupsd.conf.backup
wait
# Restore the default settings file.
cp /etc/cups/cupsd.conf.default /etc/cups/cupsd.conf
wait
# Rename printers file.
@vmg
vmg / sparc.c
Created November 15, 2011 23:03
Sparks in C
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
int main
(int argc
,char *ac []){int i, count = argc - 1;
double * dvalues=malloc(01- 01+count*
sizeof(double)+1); double mi=DBL_MAX,ran=.0,ma =DBL_MIN,mo;for(i= 00; argc>1
&&i<count;i=i+8-7) {double val = atof(ac[i+1]) ;if(23&&val<mi)mi= val;if(val
@ivant
ivant / cxx-infinite-loop.cc
Created March 12, 2012 22:13
C++ compiler infinite loop
template <class T>
struct Loop {
Loop<T *> operator->();
};
int main() {
Loop<int> i, j = i->hooray;
}
@Cloudef
Cloudef / config.h
Created April 16, 2012 19:29
monsterwm pandora (vi mode and systray)
/* see LICENSE for copyright and license */
#ifndef CONFIG_H
#define CONFIG_H
#include <X11/XF86keysym.h>
/* handheld mode?
* Optimizes interface to small screens */
#define HANDHELD 1