Skip to content

Instantly share code, notes, and snippets.

View tacahiroy's full-sized avatar
🐑

Takahiro YOSHIHARA tacahiroy

🐑
  • Karabiner Software
  • Fukuoka, JAPAN
  • 13:31 (UTC +09:00)
  • X @tacahiroy
View GitHub Profile
@tacahiroy
tacahiroy / compile-vim.sh
Last active July 30, 2026 05:27
Enabling lua in Vim 8/9
#!/bin/bash
set -Cueo pipefail
DISTRO=
## on CentOS 7
sudo yum install lua-libs lua-devel ncurses-devel python36 python36-devel
./configure --prefix=$HOME/opt/vim --enable-fail-if-missing --includedir=/usr/include --enable-python3interp=yes --enable-rubyinterp=no --enable-luainterp=yes --enable-multibyte --enable-gui=no --enable-terminal --disable-netbeans --disable-farsi --disable-arabic --disable-rightleft --with-python3-command=python3.6 --with-features=huge --build make && make
@tacahiroy
tacahiroy / fake_tty.py
Created May 17, 2017 04:27
Runs a command in a fake tty and gets output
#!/usr/bin/env python3
import os,sys,time
os.environ['TERM'] = 'xterm'
pid,fd = os.forkpty()
if pid == 0:
os.execv('/sbin/esxtop', [])
sys.exit(0)
@tacahiroy
tacahiroy / check_key_existing_in_map.go
Created March 28, 2016 11:55
Check the key is existing in a map
if _, ok := m[sessionid]; !ok {
m[sessionid] = 0
}
@tacahiroy
tacahiroy / env.rb
Created November 12, 2015 16:10
The way to specify window size in Capybara driver for Chrome
Capybara.register_driver :chrome do |app|
opts = {
browser: :chrome,
switches: %w( --test-type --window-size=1280,1024 )
}
Capybara::Selenium::Driver.new(app, opts)
end
@tacahiroy
tacahiroy / .vimrc
Created October 27, 2015 09:54
Open with new tab for ctrlp.vim
let g:ctrlp_prompt_mappings = {
\ 'AcceptSelection("e")': ['<C-e>'],
\ 'AcceptSelection("t")': ['<Cr>'],
}
@tacahiroy
tacahiroy / c.c
Created September 25, 2014 16:02
Test file for ctrlp-funky - c
#include <stdio.h>
int main () {
puts("main");
return 0;
}
int func1() {
int a = 0;
@tacahiroy
tacahiroy / python.py
Created September 25, 2014 16:01
Test file for ctrlp-funky - python
class Vim:
def editor():
print "Vi Improved"
class CtrlP:
def method():
print "ctrlp!"
class Funky(Vim, CtrlP):
@tacahiroy
tacahiroy / peco-ssh.zsh
Created August 26, 2014 15:57
tiny function that allows you to select and SSH to a host
function peco-ssh() {
local _host=$(grep -o '^\S\+' ~/.ssh/known_hosts | tr -d '[]' | tr ',' '\n' | sort | peco)
if [ ${TMUX} ]; then
eval $(printf "tmux neww -n %s 'ssh %s'" ${_host} ${_host})
else
eval $(printf 'ssh %s' ${_host})
fi
}
@tacahiroy
tacahiroy / .tmux.conf
Created January 12, 2014 14:45
tmux configuration to activate/deactivate WeeChat window
# select weechat window
bind -n F9 run-shell "tmux select-window -t ${WEECHAT_TMUX_WINNUM}"
# back to the previous window
bind -n S-F9 select-window -l
@tacahiroy
tacahiroy / weechat.zsh
Created January 12, 2014 14:37
init function for WeeChat on tmux
function weechat {
if [ -x `which weechat-curses` ]; then
if ! (ps aux | grep '[w]eechat-curses' 2>&1 > /dev/null); then
tmux new-window -t ${WEECHAT_TMUX_WINNUM:-98} weechat-curses
fi
fi
}