Skip to content

Instantly share code, notes, and snippets.

diff -r fd6fcb6dd914 lib/tw/app/render.rb
--- a/lib/tw/app/render.rb Mon Aug 19 20:09:42 2013 +0900
+++ b/lib/tw/app/render.rb Tue Aug 20 01:03:00 2013 +0900
@@ -48,7 +48,7 @@
imgfile = cachedir + "/#{m.user}"
until FileTest.exist?(imgfile) do
img_url = Twitter.user(m.user).profile_image_url
- system("curl -k -s #{img_url} | convert -resize #{iconsize}x#{iconsize} - -colors 256 ppm:- | ppmtosixel 2>/dev/null | tr -d '\n' > #{imgfile}")
+ system("curl -k -s #{img_url} | convert -resize #{iconsize}x#{iconsize} - -colors 256 ppm:- | ppmtosixel 2>/dev/null | LC_ALL=C tr -d '\n' > #{imgfile}")
end
@saitoha
saitoha / vsplit-bce.txt
Created September 5, 2013 14:18
iTerm2 bce behavior with vsplit feature have drawing problem. echo -en "\033c\033[1000d\033[41m\n\n\033[?69h\033[4;33s\033[1000d\033[42m\n\n"
2013-09-05 23:14:13.549 iTerm[24744:303] ** Experimental optimizations enabled **
2013-09-05 23:14:18.232 iTerm[24744:303] No complex char for code 60416
2013-09-05 23:14:18.232 iTerm[24744:303] No complex char for code 1729
(lldb) bt
* thread #1: tid = 0x1c03, 0x00007fff8a38f097 libobjc.A.dylib`objc_msgSend + 23, stop reason = EXC_BAD_ACCESS (code=1, address=0x18)
frame #0: 0x00007fff8a38f097 libobjc.A.dylib`objc_msgSend + 23
frame #1: 0x000000010005fe3b iTerm`-[PTYTextView color:withContrastAgainst:](self=0x0000000101879600, _cmd=0x0000000100505350, mainColor=0x000000010058d290, otherColor=0x00000001029c3fd0) + 107 at PTYTextView.m:6280
frame #2: 0x00000001000608f8 iTerm`-[PTYTextView _constructRuns:theLine:reversed:bgselected:width:indexRange:bgColor:matches:storage:](self=0x0000000101879600, _cmd=0x00000001005054a0, initialPoint=(null), theLine=0x00000001029ed430, reversed='\0', bgselected='\0', width=80, indexRange=(null), bgColor=0x00000001029c3fd0, matches=0x0000000000000000, storage=0x0000
@saitoha
saitoha / gist:7387177
Last active December 27, 2015 20:49
【どう書く】高速・省メモリなセルのクリッピング塗り潰しアルゴリズムについて
一次元配列X上に並んだ有限個のセルを考える。
□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□ ...
これに、範囲オブジェクト(start, end)を与えると、
その範囲のセルが塗りつぶされる作用を持つ関数Fillを考える。
※ ここで、(start, end) は、start <= n < end を満たす
インデックス n でアクセス可能なセル X[n] の集合を表現している。
たとえば、範囲オブジェクト (3, 7) で表される領域には、
@saitoha
saitoha / penetrate.py
Last active August 3, 2021 13:31
cat sixel file with penetrating GNU Screen
% screen
% cat test.png | pngtopnm | pnmquant 256 | ppmtosixel | ./penetrate.py && cat
% cat test.png | sixelconv | ./penetrate.py && cat
@saitoha
saitoha / .vimrc
Created December 3, 2013 22:56
Vimで画像を見る(DRCSのSIXEL拡張の話) ref: http://qiita.com/kefir_/items/78e64c545a70a0ebea8a
" Vimであいまいな幅の文字の論理幅を1にします
set ambiwidth=single
" RLoginであいまいな幅の文字の論理幅を1にします。
call writefile(["\e[?8428h"], '/dev/tty')
@saitoha
saitoha / graphics.c.diff
Created December 6, 2013 12:29
xterm: enable 256-colored sixel graphics for vt340 mode (with "-ti vt340" option)
--- xterm-300/graphics.c 2013-12-06 21:26:36.000000000 +0900
+++ xterm-300/graphics.c 2013-12-06 21:26:13.000000000 +0900
@@ -418,7 +418,7 @@
graphic->valid_registers = 4;
break;
case 340:
- graphic->valid_registers = 16;
+ graphic->valid_registers = 256;
break;
default:
@saitoha
saitoha / ml_vt100_parser.c.diff
Last active December 30, 2015 18:59
mlterm: mkf_map_ucs4_to_iscii hangs when libind is disabled on OSX 10.9
diff -r 3886b45f93c8 mlterm/ml_vt100_parser.c
--- a/mlterm/ml_vt100_parser.c Sat Dec 07 21:31:57 2013 +0900
+++ b/mlterm/ml_vt100_parser.c Mon Dec 09 21:33:14 2013 +0900
@@ -5734,7 +5734,7 @@
ch.property = 0 ;
}
#endif
- #if ! defined(NO_DYNAMIC_LOAD_CTL) || defined(USE_IND)
+ #if defined(USE_IND)
else
@saitoha
saitoha / enable_appesc.vim
Last active January 3, 2016 15:49
Add the support for application escape mode
let &t_ti = &t_ti . "\e[?7727h"
let &t_te = "\e[?7727l" . &t_te
nmap <t_kx> <Esc>
imap <t_kx> <Esc>
vmap <t_kx> <Esc>
cmap <t_kx> <Esc>
omap <t_kx> <Esc>
@saitoha
saitoha / Makefile
Last active January 16, 2023 13:16
SIXEL color graphics DEMO (xterm pl#301 and gnuplot)
#
# SIXEL color graphics DEMO
#
# xterm pl#301 with --enable-sixel-graphics option
# gnuplot with --with-bitmap-terminals option
#
# Now the color palette of xterm VT-340 mode is limited to 16.
# If you want to change it to 256, apply the following patch.
# https://gist.github.com/saitoha/7822989/raw/20727b88f0f826bfcb9d644907944b29a456b67f/graphics.c.diff
#
@saitoha
saitoha / glyph_width_reporting.md
Last active August 29, 2015 13:55
Proposal for resolving character-cell width problems in multilingual terminal emulators.

[Draft] glyph width query / report escape sequence

This document proposes two new escape sequences based on yaft's glyph width reporting feature.

YF_RQGRW - request glyph width list

The host sends this control string to retrive terminal-specific definition for character-cell width. The terminal is expected to respond with a YF_RPGRW sequence.