Skip to content

Instantly share code, notes, and snippets.

@pi314
pi314 / slide.vim
Last active October 14, 2015 13:31
A little vim plugin used to display an reStructuredText-like slide in CCCA x SITCON meet up, 2015/10/14
" ============= "
" filetype.vim "
" ============= "
au BufNewFile,BufRead slide setf slide.rst
au BufNewFile,BufRead *.slide setf slide.rst.todo
" =================== "
" ftplugin/slide.vim "
" =================== "
@pi314
pi314 / 20151014.ccca-x-sitcon.vim-plugin.slide
Last active October 14, 2015 13:33
The slide needs slide.vim plugin to play
===============
Vim Plugin 簡介
===============
如何自幹一個 Vim Plugin
(我猜 10 分鐘就會結束了)
池昌言 pi314 拍拍
CCCA x SITCON 定期聚 @ 2015/10/14
a = [3, 14, 11, 14, 17, 8, 20, 12, 3, 14]
b = [7, 4, 11, 11, 14]
c = [2, 7, 4, 2, 10, 8, 14, 2, 7, 4, 2, 10, 8, 14, 2, 7]
d = [1, 1, 1, 1, 1, 1, 1]
def foo(seq):
for ret in range(1, len(seq)):
for i, _ in enumerate(seq[ret:]):
if seq[i + ret] != seq[i % ret]:
break
@pi314
pi314 / openmtc.py
Last active January 25, 2016 08:03
''' # my virtualenv settings, use with caution
$ virtualenv-2.7 .venv-openmtc-r4
$ source .venv-openmtc-r4/bin/activate
$ pip instal --upgrade openmtc-all-4.0.2.tar.gz
$ vim .venv-openmtc-r4/lib/python2.7/site-packages/etc/openmtc/gevent/config-gscl.json.dist
"file": "/var/log/gscl.log"
->
"file": "./gscl.log"
$ \python -m openmtc_gevent.gscl_main -f .venv-openmtc-r4/lib/python2.7/site-packages/etc/openmtc/gevent/config-gscl.json.dist
'''
#include <stdio.h>
#include <string.h>
#ifdef ofst
for i in range(12):
MID, ofst, _ = 12, lambda o, i: int(o[i], 16), """
#else
#define ofst(o, i) 0
int main () { int t; char *s, *_; for (int i = 0; i < 12; i++) {
s = " """;
t = (int)(9+(i%3+(int)(i/3))*2-(i>8)*(2*(i-8)+2)) + ofst("466975754C32", i);
import random
def main():
results = {}
results['OO'] = 0
results['OX'] = 0
results['XO'] = 0
results['XX'] = 0
for i in range(10000):