Skip to content

Instantly share code, notes, and snippets.

View kanru's full-sized avatar

Kan-Ru Chen kanru

View GitHub Profile
@kanru
kanru / Android.mk
Created January 6, 2012 04:16
Android GPS using libhardware
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
gps_test.cpp
LOCAL_SHARED_LIBRARIES := \
libcutils libhardware
LOCAL_MODULE:= test-gps
@kanru
kanru / suffix.n
Created October 29, 2022 07:47
Suffix Tree
/*
* Copyright (c) 2005 Kanru Chen
*
* 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:
*
@kanru
kanru / sicxeasm.pl
Created October 29, 2022 07:45
SIC/XE Assembler
#!/usr/bin/env perl
# Copyright (c) 2005 Kanru Chen
#
# 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:
#
@kanru
kanru / round_robin_dispatcher.rs
Created March 14, 2021 14:59
Bastion example
use bastion::prelude::*;
use futures_timer::Delay;
use std::sync::Arc;
use std::time::Duration;
use tracing::Level;
///
/// Prologue:
/// This example demonstrate a idiomatic way to implement the round robin
/// algorithm with bastion. We will use two groups of children, one will be
@kanru
kanru / Generated table
Created March 4, 2012 14:54
Generate password lookup table
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
+----------------------------------------------------
A| U C " S a K n v } n : A n + s # ? @ _ d | 1 E { g J
B| W [ > F ^ i R k M N E < 3 d & L B s [ r l o u / w n
C| k c ] G G F ; Q O \ T G t X G = V 2 b ~ N [ 1 3 ^ O
D| x G A 0 ` Y v 6 2 y 3 w ~ ] b N ) 0 q ' ? J y + u Y
E| V j = c ^ ! R P z N c s R ? Z / K k c F J z \ ' J u
F| c 5 E q . K 6 F } z 9 = ( B = I 7 ( K H = \ + ' 0 Q
G| C ' : p % ~ q # 2 f { 7 | { { + [ z } p T 2 % l ( K
H| r v Z w m @ + k w S 0 ) J 7 + } ^ H ) t G ( f 9 A 3
@kanru
kanru / keybase.md
Created August 6, 2019 09:13
keybase.md

Keybase proof

I hereby claim:

  • I am kanru on github.
  • I am kanru (https://keybase.io/kanru) on keybase.
  • I have a public key ASC8lM-7nJh8v_zvLmfr8B55WoRlrBExeELA87EI5TPSvAo

To claim this, I am signing this object:

@kanru
kanru / rss.xml
Created July 28, 2019 13:00
Example Zola RSS feed
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title></title>
<link>https%3A//example.com</link>
<description></description>
<generator>Zola</generator>
<language>en</language>
<atom:link href="https%3A//example.com/rss.xml" rel="self" type="application/rss+xml"/>
<lastBuildDate>Sun, 28 Jul 2019 00:00:00 +0000</lastBuildDate>
@kanru
kanru / pdf-ocr.sh
Created January 19, 2012 08:19
PDF OCR
#! /bin/sh
# Batch OCR pdf files to text files
#
# Copyright (C) 2012 Kan-Ru Chen <kanru@kanru.info>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@kanru
kanru / gist:3368424
Created August 16, 2012 08:33
Debian exim4 multiple smart host config
smarthost:
debug_print = "R: smarthost for $local_part@$domain"
driver = manualroute
domains = ! +local_domains
transport = remote_smtp_smarthost
route_data = ${if exists{CONFDIR/smarthosts}\
{${lookup{${domain:$h_from:}}lsearch{CONFDIR/smarthosts}\
{$value}{DCsmarthost}}}\
{DCsmarthost}}
host_find_failed = defer
#!/bin/env python
import json
import sys
skipList = [
"BaseThreadInitThunk",
"CharPrevA",
"CsrAllocateMessagePointer",
"DispatchMessageW",
"DispatchMessageWorker",