View .zshrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
is_screen_running() { | |
# tscreen also uses this varariable. | |
[ ! -z "$WINDOW" ] | |
} | |
is_tmux_runnning() { | |
[ ! -z "$TMUX" ] | |
} | |
is_screen_or_tmux_running() { | |
is_screen_running || is_tmux_runnning | |
} |
View calibre-server.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Calibre Content Server | |
After=network.target | |
[Service] | |
Type=simple | |
User=tyru | |
Group=tyru | |
ExecStart=/usr/bin/calibre-server --with-library /mnt/server/calibre --port 8080 | |
View promise-is-resolved.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function delay(msec, value) { | |
return new Promise(done => window.setTimeout((() => done(value)), msec)); | |
} | |
function isResolved(promise) { | |
return Promise.race([delay(0, false), promise.then(() => true, () => false)]); | |
} | |
function isRejected(promise) { | |
return Promise.race([delay(0, false), promise.then(() => false, () => true)]); |
View gist:376501
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
もしあなたが新しいプログラム、例えばテキストエディタを作るとしたら、どの言語で作る? | |
Suppose you want to write a new program, something like a text editor. What language would you write it in? | |
* できるだけ速く。なのでインタプリタ言語はダメ。 | |
* It has to be as fast as possible, so interpreted languages are out. | |
* ちまちまメモリ管理なんてしたくない。だからCはダメ。 | |
* You don't want to micro manage memory, so C is out. | |
* プログラマに学位をとれなんて言いたくない。だからC++はダメ。 | |
* You don't want to require programmers to have a degree, so C++ is out. | |
* できるだけ起動は速いほうがいいし、ランタイムには依存させたくない。だからJavaはダメ。 |
View SingularToPlural.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SingularToPlural { | |
private SingularToPlural() { | |
} | |
/* | |
・末尾が s, sh, ch, o, x のいずれかである英単語の末尾に es を付ける | |
・末尾が f, fe のいずれかである英単語の末尾の f, fe を除き、末尾に ves を付ける | |
・末尾の1文字が y で、末尾から2文字目が a, i, u, e, o のいずれでもない英単語の末尾の y を除き、末尾に ies を付ける | |
・上のいずれの条件にも当てはまらない英単語の末尾には s を付ける |
View .bashrc.ssh-agent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Based on http://www.snowelm.com/~t/doc/tips/20030625.ja.html | |
[[ -f ~/.ssh-agent-info ]] && source ~/.ssh-agent-info >/dev/null | |
ssh-add -l >&/dev/null | |
if [ $? == 2 ]; then | |
# unable to contact the authentication agent | |
echo -n "ssh-agent: Restarted..." | |
ssh-agent >~/.ssh-agent-info | |
source ~/.ssh-agent-info |
View client.vim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Run: | |
" 1. mkdir tmp | |
" 2. {chrome} --remote-debugging-port=9222 --no-first-run --no-default-browser-check --user-data-dir=tmp | |
" | |
" In another shell: | |
" 1. vim -S client.vim | |
" | |
" ref. https://developer.mozilla.org/ja/docs/Tools/Remote_Debugging/Chrome_Desktop |
View remap-alt-to-ctrl.ahk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!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 |
View windows-like-word.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"title": "[macOS] Windows-like word movement/selection/deletion", | |
"rules": [ | |
{ | |
"description": "Ctrl + Arrow Keys to Option + Arrow Keys", | |
"manipulators": [ | |
{ | |
"from": { | |
"key_code": "up_arrow", | |
"modifiers": { |
View camelcase.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
use Test::More; | |
sub camelize { | |
my ($s) = @_; |
NewerOlder