Skip to content

Instantly share code, notes, and snippets.

Copyright 2005 Red Hat Inc., Max Kaehn
All cygwin threads have separate context in an object of class _cygtls. The
storage for this object is kept on the stack in the bottom CYGTLS_PADSIZE
bytes. Each thread references the storage via the Thread Environment Block
(aka Thread Information Block), which Windows maintains for each user thread
in the system, with the address in the FS segment register. The memory
is laid out as in the NT_TIB structure from <w32api/winnt.h>:
全ての cygwin スレッドは class _cygtls のオブジェクト中に別個のコンテキストを持っています。
http://invisible-island.net/xterm/
XTerm Control Sequences
Edward Moy
University of California, Berkeley
Revised by
@erw7
erw7 / forecast.txt
Last active March 28, 2022 03:19
nvim resize problem
sigwinch_cb (1)
sigwinch_cb (2)
sigwinch_cb (3)
tui_grid_resize (1) -> got_winch = false
tui_grid_resize (2) -> uinibi_out_ext(ui, data->unibi_ext.resize_screen)
sigwinch_cb (4) -> got_winch = true by tui_grid_resize (2)
tui_grid_resize (3) -> got_winch = false
tui_grid_resize (4) -> uinibi_out_ext(ui, data->unibi_ext.resize_screen)
sigwinch_cb (5) -> got_winch = true by tui_grid_resize (4)
tui_grid_resize (5) -> got_winch = false
local ffi = require'ffi'
ffi.cdef[[
typedef unsigned long DWORD;
typedef void* HANDLE;
typedef int BOOL;
BOOL GetConsoleMode(HANDLE h, DWORD *mode);
BOOL SetConsoleMode(HANDLE h, DWORD mode);
HANDLE GetStdHandle(DWORD stdhandle);
enum {
STD_INPUT_HANDLE = ((DWORD)-10),
// gcc -o overwirte_iat.exe overwwrite_iat1.c -lDbghelp
#include <windows.h>
#include <stdio.h>
#include <inttypes.h>
#include <dbghelp.h>
FILE *myfopen(const char *fname, const char *mode)
{
return stdout;
local tty_set_mode = vim.api.nvim_create_augroup("tty_set_mode", {})
vim.api.nvim_create_autocmd("VimEnter", {
pattern = '*',
group = tty_set_mode,
callback = function()
local tty = vim.loop.new_tty(0, true)
local retry_count = 10
while retry_count > 0 do
local _, err, _ = vim.loop.tty_set_mode(tty, 2)
if err and err['name'] == 'UV_EINTR' then
receive_msgpack (src/nvim/msgpack_rpc/channel.c)
parse_msgpack (src/nvim/msgpack_rpc/channel.c)
handle_reuest (src/nvim/msgpack_rpc/channel.c)
msgpack_rpc_get_handler_for (src/nvim/api/private/dispatch.c) -> get handler form static Map(String, MsgpackRpcRequestHandler) methods.
Registration to "methods" is done by "msgpack_rpc_add_method_handler" in "build/src/nvim/auto/api/private/dispatch_wrappers.nenerated.h" that generated by "src/nvim/generators/gen_api_dispatch.lua".
"receive_msgpack" is passed to "rstream_start" as "read_cb" in "rpc_start".
@erw7
erw7 / nvim_mem_leak.txt
Last active October 27, 2022 11:20
neovim memory leak
:lua local ns=vim.api.nvim_create_namespace('test') vim.api.nvim_set_decoration_provider(ns, {on_start=function() error('on_start error') end})
==1175== 170 bytes in 1 blocks are definitely lost in loss record 165 of 303
==1175== at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1175== by 0x2CFB71: try_malloc (memory.c:80)
==1175== by 0x2CFBBF: xmalloc (memory.c:114)
==1175== by 0x1AAC01: api_set_error (helpers.c:838)
==1175== by 0x2A30B2: nlua_call_ref (executor.c:1597)
==1175== by 0x1E3EAF: decor_provider_invoke (decoration_provider.c:27)
==1175== by 0x1E4362: decor_providers_start (decoration_provider.c:91)
local ffi = require('ffi')
ffi.cdef[[
typedef int BOOL;
typedef void* HANDLE;
typedef void* LPVOID;
typedef const char* LPCSTR;
typedef unsigned long DWORD;
typedef DWORD* LPDWORD;
typedef long* LONG_PTR;
typedef struct _SECURITY_ATTRIBUTES {
--- summarye.el.orig 2024-03-28 23:29:03.094303000 +0900
+++ summarye.el 2024-03-28 23:27:05.399045100 +0900
@@ -24,7 +24,7 @@
;; and this notice must be preserved on all copies.
;; Commentary:
-; Todo:
+ ; Todo:
;; CHANGE LOG
;; Ver 2.5.2 [2005-07-25T09:28:12.00+9:00]