Skip to content

Instantly share code, notes, and snippets.

@daaku
daaku / keybase.md
Last active April 10, 2021 09:01
Keybase Proof

Keybase proof

I hereby claim:

  • I am daaku on github.
  • I am daaku (https://keybase.io/daaku) on keybase.
  • I have a public key ASCwmzydf6qNg1NvPJrMNonv2ETZpQf-Fl3w736NdxMPzAo

To claim this, I am signing this object:

@daaku
daaku / main.rs
Last active March 22, 2021 19:26
mmap, parallel, zero-copy, xml parsing of wikipedia articles
use aho_corasick::AhoCorasick;
use anyhow::Result;
use crossbeam_channel::{bounded, Receiver, Sender};
use crossbeam_utils::thread;
use itertools::Itertools;
use memmap::Mmap;
use std::convert::TryInto;
use std::fs::File;
use std::str::from_utf8;
@daaku
daaku / bash-prelude
Last active September 27, 2015 00:14
bash-prelude
#!/usr/bin/env bash
set -euo pipefail
shopt -s dotglob nullglob
trap 'echo "${0} line ${LINENO} Status: ${?}"' ERR
@daaku
daaku / facebook-sample.php
Created February 9, 2011 06:18
A simple Facebook PHP example.
<?php
/**
* A simple Facebook PHP example.
*
* - This is not a "Facebook SDK".
* - This example uses Curl, Hash, JSON, Session extensions.
* - This does not use the JavaScript SDK, nor the cookie set by it.
* - This works with Canvas, Page Tabs with IFrames, the Registration Plugin
* and with any other flow which uses the signed_request.
@daaku
daaku / idle-seconds.m
Created March 4, 2009 06:06
Idle number of seconds.
/**
* Prints out the number of seconds since the last user input.
*
* gcc -framework Cocoa -o idle-seconds idle-seconds.m
*/
#import <Foundation/Foundation.h>
extern double CGSSecondsSinceLastInputEvent(unsigned long eventType);