Skip to content

Instantly share code, notes, and snippets.

@ynkdir
ynkdir / pycompiler.vim
Last active December 14, 2015 03:19
vimlparser.py
call extend(s:, vimlparser#import())
let s:PythonCompiler = {}
function s:PythonCompiler.new(...)
let obj = copy(self)
call call(obj.__init__, a:000, obj)
return obj
@ynkdir
ynkdir / drawcustom.c
Last active December 15, 2015 18:09
drawcustom.dll: draw background image
/* compile: cl /MD /LD drawcusotm.c user32.lib gdi32.lib
* usage: :echo libcall('C:\fullpath\to\drawcustom.dll', 'init', '/path/to/background-image.bmp')
* bmp is loaded with LoadImage() API. And it doesn't support BITMAPV4HEADER and above.
*/
#include <windows.h>
#include <string.h>
typedef int (WINAPI *fFillRect)(HDC hDC, CONST RECT *lprc, HBRUSH hbr);
typedef BOOL (WINAPI *fExtTextOutA)(HDC, int, int, UINT, CONST RECT *, LPCSTR, UINT, CONST INT *);
@ynkdir
ynkdir / pipeline.py
Last active December 22, 2015 13:58
from subprocess import Popen, PIPE, STDOUT
import shlex
import json
class Pipeline:
def __init__(self, stdin=None):
self.returncode = None
self.stdout = stdin
self.stderr = None
@ynkdir
ynkdir / vkey.c
Last active December 23, 2015 04:19
// http://www.tatapa.org/~takuo/input_subsystem/input_subsystem.html
// virtual key event
// sudo sh -c "./a.out keycode > /dev/input/eventX"
// 30 == KEY_A
// 41 == KEY_GRAVE (zenkaku hankaku)
#include <linux/input.h> // see for keycode constant KEY_XXX
#include <sys/time.h>
#include <unistd.h>
#include <stdio.h>
@ynkdir
ynkdir / test.c
Created January 24, 2014 12:34
PyIter_Check() does not work when -Bsymbolic-functions is used.
// BUILD:
// cc `python-config --cflags` -o a.out test.c `python-config --ldflags`
// cc `python-config --cflags` -fPIE -o a-pie.out test.c `python-config --ldflags`
//
// PyIter_Check() does not work when -Bsymbolic-functions is used.
// On Ubuntu, -Bsymbolic-functions is included in compile flag.
// Workaround is -fPIE.
//
// https://bugs.launchpad.net/ubuntu/+source/python2.7/+bug/1196047
// https://groups.google.com/forum/?fromgroups=#!searchin/vim_dev/tests/vim_dev/CEaL812aLNI/aSuZ0Jin8BQJ
diff -r dd44a527c2bd src/edit.c
--- a/src/edit.c Sun Apr 06 21:34:04 2014 +0200
+++ b/src/edit.c Wed Apr 09 20:24:53 2014 +0900
@@ -9330,12 +9330,7 @@
tpos = curwin->w_cursor;
if (oneleft() == OK)
{
-#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
- /* Only call start_arrow() when not busy with preediting, it will
- * break undo. K_LEFT is inserted in im_correct_cursor(). */
// > cl /LD set_icon.c user32.lib
// :call libcallnr('path/to/set_icon.dll', 'set_icon', v:windowid . ',' . 'path/to/myvim.ico')
#include <windows.h>
#include <stdio.h>
__declspec(dllexport) int set_icon(char **args)
{
HWND hWnd;
char iconpath[1024];
HICON hIcon;
@ynkdir
ynkdir / rogue_vim.log
Created September 16, 2014 11:30
rogue_vim.log
[2014年09月16日 20時20分34秒]
...ro/.vim/package/rogue.vim/autoload/rogue/monster.lua:203: attempt to index field '?' (a nil value)
stack traceback:
...hiro/.vim/package/rogue.vim/autoload/rogue/debug.lua:241: in function <...hiro/.vim/package/rogue.vim/autoload/rogue/debug.lua:235>
...ro/.vim/package/rogue.vim/autoload/rogue/monster.lua:203: in function 'aim_monster'
...ro/.vim/package/rogue.vim/autoload/rogue/monster.lua:217: in function 'put_m_at'
...ro/.vim/package/rogue.vim/autoload/rogue/monster.lua:751: in function 'create_monster'
...kihiro/.vim/package/rogue.vim/autoload/rogue/use.lua:463: in function 'read_scroll'
...ihiro/.vim/package/rogue.vim/autoload/rogue/play.lua:145: in function 'play_level'
@ynkdir
ynkdir / a.vim
Created October 16, 2014 13:34
substitute test
let y = substitute('aaa', '\ze', 'x', 'g') | $put =y " => xaxaxax
$put ='aaa' | s/\ze/x/g " => xaxaxa
let y = substitute('abc', 'a\|\ze', 'x', 'g') | $put =y " => xxbxcx
$put ='abc' | s/a\|\ze/x/g " => xbxc
@ynkdir
ynkdir / cc500.vim
Created December 1, 2014 15:53
cc500.vim
" This is a port of CC500
" http://homepage.ntlworld.com/edmund.grimley-evans/cc500/
"
"-------------------------------------------------------------------------------
" ORIGINAL HEADER
"-------------------------------------------------------------------------------
" Copyright (C) 2006 Edmund GRIMLEY EVANS <[email protected]>
"
" This program is free software; you can redistribute it and/or modify
" it under the terms of the GNU General Public License as published by