使用 Python 内置的 defaultdict
,我们可以很容易的定义一个树形数据结构:
def tree(): return defaultdict(tree)
就是这样!
all: mov xor | |
mov: mov.o | |
ld -o mov mov.o | |
xor: xor.o | |
ld -o xor xor.o | |
mov.o: mov.asm | |
yasm -f macho64 -o mov.o mov.asm |
Copyright (c) 2012 Xidorn Quan | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in |
#!/bin/bash | |
# 将 DNSPOD 上指定子域名指向当前本机 IP 的脚本 | |
# | |
# 依赖: | |
# urlencode: http://www.shelldorado.com/scripts/cmds/urlencode | |
# jsawk: https://github.com/micha/jsawk | |
# 配置信息 | |
EMAIL="" |
<!DOCTYPE HTML> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> | |
<title></title> | |
<style type="text/css"> | |
canvas { position: absolute; top: 0; left: 0; } | |
#c { background: #ccc; } | |
#ps { position: absolute; top: 0; right: 0; } |
使用 Python 内置的 defaultdict
,我们可以很容易的定义一个树形数据结构:
def tree(): return defaultdict(tree)
就是这样!
<?php | |
/** | |
* 检验是否为有效的电子邮件地址 | |
* | |
* 根据 http://www.linuxjournal.com/article/9585 编写 | |
* | |
* @param string $email | |
* @return bool | |
*/ |
CFLAGS=-fextended-identifiers -std=c99 | |
objects=chinese.ucn.o | |
target=chinese | |
.PHONY: all clean | |
all: $(target) | |
$(target): $(objects) | |
$(CC) $< -o $@ |
#!/usr/bin/python | |
# - * - coding: UTF-8 - * - | |
import cgi | |
import json | |
import urllib | |
import httplib2 | |
h = httplib2.Http() | |
query = urllib.urlencode({ |
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <CoreServices/CoreServices.h> | |
#include "directory_icon.h" | |
int setDirectoryIcon(const char *dirName, const char *iconData, size_t iconSize) | |
{ | |
const int kResidIcon = -16455; | |
const OSType kRsrcType = 'icns'; |
# - * - coding: UTF-8 - * - | |
import subprocess | |
def macosx_set_clipboard(text): | |
p = subprocess.Popen('pbcopy', stdin=subprocess.PIPE) | |
p.communicate(text) | |
def macosx_send_keys(text): | |
text = text.replace('\\', '\\\\').replace('"', '\\"') |