Skip to content

Instantly share code, notes, and snippets.

@k-takata
k-takata / check_unused_bash_completion.sh
Last active August 29, 2015 14:13
Check unused bash_completion files
#!/bin/bash
#
# check_unused_bash_completion.sh
#
# Check unused bash_completion files and moves them into "unused"
# subdirectory. Loading many completion files makes Cygwin/MSYS bash
# very slow.
#
@k-takata
k-takata / hello-cgo.cpp
Created April 1, 2015 15:17
Golang cgo test on Windows
#include <cstdio>
#include <iostream>
#include <windows.h>
class Foo {
public:
Foo() {
OutputDebugStringA("Foo::Foo()\n");
//std::cout << "Foo::Foo()\n";
//std::printf("Foo::Foo()\n");
@k-takata
k-takata / enable-uncpath-on-cmd.exe.reg
Created May 9, 2015 07:26
Enable UNC path on cmd.exe
REGEDIT4
[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"DisableUNCCheck"=dword:00000001
@k-takata
k-takata / bash-completion-slowness-on-msys2.md
Created May 13, 2015 15:08
Bash-completion is very slow on MSYS2

Bash-completion is very slow on MSYS2

Bash-completion is very slow on MSYS2 when the current user is a domain user. This describes the cause and the solutions.

Cause

Expansion of ~* is very slow when you use a domain user. For example:

@k-takata
k-takata / 0001-Support-MSVC.patch
Created July 25, 2015 12:14
Patch for building libffi v3.2.1 with MSVC
From f0627cd357082ba27e914810bdfbc47e80e37c92 Mon Sep 17 00:00:00 2001
From: "K.Takata" <[email protected]>
Date: Sat, 25 Jul 2015 21:09:11 +0900
Subject: [PATCH] Support MSVC
Based on Ruby 2.2's patch:
https://github.com/ruby/ruby/blob/ruby_2_2/ext/fiddle/win32/libffi-3.2.1-mswin.patch
---
src/x86/ffi.c | 21 +++++++++++++++------
src/x86/ffitarget.h | 2 ++
From 0d28151eb1de2b3f8196c611d488be8496ad02c0 Mon Sep 17 00:00:00 2001
From: MURAOKA Taro <[email protected]>
Date: Thu, 2 Feb 2012 01:14:15 +0900
Subject: [PATCH 1/7] make compilable for 32bit Windows
---
src/.gitignore | 8 +++++
src/Attrib.c | 2 +-
src/Make_msvc.mak | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/RdFToI.c | 1 +
--- Tmain/alias-for-unknown-language.d/stderr-actual.txt 2015-08-08 16:01:59.918759200 +0900
+++ Tmain/alias-for-unknown-language.d/stderr-expected.txt 2015-07-09 22:37:01.408106900 +0900
@@ -1 +1 @@
-C:\WORK\universal-ctags\ctags.exe: Unknown language "nosuchlang" in "alias-nosuchlang" option
+ctags: Unknown language "nosuchlang" in "alias-nosuchlang" option
@k-takata
k-takata / CreateScrBuf.c
Last active September 30, 2015 09:53
Test of CreateConsoleScreenBuffer and SetConsoleActiveScreenBuffer (Doesn't work on winpty)
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <io.h>
int main()
{
HANDLE hScr, hConOut;
DWORD written;
int c;
@k-takata
k-takata / sscanf-test.c
Created August 14, 2015 22:43
VC14's sscanf returns different value
#include <stdio.h>
int main()
{
int i, d, n, ret;
char *strs[] = {"3", "3x", "3\x80", "3\xf0", "3\xfe", "3\xff"};
for (i = 0; i < sizeof(strs) / sizeof(strs[0]); i++) {
ret = sscanf(strs[i], "%d%n", &d, &n);
printf("str=%s: d=%d, n=%d, ret=%d\n", strs[i], d, n, ret);
@k-takata
k-takata / vimproc-encdec.vim
Last active August 29, 2015 14:28
Test for new vimproc data handling routine
" Encode a 32-bit integer into a 5-byte string.
function! s:encode_size(n)
" Set each bit7 to 1 in order to avoid NUL byte.
return printf("%c%c%c%c%c",
\ ((a:n / 0x10000000) % 0x80) + 0x80,
\ ((a:n / 0x200000) % 0x80) + 0x80,
\ ((a:n / 0x4000) % 0x80) + 0x80,
\ ((a:n / 0x80) % 0x80) + 0x80,
\ ( a:n % 0x80) + 0x80)
endfunction