Skip to content

Instantly share code, notes, and snippets.

View c9s's full-sized avatar

c9s

  • Taipei, Taiwan
  • 03:42 (UTC +08:00)
  • X @c9s
View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.disk.noatime</string>
<key>ProgramArguments</key>
<array>
<string>mount</string>
@c9s
c9s / bench.pl
Created May 20, 2014 16:07
libr3 benchmarks
use Time::HiRes qw(time);
my %routes = (
"/foo/bar/baz" => 0,
"/foo/bar/qux" => 1,
"/foo/bar/quux" => 2,
"/foo/bar/corge" => 3,
"/foo/bar/grault" => 4,
"/foo/bar/garply" => 5,
"/foo/baz/bar" => 6,
"/foo/baz/qux" => 7,
check_tree.c:34:35: warning: implicit declaration of function 'zstrdup' is invalid in C99 [-Wimplicit-function-declaration]
fail_if( r3_node_add_child(n, zstrdup("/add") , child) == FALSE );
^
/opt/local/include/check.h:271:4: note: expanded from macro 'fail_if'
(expr) ? \
^
check_tree.c:34:35: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'char *' [-Wint-conversion]
fail_if( r3_node_add_child(n, zstrdup("/add") , child) == FALSE );
^~~~~~~~~~~~~~~
/opt/local/include/check.h:271:4: note: expanded from macro 'fail_if'
~/tmp/ % cd Router-R3
█▓▒░c9s@c9smba█▓▒░ Fri May/23 PM 00:22:57
~/tmp/Router-R3/ % git init
Initialized empty Git repository in /Users/c9s/tmp/Router-R3/.git/
█▓▒░c9s@c9smba█▓▒░ Fri May/23 PM 00:22:58
~/tmp/Router-R3/ (git:master) % git submodule init
█▓▒░c9s@c9smba█▓▒░ Fri May/23 PM 00:23:01
~/tmp/Router-R3/ (git:master) % git submodule add https://github.com/c9s/r3.git libr3
Cloning into 'libr3'...
remote: Reusing existing pack: 2031, done.
#!/usr/bin/env perl
use lib 'lib';
use strict;
use warnings;
use Time::HiRes qw(time);
use Router::R3;
use Router::Boom;
use Router::Boom::Method;
use Router::Simple;
use HTTP::Router;
Cache-Control
Connection
Date
Pragma
Trailer
Transfer-Encoding
Upgrade
Via
Warning
Accept
@c9s
c9s / ci.zsh
Last active August 29, 2015 14:02
ci () {
git status -uno
if [[ -n "$*" ]]
then
echo "Committing..."
git commit -v -a -m "$*"
else
echo "**** Please Enter Commit Message ****"
cat > .commit-msg
if [[ -e '.commit-msg' ]]
{
"endpoint": 0,
"compare": 0,
"edges": [
{
"pattern": "\/",
"opcode": 0,
"slug": false,
"child": {
"endpoint": 0,
/*
* Request Header
* http://tools.ietf.org/html/rfc2616#section-5.3
*/
h3_request_header_get_accept(RequestHeader *header); // Get "Accept"
h3_request_header_get_accept_charset(RequestHeader *header); // Get "Accept-Charset"
h3_request_header_get_accept_language(RequestHeader *header); // Get "Accept-Language"
h3_request_header_get_accept_encoding(RequestHeader *header); // Get "Accept-Encoding"
h3_request_header_get_authorization(RequestHeader *header); // Get "Authorization"
h3_request_header_get_expect(RequestHeader *header); // Get "Expect"
<?php
function foo() {
try {
// throw new YoubikeException;
throw new Exception;
} catch (Exception $e) {
echo 'Caught Exception: ', get_class($e), "\n";
return 1;
} finally {
echo 'Finally block';