Skip to content

Instantly share code, notes, and snippets.

View yagihiro's full-sized avatar
🏠
Working from home

Hiroki Yagita yagihiro

🏠
Working from home
View GitHub Profile
;; Copyright (C) 2007,2008,2009,2010 Hiroki Yagita.
;; ポリシー ----------------------------------------------------------
;; - meadow は捨てました
;; - xemacs は捨てました
;; - なるべくどこでも動くようにしたい
;; - 初期化スクリプトは ~/.emacs.d/init.el にしています
;; - ~/.emacs.d/ の下に分離スクリプトやデータを置くことがあります(それ以外の場所に置かない)
@yagihiro
yagihiro / CircularBuffer.h
Created February 18, 2009 09:50
circular buffer library for Arduino (C++)
/*
CircularBuffer.h - circular buffer library for Arduino.
Copyright (c) 2009 Hiroki Yagita.
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
@yagihiro
yagihiro / .zshrc
Last active September 20, 2017 05:26
.zshrc
# ~/.zshrc
# completion ---------------------------------------------------
dir=~/.oh-my-zsh/custom/plugins/zsh-completions/src
if [ -e $dir ]; then
fpath=($dir $fpath)
plugins+=(zsh-completions)
autoload -U compinit && compinit
fi
zstyle ':completion:*' list-colors 'di=34' 'ln=35' 'so=32' 'ex=31' 'bd=46;34' 'cd=43;34'
@yagihiro
yagihiro / .screenrc
Created August 23, 2009 05:44
.screenrc
defencoding utf-8
escape ^z^z
termcapinfo * hs@
hardstatus alwayslastline "[%02c] %`%-w%{=b bw}%n %t%{-}%+w"
@yagihiro
yagihiro / inotify sample written by c.c
Last active September 9, 2016 04:35
inotify sample written by c on linux 2.6.x
/* http://www.ibm.com/developerworks/jp/linux/library/l-ubuntu-inotify/index.html */
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/inotify.h>
#define EVENT_SIZE ( sizeof (struct inotify_event) )
#define BUF_LEN ( 1024 * ( EVENT_SIZE + 16 ) )
@yagihiro
yagihiro / suffix array sample by c.c
Last active September 9, 2016 04:38
suffix array sample by c
#include <stdio.h>
#include <stdlib.h>
struct SuffixArray
{
unsigned ip; /* index point */
char *suffix;
};
static int compare(const void *l, const void *r)
@yagihiro
yagihiro / suffixarray.rb
Created February 12, 2010 02:45
suffix array sample by ruby
require "bsearch" # http://0xcc.net/ruby-bsearch/index.html.en
class SuffixArray
attr_accessor :word # original string(String)
attr_accessor :sary # suffix array(Array)
def initialize word
@word = word
@sary = Array.new(@word.size) {|i| i }
@yagihiro
yagihiro / Makefile
Last active September 9, 2016 04:37
minimum linux kernel module
obj-m := mykmod.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
@yagihiro
yagihiro / sample.c
Last active August 29, 2022 23:18
workqueue sample on linux kernel
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/workqueue.h>
static void mykmod_work_handler(struct work_struct *w);
static struct workqueue_struct *wq = 0;
static DECLARE_DELAYED_WORK(mykmod_work, mykmod_work_handler);
static unsigned long onesec;
@yagihiro
yagihiro / sample.c
Last active July 29, 2022 11:25
timer sample on linux kernel
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/timer.h>
#include <linux/jiffies.h>
static void mykmod_timer_handler(unsigned long data);
static unsigned long onesec;
DEFINE_TIMER(mytimer, mykmod_timer_handler, 0, 0);