Skip to content

Instantly share code, notes, and snippets.

View uchida's full-sized avatar

Akihiro Uchida uchida

View GitHub Profile
@uchida
uchida / hyphen-num.py
Last active July 14, 2016 15:08
1 3 4 5 7 => 1,3-5,7
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from itertools import chain, izip_longest, groupby
def hyphenate(s):
"""
>>> hyphenate("1 2 3")
'1-3'
>>> hyphenate("1 2 3 5 7 8")
@uchida
uchida / keybase.md
Created July 2, 2016 04:32
keybase.md

Keybase proof

I hereby claim:

  • I am uchida on github.
  • I am uchida (https://keybase.io/uchida) on keybase.
  • I have a public key whose fingerprint is 0B52 06F3 41EE ED89 6021 7423 FDE3 1684 6BF3 F057

To claim this, I am signing this object:

@uchida
uchida / keyconfig.json
Last active July 1, 2016 20:10
json config file for Chrome Keyconfig
{
"name": "Chrome Keyconfig",
"version": "1.14.0",
"normal_actions": {
"h": {
"name": "scroll left",
"args": []
},
"l": {
"name": "scroll right",
@uchida
uchida / private.xml
Created July 1, 2016 19:46
karabiner private.xml to remap cmd/opt/app key for MS keyborad
<?xml version="1.0"?>
<root>
<item>
<name>private items for MS Keyboard</name>
<item>
<name>Option_L to Command_L for MS Keyboard</name>
<identifier>private.micorosoft.opt_l-to-cmd-l</identifier>
<device_only>DeviceVendor::MICROSOFT</device_only>
<autogen>__KeyToKey__ KeyCode::OPTION_L, KeyCode::COMMAND_L</autogen>
</item>
@uchida
uchida / main.go
Created June 30, 2016 16:06
date sieve
package main
import (
"fmt"
"errors"
"log"
"os"
"time"
"strings"
"path/filepath"
@uchida
uchida / bibparse.py
Created January 31, 2016 00:18
a simple BibTeX parser based on finite state machine
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# CC0 dedicated to public domai by Akihiro Uchida
import sys
class BibParser(object):
def __init__(self):
self.parse = self.parse_main
self.buffer = ''
self.item = dict()
@uchida
uchida / shtidy.el
Created January 18, 2014 18:42
emacs lisp script to tidy shellscript
#!/usr/bin/env emacs --script
(defadvice message (before message-disable activate)
"disable message function to trash stderr message"
(ad-set-args 0 nil))
(defun insert-standard-input ()
"insert contents from standard input"
(condition-case nil
(let (line)
@uchida
uchida / aozora_epub.py
Last active December 24, 2015 09:59
青空文庫の「公開中 作家別作品一覧拡充版」から URL を抽出し、テキストファイルを一括取得して、AozoraEpub3 https://github.com/hmdev/AozoraEpub3/ を利用して epub に変換するスクリプト
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# by Akihiro Uchida, CC0 dedicated to the public domain
# see http://creativecommons.org/publicdomain/zero/1.0/
import os.path
import time
import re
import subprocess
import atexit
import cPickle as pickle
@uchida
uchida / mewgrep.py
Last active December 18, 2015 03:58
simple mail search tool for mew-prog-grep
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# by Akihiro Uchida, CC0 dedicated to the public domain
# see http://creativecommons.org/publicdomain/zero/1.0/
import sys, re
import email, email.header
import os.path
import argparse
from locale import getpreferredencoding
@uchida
uchida / menurc
Last active December 16, 2015 00:09
keybind for sylpheed
; sylpheed GtkAccelMap rc-file
; -*- scheme -*-
(gtk_accel_path "<Main>/View/Go to/Other folder..." "g")
(gtk_accel_path "<Main>/View/Go to/Prev message" "k")
(gtk_accel_path "<Main>/View/Go to/Prev unread message" "p")
(gtk_accel_path "<Main>/View/Go to/Next message" "j")
(gtk_accel_path "<Main>/View/Go to/Next unread message" "n")
(gtk_accel_path "<Main>/View/Show or hide/Message view" "v")
(gtk_accel_path "<Main>/View/Update" "<Shift>s")
(gtk_accel_path "<Main>/View/Thread view" "<Shift>t")