Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env perl
foreach (<stdin>) {
# DCS/OSC/SOS/PM/APC
$_ =~ s/\x1b[P\]X\^_].*(\x07|\x1b\\)//g;
# CSI
$_ =~ s/\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]//g;
# single shift
@mollifier
mollifier / file0.sh
Created December 11, 2012 00:08
zsh の vcs\_info に独自の処理を追加して stash 数とか push していない件数とか何でも表示する ref: http://qiita.com/items/8d5a627d773758dd8078
# vcs_info 設定
RPROMPT=""
autoload -Uz vcs_info
autoload -Uz add-zsh-hook
autoload -Uz is-at-least
autoload -Uz colors
# 以下の3つのメッセージをエクスポートする
@ttdoda
ttdoda / TERATERM-Solarized.INI
Created November 1, 2012 14:23
Tera Term Solarized color setting
ANSIColor=0,7,54,66, 1,203,75,22, 2,88,110,117, 3,101,123,131, 4,131,148,150, 5,108,113,196, 6,147,161,161, 7,253,246,227, 8,0,43,54, ,220,50,47, 10,133,153,0, 11,181,137,0, 12,38,139,210, 13,211,54,130, 14,42,161,152, 15,238,232,213
; Solarized Dark
VTColor=131,148,150,0,43,54
VTBoldColor=147,161,161,7,54,66
VTBlinkColor=133,153,0,0,43,54
;VTReverseColor=0,43,54,131,148,150
VTReverseColor=101,123,131,253,246,227
URLColor=181,137,0,0,43,54
@sh2
sh2 / fio_summarize.pl
Created September 5, 2012 05:59
fio test/summarize script
#!/usr/bin/perl
use strict;
use warnings;
my (%sequential, %random);
my ($type, $blocksize, $ratio, $iodepth, $header);
while (my $line = <STDIN>) {
@saitoha
saitoha / gist:3606583
Created September 3, 2012 03:36
iTerm2 Remote Clipboard Copy
function! s:ITerm2Copy() range
let l:tmp = @@
silent normal gvy
let l:selected = @@
let l:i = 0
let l:len = strlen(l:selected)
let l:escaped = ''
while l:i < l:len
let l:c = strpart(l:selected, l:i, 1)
let l:escaped .= printf("\\u%04x", char2nr(l:c))
fizz = function f() {
fizz = function () {
fizz = function () {
fizz = f
return "Fizz"
}
}
}
buzz = function f() {
@saitoha
saitoha / screen-osc-utf8.diff
Created July 19, 2012 13:31
Unicode(UTF-8) support for GNU Screen's OSC/AKA/hardstatus.
diff --git a/src/ansi.c b/src/ansi.c
index d88e153..fc42a0a 100644
--- a/src/ansi.c
+++ b/src/ansi.c
@@ -1493,8 +1493,24 @@ int c;
{
if (curr->w_stringp >= curr->w_string + MAXSTR - 1)
curr->w_state = LIT;
+# ifdef UTF8
+ else if (c < 0x80)
@saitoha
saitoha / screen-sgr-mouse.diff
Created July 12, 2012 12:04
Support SGR 1006 mouse reporting, for GNU Screen
diff --git a/src/ansi.c b/src/ansi.c
index d88e153..088ab0b 100644
--- a/src/ansi.c
+++ b/src/ansi.c
@@ -193,6 +193,7 @@ register struct win *p;
p->w_insert = 0;
p->w_revvid = 0;
p->w_mouse = 0;
+ p->w_mouse_protocol = 0;
p->w_curinv = 0;
@saitoha
saitoha / screen-bpm-cursorstyle.diff
Created June 23, 2012 11:01
add Bracketed Paste Mode and DECSCUSR support for GNU Screen (http://savannah.gnu.org/git/?group=screen)
diff --git a/src/ansi.c b/src/ansi.c
index d88e153..89116c3 100644
--- a/src/ansi.c
+++ b/src/ansi.c
@@ -193,6 +193,8 @@ register struct win *p;
p->w_insert = 0;
p->w_revvid = 0;
p->w_mouse = 0;
+ p->w_bracketed = 0;
+ p->w_cursorstyle = 0;
@saitoha
saitoha / drcsconv.pl
Created June 20, 2012 13:45
Convert image file to VT-320's DRCS format.
#!/usr/bin/env perl
use strict;
use warnings;
if ($#ARGV != 0) {
print "ussage: drcsconv.pl <filename>.";
exit 0;
}
my $file = $ARGV[0];