Skip to content

Instantly share code, notes, and snippets.

@ynkdir
ynkdir / getvimexepath.vim
Last active August 29, 2015 14:14
GetVimExePath
" :echo exepath(v:progpath)
" unix: :echo resolve('/proc/self/exe')
function! GetVimExePath()
let r = SystemListUtf16(printf('wmic PROCESS WHERE ProcessID=%d GET ExecutablePath /FORMAT:CSV', getpid()))
return split(r[2], ',')[1]
endfunction
function! SystemUtf16(cmd)
return s:utf16tostr(s:lines2bytes(systemlist(a:cmd)))
endfunction
@ynkdir
ynkdir / winuniout.c
Created January 28, 2015 12:23
windows unicode stdout
// a.exe => locale encoding
// a.exe | cmd => utf-8
// a.exe > file => utf-16le
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
#include <locale.h>
#include <sys/stat.h>
#include <sys/types.h>
@ynkdir
ynkdir / wmitest.js
Created January 28, 2015 15:12
wmitest.js
// [Scripting API for WMI](https://msdn.microsoft.com/en-us/library/aa393258.aspx)
var SWbemServices = GetObject("winmgmts:");
//var SWbemServices = GetObject("winmgmts:{impersonationLevel=impersonate}");
//var SWbemServices = GetObject("winmgmts:\\\\.\\root\\cimv2")
var objWbemObjectSet = SWbemServices.InstancesOf("Win32_NetworkAdapterConfiguration");
//var objWbemObjectSet = SWbemServices.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration")
for (var e = new Enumerator(objWbemObjectSet); !e.atEnd(); e.moveNext()) {
var s = e.item();
WScript.Echo(s.Caption);
}
@ynkdir
ynkdir / vim-cmdsrv-nox.diff
Created March 13, 2015 06:56
Vim clientserver without X
diff -r 15b934a16641 -r 2082fc32d223 runtime/plugin/rrhelper.vim
--- a/runtime/plugin/rrhelper.vim Wed Sep 14 19:04:40 2011 +0200
+++ b/runtime/plugin/rrhelper.vim Thu Sep 15 21:25:11 2011 +0900
@@ -16,7 +16,7 @@
let max = argc()
let id = expand("<client>")
- if id == 0
+ if id == ''
return
@ynkdir
ynkdir / readme.txt
Created March 13, 2015 08:55
vim patches
ynkdir-imoverthespot
gtk2: Changed Input Method editing style from on-the-spot to over-the-spot. On-the-spot implementation is buggy and has problems detailed in mbyte.c:im_preedit_changed_cb().
ynkdir-imactivatekey
gtk2: Removed 'imactivatekey' option and related code because it doesn't work.
ynkdir-imcursorhold
x11: Changed to not fire CursorHold? autocmd event while IM pre-editing. It may cause trouble.
ynkdir-pangolineheight
diff -r 18d84ed365a5 src/normal.c
--- a/src/normal.c Wed Apr 22 22:18:22 2015 +0200
+++ b/src/normal.c Thu May 21 10:52:34 2015 +0900
@@ -1547,8 +1547,10 @@
}
/* In Select mode, a linewise selection is operated upon like a
- * characterwise selection. */
- if (VIsual_select && VIsual_mode == 'V')
+ * characterwise selection.
@ynkdir
ynkdir / shallowcopy.go
Last active August 29, 2015 14:23
shallowcopy: copy directory tree with hard link (cp -rpl)
package main
import (
"flag"
"fmt"
"log"
"os"
"path/filepath"
"time"
)
@ynkdir
ynkdir / search_multibyte_bce.diff
Created July 9, 2015 11:11
patch for search('multi-byte', 'bce')
diff -r bfc3682510d6 src/search.c
--- a/src/search.c Sat Jul 04 15:05:14 2015 +0200
+++ b/src/search.c Thu Jul 09 19:13:39 2015 +0900
@@ -548,6 +548,7 @@
pos_T start_pos;
int at_first_line;
int extra_col;
+ int start_char_len;
int match_ok;
long nmatched;
@ynkdir
ynkdir / win32.mak
Created July 31, 2015 21:05
win32.mak
# Win32.Mak - Win32 application master NMAKE definitions file for the
# Microsoft Windows SDK programming samples
# Copyright (C) Microsoft Corporation
# -------------------------------------------------------------------------
# This files should be included at the top of all MAKEFILEs as follows:
# !include <Win32.Mak>
# -------------------------------------------------------------------------
#
# Define APPVER = [ 4.0 | 5.0 | 5.01 | 5.02 | 6.0 | 6.1] prior to including win32.mak to get
# build time checking for version dependencies and to mark the executable
@ynkdir
ynkdir / taiyosha_comic.ps1
Last active November 14, 2022 23:26
太洋社 (http://taiyosha.co.jp/) のコミック発売予定一覧を取得して CSV を出力する
# 太洋社 (http://taiyosha.co.jp/) のコミック発売予定一覧を取得する
#
# to get csv:
# taiyosha_comic.ps1 | ConvertTo-CSV
function ToUTF8($s) {
return [Text.Encoding]::UTF8.GetString([Text.Encoding]::GetEncoding("ISO-8859-1").GetBytes($s))
}
function GetTable($url) {