Mar 16, 2010
(?<user>[^@]+) @ (?<company>[^.]+) \. (?<top_level_domain>\w{2,4})
Mar 19, 2010
perl -pi -e 's/ipodder/juice/g' `git grep ipodder | gawk -F: '{print $1}' | sort | uniq`
Mar 19, 2010
# File: test_matplotlib_chinese.py -*- Encoding: utf-8 -*- | |
import wx | |
import gettext | |
import matplotlib | |
matplotlib.use('WXAgg') | |
from pylab import * | |
from matplotlib.backends.backend_wxagg import \ | |
FigureCanvasWxAgg as FigureCanvas | |
from matplotlib.figure import Figure |
#!/usr/bin/env python | |
# a pygame script to draw random size/color rectangle on the screen. | |
# It's adapted from http://apress.com/book/view/9781590598726 chapter 4 | |
import pygame | |
from pygame.locals import * | |
from random import * | |
import sys | |
pygame.init() | |
screen = pygame.display.set_mode((640, 480), FULLSCREEN, 32) |
-- File: exprparser.hs | |
-- This is from the Parsec documentation with minor modification. | |
module ExprParser where | |
import Text.ParserCombinators.Parsec | |
import Text.ParserCombinators.Parsec.Expr | |
import qualified Text.ParserCombinators.Parsec.Token as P | |
import Text.ParserCombinators.Parsec.Language | |
lexer :: P.TokenParser () |
Mar 16, 2010
(?<user>[^@]+) @ (?<company>[^.]+) \. (?<top_level_domain>\w{2,4})
Mar 19, 2010
perl -pi -e 's/ipodder/juice/g' `git grep ipodder | gawk -F: '{print $1}' | sort | uniq`
Mar 19, 2010
#include <stdio.h> | |
int | |
main(int argc, char**argv) | |
{ | |
FILE *fp; | |
int c; | |
fp = fopen("showself.c", "r"); | |
while ((c = fgetc(fp)) != EOF) { |
/* | |
Description: | |
The "beauty" of C macro. | |
*/ | |
#include <stdio.h> | |
#define PRODUCT(x) (x * x) | |
int main(int argc, char**argv) |
#include <stdlib.h> | |
#include <curses.h> | |
int r, c, // current row and column (upper-left is (0,0)) | |
nrows, // number of rows in window | |
ncols; // number of columns in window | |
void draw(char dc) | |
{ | |
move(r, c); // curses call to move cursor to row r, column c |
%% | |
/* match everything except newline */ | |
. ECHO; | |
/* match newline */ | |
\n ECHO; | |
%% | |
int yywrap(void) { | |
return 1; | |
} |
digit [0-9] | |
letter [A-Za-z] | |
%{ | |
int count; | |
%} | |
%% | |
/* match identifier */ | |
{letter}({letter}|{digit})* count++; |
%{ | |
int yylineno; | |
%} | |
%% | |
^(.*)\n printf("%4d\t%s", yylineno++, yytext); | |
%% | |
int yywrap(void) { | |
return 1; |