Skip to content

Instantly share code, notes, and snippets.

Working from home

Fujiwara Takuya tyru

Working from home
Block or report user

Report or block tyru

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
tyru / remap-alt-to-ctrl.ahk
Last active Apr 2, 2020
[AutoHotkey] Remap Alt + [A-Z] to Ctrl + [A-Z]
View remap-alt-to-ctrl.ahk
!a::Send, ^a
!b::Send, ^b
!c::Send, ^c
!d::Send, ^d
!e::Send, ^e
!f::Send, ^f
!g::Send, ^g
!h::Send, ^h
!i::Send, ^i
!j::Send, ^j
tyru / windows-like-word.json
Created Mar 25, 2020
[Karabiner Elements][macOS] Windows-like word movement/selection/deletion
View windows-like-word.json
"title": "[macOS] Windows-like word movement/selection/deletion",
"rules": [
"description": "Ctrl + Arrow Keys to Option + Arrow Keys",
"manipulators": [
"from": {
"key_code": "up_arrow",
"modifiers": {
echo -n -e "\x1b7"
while :; do
# 2>/dev/null: hide python stacktrace when Ctrl-C
output=$(echo -n -e "あけましておめでとうこざいます。\n本年も日経Linuxとラズパイマガジンをご愛読のほど、\n何卒よろしくお願いいたします。" | boxes -d mouse | lolcat -F 1 -f 2>/dev/null)
echo -n -e "\x1b8$output"
sleep 0.5s
tyru / bench.vim
Created Nov 19, 2019
Benchmark for parsing SKK dictionary
View bench.vim
function! s:run() abort
let skkdict = expand('~/Dropbox/config/skkdict/system-dict')
" for memory cache
call readfile(skkdict)
let start = reltime()
call readfile(skkdict)
let b1 = reltimestr(reltime(start, reltime()))
tyru /
Last active Aug 25, 2019
JSON Parser in Rust
use std::io;
use std::fmt;
use std::str;
use std::result;
use std::iter::Iterator;
// TODO: take deparse option from command-line arguments
fn main() {
View chain-op-test.vim
function! HasKey(dict, key)
return has_key(a:dict, a:key)
function! s:has_key(dict, key)
return has_key(a:dict, a:key)
function! Fold(list, init, f)
let l:V = a:init
for l:Elem in a:list
tyru / profile.txt
Created Aug 1, 2019
Add readable name to numbered-function (and vim-jp/vim-vimlparser profiling result)
View profile.txt
SCRIPT /Users/tyru/config/home/volt/repos/
Sourced 1 time
Total time: 0.011356
Self time: 0.011356
count total (s) self (s)
" vim:set ts=8 sts=2 sw=2 tw=0 et:
" VimL parser - Vim Script Parser
tyru / require.vim
Last active Jul 2, 2019
require() function for deeply nested very loooooooooong named autoload function
View require.vim
let s:L = vital#of('vital').import('Data.List')
function! s:require(ns, ...) abort
let ns = strtrans(a:ns)
let fnlist = map(
\ split(execute('function /' . ns), '\n'),
\ {_,l -> matchstr(l, '^function ' . ns . '#\zs\w\+\ze(')}
call filter(fnlist, '!empty(v:val)')
if a:0
tyru / search-decl-php-ftplugin-2.patch
Last active Jun 6, 2019
Searching declaration in PHP ftplugin (Fix [[, ]] mappings problems, added [], ][ mappings)
View search-decl-php-ftplugin-2.patch
--- php.vim.bak 2018-10-10 14:08:25.875669800 +0900
+++ php.vim 2018-10-10 14:04:30.777334700 +0900
@@ -61,15 +61,107 @@
setlocal omnifunc=phpcomplete#CompletePHP
-" Section jumping: [[ and ]] provided by Antony Scriven <adscriven at gmail dot com>
-let s:function = '\(abstract\s\+\|final\s\+\|private\s\+\|protected\s\+\|public\s\+\|static\s\+\)*function'
-let s:class = '\(abstract\s\+\|final\s\+\)*class'
+" Section jumping: [[ and ]] provided by:
tyru /
Last active Mar 21, 2019
Google Apps Script で Gmail の添付ファイルを Google Drive に保存
// Google Drive でフォルダに移動した時のURLで分かる
var SAVE_FOLDER_ID = 'フォルダのID';
var READ_LABEL_NAME = '添付ファイル保存済み';
var SEARCH_CONDITION = 'has:attachment -label:' + READ_LABEL_NAME;
function saveAttachments() {
You can’t perform that action at this time.