Skip to content

Instantly share code, notes, and snippets.

@draftcode
draftcode / gist:1357281
Created November 11, 2011 05:35
構文解析 Howto

構文解析 Howto

Author

draftcode

Date

2011-11-11T13:18:07+09:00

ID

289a0136-0c1c-11e1-a06b-040ccee352e6

こうぶん、かいせきー

@draftcode
draftcode / lscolors_convert.scm
Created January 10, 2009 14:46
Convert FreeBSD's LSCOLORS to FSF's LS_COLORS
#!/usr/bin/env gosh
(use srfi-1)
(use srfi-13)
(define (even-odd-map f-even f-odd lis)
(if (null? lis)
'()
(cons (f-odd (car lis))
(cons (f-even (cadr lis))
class Test {
int var = 42;
void variableScope() {
switch (var) {
case 42:
int a = 1;
case 43:
// a is visible.
a = 2;
}
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function, unicode_literals
def indicate_last(gen):
saved_e = None
prev_value = next(gen)
value = None
while True:
if saved_e is not None:
raise saved_e
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
typedef struct _node {
char c;
struct _node *tr;
struct _node *next;
} node;
#include <stdio.h>
#include <stdlib.h>
#pragma pack(8)
struct shape_vtbl;
typedef struct {
double x, y;
struct shape_vtbl *shape_vtbl;
} SHAPE;
#!/usr/bin/gawk -f
# $ echo 'a[1] = b[1]' | ./test.awk pattern='.\\[[[:digit:]]\\]'
# a[1]
# b[1]
{
s = $0
while (match(s, pattern)) {
print substr(s, RSTART, RLENGTH)
s = substr(s, RSTART+RLENGTH)
}
xrrtest: xrrtest.cpp
${CXX} -lX11 -lXinerama -lXrandr -o xrrtest xrrtest.cpp
require "rake/clean"
$OUTPUT = File.basename(File.expand_path("..", __FILE__))
$OUTPUTDIR = "out"
$TEX = "platex"
$TEXFLAGS = ""
$DVIPDF = "dvipdfmx"
$DVIPDFFLAGS = ""
$BIBTEX = "pbibtex"