Skip to content

Instantly share code, notes, and snippets.


Shuntaro Yada shuntaroy

View GitHub Profile
shuntaroy / Private.xml
Last active Aug 29, 2015
Private.xml for Karabiner to toggle mozc_input on Sublime Text (Mac)
View Private.xml
<?xml version="1.0"?>
<!-- If you use Sublime Text 2, you should change above '3' into '2' -->
<name>Command_LR to toggle_mozc on SublimeText3</name>
shuntaroy / Rakefile
Last active Aug 29, 2015
Make symlinks of .tex and .pdf in local folder into ~/Dropbox/LaTeX with the same directory tree as the local folder.
View Rakefile
# Rakefile of TeXdocuments symlink
require "rake/clean"
CURRENT = Dir.pwd + '/'
DROPBOX = Dir.home + '/Dropbox/LaTeX/'
TARGETS = FileList['**/*.pdf', '**/*.tex']
GENERATE_DIRS = { |p| DROPBOX + File.dirname(p)}.uniq.sort
GENERATED = FileList[DROPBOX + '**/*.pdf', DROPBOX + '**/*.tex']
View otf-up-yu-elcapitan.sty
% prefer to use with \usepackage[bold]{otf}
\AtBeginDvi{\special{pdf:mapline uphminr-h UniYuMin-UTF16-H :0:YuMincho.ttc}}
\AtBeginDvi{\special{pdf:mapline uphminr-v UniYuMin-UTF16-V :0:YuMincho.ttc}}
\AtBeginDvi{\special{pdf:mapline uphminb-h UniYuMin-UTF16-H :1:YuMincho.ttc}}
\AtBeginDvi{\special{pdf:mapline uphminb-v UniYuMin-UTF16-V :1:YuMincho.ttc}}
\AtBeginDvi{\special{pdf:mapline uphgothr-h UniJIS2004-UTF16-H YuGo-Medium.otf}}
\AtBeginDvi{\special{pdf:mapline uphgothr-v UniJIS2004-UTF16-V YuGo-Medium.otf}}
\AtBeginDvi{\special{pdf:mapline uphgothb-h UniJIS2004-UTF16-H YuGo-Bold.otf}}
\AtBeginDvi{\special{pdf:mapline uphgothb-v UniJIS2004-UTF16-V YuGo-Bold.otf}}
shuntaroy / Open in iTerm2-nightly
Last active Nov 1, 2017 — forked from eric-hu/Open iterm tab here
Apple script to open an iterm2 "nightly" window from right-clicking on a file or folder in Finder. To use:(1) Open Automator(2) Create a new service(3) Change "Service receives selected" drop downs to "Files or folders" in "Finder"(4) Select "Run applescript" from the sidebar, then paste this script in and save
View Open in iTerm2-nightly
-- Adapted from these sources:
-- Modified to work with files as well, cd-ing to their container folder
on run {input, parameters}
tell application "Finder"
set my_file to first item of input
set filetype to (kind of (info for my_file))
-- Treats OS X applications as files. To treat them as folders, integrate this SO answer:
!cmd # = the latest exec starting with ``cmd``
!! # = !-1, previously used command
!$ # = !:-1, previouly used argument
!$:r # = real name
!$:e # = extension
!^:h # = parent dir
!^:t # = file name
!^ # = !:1
^ptn^rpl^ # = s/ptn/rpl/
shuntaroy / agg_ifnull_cond.js
Last active Jul 8, 2018
an example of tweet json
View agg_ifnull_cond.js
{$project: {
account: "$user.screen_name",
tid: "$id",
text: {$ifNull: ["$retweeted_status.text", "$text"]},
date: "$created_at",
RT: {$cond: [
{$not: ["$retweeted_status"]},
shuntaroy /
Last active Dec 2, 2018
Assume keys are stored into environment variables
import os
import tweepy
consumer_key = os.environ['TWITTER_CONSUMER_KEY']
consumer_secret = os.environ['TWITTER_CONSUMER_SECRET']
access_token = os.environ['TWITTER_ACCESS_TOKEN']
access_token_secret = os.environ['TWITTER_ACCESS_TOKEN_SECRET']
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
shuntaroy / Private.xml
Created Jul 27, 2014
HHKB Pro2 key modifying setting for Karabiner ( App. Only applied when HHKB Pro2 connected.
View Private.xml
<?xml version="1.0"?>
shuntaroy / cleveref_ja.sty
Created Dec 31, 2015
\cref{labelname}とすると自動で「第1章」などとしてくれる cleveref パッケージを日本語化するスタイルファイル見本です。
View cleveref_ja.sty