Skip to content

Instantly share code, notes, and snippets.

function! s:tm(timer) abort
" 何か時間のかかる処理
for i in range(1000)
let a = 1
endfor
if job_status(get(s:, 'job')) !=# 'run'
call timer_stop(a:timer)
endif
endfunction
@miyakogi
miyakogi / python-build.sh
Created May 17, 2016 12:00
pythonのビルドに使ってるスクリプト
#!/usr/bin/env bash
cd cpython
make distclean
install_dir=$HOME/opt
# Install python2
version=2.7.11
pydir=$install_dir/python-$version
@miyakogi
miyakogi / bokeh_sample.py
Last active May 7, 2016 08:04
wdomでグラフをプロットするサンプル(とりあえず)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import asyncio
from functools import partial
from wdom.document import get_document
from wdom.server import get_app, start_server, stop_server
from wdom.tag import H1, Div, Button
@miyakogi
miyakogi / pacth.patch
Last active January 31, 2016 04:19
Jedi's patch to support type hints in python3
diff --git a/jedi/parser/grammar3.4.txt b/jedi/parser/grammar3.4.txt
index d4a32b8..45f733f 100644
--- a/jedi/parser/grammar3.4.txt
+++ b/jedi/parser/grammar3.4.txt
@@ -27,7 +27,8 @@ parameters: '(' [typedargslist] ')'
typedargslist: (tfpdef ['=' test] (',' tfpdef ['=' test])* [','
['*' [tfpdef] (',' tfpdef ['=' test])* [',' '**' tfpdef] | '**' tfpdef]]
| '*' [tfpdef] (',' tfpdef ['=' test])* [',' '**' tfpdef] | '**' tfpdef)
-tfpdef: NAME [':' test]
+tname: NAME [':' test]
if executable('fcitx-remote')
autocmd InsertLeave * call system('fcitx-remote -c')
else
autocmd InsertLeave * set iminsert=0
endif
@miyakogi
miyakogi / config.md
Last active October 2, 2024 02:02
JSON, YAML, ini, TOML ざっくり比較
@miyakogi
miyakogi / gist:6d41191246729d89a602
Created March 28, 2015 11:36
Pythonでディレクトリ中のファイルを全て別のディレクトリにSymlinkを辿ってコピー
#!/usr/bin/env python3
import os
import shutil
# コピーしたいディレクトリにいること
# os.getcwd() とか ipythonからならpwdでパス確認できる
# 違うディレクトリにいたら移動するなりソース修正するなり
dstdir = 'コピー先のディレクトリのフルパス'
files = os.listdir()
num_files = len(files) # 進捗表示用
@miyakogi
miyakogi / compile.sh
Created March 5, 2015 03:54
Nim で DOM をさわる
nim js -o:hellonim.js hellonim.nim
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from os import path, environ
from subprocess import check_output, call
from shlex import split
from codecs import open
home_dir = environ['HOME']
python_path = u'''
@miyakogi
miyakogi / test29.failed
Created January 29, 2015 03:29
vim-jp issue #693 1
asdfasdf. asdf
asdfasdf. asdf
asdfasdf. asdf
asdfasdf. asdf
asdfasdf. asdf
asdfasdf. asdf
asdfasdf. asdf
asdfasdf asdf
asdfasdf asdf
asdfasdf asdf