Skip to content

Instantly share code, notes, and snippets.

@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:

--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -3083,7 +3083,7 @@ ListConcatInPlace(ListObject *self, PyOb
}
Py_DECREF(lookup_dict);
- Py_INCREF(self);
+ Py_INCREF((PyObject*)self);
return (PyObject *)(self);
}
@k-takata
k-takata / 256colors2.bat
Last active August 4, 2024 17:33
Testing ANSI color sequence on Windows 10 and other terminal emulators
@echo off
rem Based on Todd Larason's 256color2.pl.
rem Ported to Windows 10's Command Prompt.
setlocal EnableDelayedExpansion
rem display the colors
rem first the system ones:
echo System colors:
@k-takata
k-takata / mqpull.sh
Last active May 31, 2024 04:39
Do 'hg pull' and 'hg pull --mq' easily
#!/bin/sh
mainbundle=hg_main.bundle
mqbundle=hg_mq.bundle
rm -f $mainbundle $mqbundle
hg --pager=no incoming -v --bundle $mainbundle
if [ $? -eq 255 ]; then
exit 1
@k-takata
k-takata / 486-OpenWatcom.md
Last active March 4, 2024 06:43
『はじめて読む486』のサンプルを OpenWatcom でビルドする

『はじめて読む486』のサンプルを OpenWatcom でビルドする

概要

『はじめて読む486』のサンプルプログラム集 をできるだけ簡単に試してみるために、OpenWatcom を使ってビルドしてみました。

※ 16bit 用の無料で使えるコンパイラとしては LSI C-86 試食版が有名ですが、関数の呼び出し規約が MSC や Borland C とは異なっているため、アセンブリプログラムの修正が必須となってしまいます。また、Turbo C 2.01 もありますが、インストールが面倒で TASM も含まれていません。

ダウンロード

@k-takata
k-takata / grph3.c
Last active January 14, 2024 07:07
A sample program to draw graphics on a command prompt or a dos window
#include <windows.h>
BOOL IsWindows9x()
{
return (GetVersion() >= 0x80000000);
}
int main(int argc, char *argv[])
{
HWND hWnd;
@k-takata
k-takata / envmeter.rb
Last active August 4, 2023 21:31
Temperature, humidity and pressure meter using GR-CITRUS + AE-BME680 + LCD module (AQM1602Y-FLW-FBW)
#!mruby
class LCD
ID = 0x3E
def initialize
@i2c = I2c.new(1)
end
def init
@k-takata
k-takata / bme680.rb
Created July 23, 2023 03:22
Using AE-BME680 with GR-CITRUS
#!mruby
class BME680
ID = 0x77
#REG_COEFF3 = 0x00
REG_FIELD0 = 0x1D
REG_IDAC_HEAT0 = 0x50
REG_RES_HEAT0 = 0x5A
REG_GAS_WAIT0 = 0x64
@k-takata
k-takata / 2002-windows_transparency.diff
Last active February 10, 2023 06:10
Updated for 9.0.1294 and later
# HG changeset patch
# Parent fde93adeda8d91c54211d002010c4476c27e8dcc
# Parent 04bb907f937cefc1a013ccdaa2e54569944b57a8
implement 'transparency' for Windows GUI
diff --git a/src/gui_w32.c b/src/gui_w32.c
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -50,6 +50,13 @@ static int gui_mswin_get_menu_height(int
# define gui_mswin_get_menu_height(fix_window) 0
@k-takata
k-takata / py3-hook-linux.diff
Created December 27, 2022 09:24
Similar patch to 8.2.4317 for Linux
diff --git a/src/errors.h b/src/errors.h
index e33f2e66b..c23aac526 100644
--- a/src/errors.h
+++ b/src/errors.h
@@ -3213,7 +3213,7 @@ EXTERN char e_autoload_import_cannot_use_absolute_or_relative_path[]
EXTERN char e_cannot_use_partial_here[]
INIT(= N_("E1265: Cannot use a partial here"));
#endif
-#if defined(FEAT_PYTHON3) && defined(MSWIN)
+#if defined(FEAT_PYTHON3) && (defined(MSWIN) || defined(__linux__))