Skip to content

Instantly share code, notes, and snippets.

View kanru's full-sized avatar

Kan-Ru Chen kanru

View GitHub Profile
@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 / 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>
#!/bin/env python
import json
import sys
import cmd
from colorama import Fore, Style
skipList = [
"BaseThreadInitThunk",
"CharPrevA",
"CsrAllocateMessagePointer",
#!/bin/env python
import json
import sys
skipList = [
"BaseThreadInitThunk",
"CharPrevA",
"CsrAllocateMessagePointer",
"DispatchMessageW",
"DispatchMessageWorker",
@kanru
kanru / bugzilla.gs
Created February 7, 2017 11:04 — forked from wolph/bugzilla.gs
Bugzilla fetcher for google sheets
/**
* @fileoverview Provides the custom function BUGZILLA_TITLE and
* the helper functions that it uses.
*/
/**
* Runs when the add-on is installed.
*/
function onInstall() {
onOpen();
@kanru
kanru / yank-date-from-calendar.el
Last active August 29, 2015 14:14
yank-date-from-calendar.el
;; -*- lexical-binding: t -*-
(defun yank-date-from-calendar ()
(interactive)
(let ((date-string nil))
(set-transient-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map calendar-mode-map)
(define-key map (kbd "RET")
(lambda ()
@kanru
kanru / diary-sync-ical.el
Created January 22, 2015 11:54
Sync icalendar to diary file
;;; diary-sync-ical.el --- Sync iCalendar to diary -*- lexical-binding: t; -*-
;; Copyright (C) 2015 Kan-Ru Chen (陳侃如)
;; Author: Kan-Ru Chen (陳侃如) <[email protected]>
;; Keywords:
;; 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