Skip to content

Instantly share code, notes, and snippets.

View violetyk's full-sized avatar

kagaya violetyk

View GitHub Profile
@violetyk
violetyk / isinstance.py
Created March 9, 2016 02:26
Python型判定
print isinstance(1, (int, unicode))
# True
print isinstance(u'text', (int, unicode))
# True
print isinstance('8-bit string', (int, unicode))
# False
@violetyk
violetyk / gist:bc4e7869bf6b4f8c152b
Created February 23, 2016 06:38
開発サーバで環境作り

方針

  • rootがない状況なので $HOME/local へ入れる
  • configureで使うライブラリがないので apt-cache search hoge でさがして apt-get source hoge で入れて configure, make, make installする

ホームディレクトリ

cd ~
mkdir -p {bin,tmp,etc/profile.d,swap,undo,backup,tags,src,.trash,.tmux,build}
@violetyk
violetyk / setting.md
Created January 6, 2016 15:36
ref.vimででPHPのマニュアルをひいていたときの設定

vimrcへの設定

if neobundle#is_sourced('vim-ref') " {{{
  if has('win32') || has('win64')
    let g:ref_phpmanual_path = $VIM . '/vimfiles/manual/php_manual_ja/'
  else
    let g:ref_phpmanual_path = $HOME . '/.vim/manual/php_manual_ja/'
  endif
@violetyk
violetyk / .vimrc
Last active December 28, 2015 18:09
memolistの設定
" memolist.vim {{{
let g:memolist_memo_suffix = "md"
let g:memolist_memo_date = "%Y-%m-%d %H:%M"
let g:memolist_prompt_tags = 1
" let g:memolist_prompt_categories = 1
" let g:memolist_filename_prefix_none = 1
let g:memolist_template_dir_path = '~/dotfiles/memotemplates'
let g:memolist_unite = 1
let g:memolist_unite_option = "-start-insert -vertical"
function! s:Paste64Copy() range
let l:tmp = @@
silent normal gvy
let l:selected = @@
let b64 = webapi#base64#b64encode(l:selected)
if $TMUX != ""
"tmuxのとき
let cmd = printf('printf "\x1bPtmux;\x1b\x1b]52;;%s\x1b\x1b\\\\\x1b\\" > /dev/tty', b64)
" call system('printf "\x1bPtmux;\x1b\x1b]52;;%s\x1b\x1b\\\\\x1b\\" > /dev/tty')
elseif $TERM == "screen"
cat /etc/redhat-release
CentOS release 5.7 (Final)

wget http://curl.haxx.se/download/curl-7.32.0.tar.bz2
tar xf curl-7.32.0.tar.bz2
cd curl-7.32.0/
./configure --prefix=/usr/local/curl --with-ssl --with-libssh2
make -j
paco -D make install
cnoreabbrev <expr> Ctest
\ (getcmdtype() == ':' && getcmdline() ==# 'e Ctest' && exists('g:cake.paths.test')) ? g:cake.paths.test : 'Ctest'
cnoreabbrev <expr> Cfixute
\ (getcmdtype() == ':' && getcmdline() ==# 'e Cfixture' && exists('g:cake.paths.fixtures')) ? g:cake.paths.fixtures : 'Cfixture'
cnoreabbrev <expr> Cmodel
\ (getcmdtype() == ':' && getcmdline() ==# 'e Cmodel' && exists('g:cake.paths.models')) ? g:cake.paths.models : 'Cmodel'
cd src
wget  git clone --branch=release git://github.com/jonas/tig.git
cd tig
sudo LDLIBS=-lncursesw CFLAGS=-I/usr/include/ncursesw make install install-release-doc prefix=/usr/local/tig 

sudo vi /etc/profile.d/tig.sh
export PATH=$PATH:/usr/local/tig/bin/

source /etc/profile.d/tig.sh
" ステータスラインの色 ctermfgがバックの色で、ctermbgがフロントの文字色
highlight StatusLine term=NONE cterm=NONE ctermfg=black ctermbg=white
highlight StatusLine term=reverse cterm=reverse ctermfg=blue ctermbg=white
" 入力モードの時にステータスラインの色を変える。
let g:hi_insert = 'highlight StatusLine guifg=LightGrey guibg=darkblue gui=none ctermfg=white ctermbg=blue cterm=none'
if has('syntax')
augroup InsertHook
autocmd!
sudo yum install mercurial
hg clone https://vim.googlecode.com/hg/ vim
cd vim
hg pull
hg update
./configure \
--prefix=/usr/local/phpstorm \
--with-compiledby="JetBrains" \
--enable-fail-if-missing \