Skip to content

Instantly share code, notes, and snippets.

@hackerb9
hackerb9 / sixcat
Created June 3, 2017 03:36
sixcat: Like 'cat' but show images directly in the terminal using SIXEL graphics
#!/bin/bash
# sixcat: Use sixel graphics to show an image inside a terminal.
# sixgif: Use sixel graphics to play an animation inside a terminal.
# Version 1.0
# hackerb9, June 2017
# Sixel graphics are supported by terminals such as the DEC VT340 and
# emulators, such as 'xterm -ti vt340'.
@ttdoda
ttdoda / w3m-sgr-style-menu.diff
Last active August 29, 2015 14:26
SGR 1006 mouse reporting for w3m's menu
--- menu.c.orig 2011-01-04 18:22:23.000000000 +0900
+++ menu.c 2015-08-05 17:37:19.035511000 +0900
@@ -57,6 +57,7 @@
static int mClose(char c);
static int mSusp(char c);
static int mMouse(char c);
+static int mSgrMouse(char c);
static int mSrchF(char c);
static int mSrchB(char c);
static int mSrchN(char c);
@hetima
hetima / file1.markdown
Last active January 22, 2018 08:51
How to transition from EasySIMBL to SIMBL

#How to transition from EasySIMBL to SIMBL

( ~ is your home directory )

  1. Launch EasySIMBL.app. Turn OFF Use SIMBL checkbox. Quit EasySIMBL.
  2. Remove ~/Library/ScriptingAdditions/EasySIMBL.osax if exists.
  3. SIMBL directory and EasySIMBL.osax located in ~/Library/Containers/ is not needed. Find from Finder or find command like find ~/Library/Containers -name "*SIMBL*" -ls and remove manually if exists.
  4. Restart Mac (just in case).
  5. Install SIMBL-0.9.9 (original SIMBL-0.9.9.pkg is not code signed. So open from context menu)
  6. Done.
@mattn
mattn / gist:78477753124fb4eb84a3
Last active August 29, 2015 14:11
Patch to add ambiwidth=fulldouble to display N (neutral unicode characters) as double
diff -r 8cae3b61ce9e runtime/doc/options.txt
--- a/runtime/doc/options.txt Mon Dec 08 04:16:45 2014 +0100
+++ b/runtime/doc/options.txt Wed Dec 10 14:28:43 2014 +0900
@@ -685,6 +685,7 @@
"single": Use the same width as characters in US-ASCII. This is
expected by most users.
"double": Use twice the width of ASCII characters.
+ "fulldouble": Use twice the width for neutral characters.
*E834* *E835*
The value "double" cannot be used if 'listchars' or 'fillchars'
@uobikiemukot
uobikiemukot / libsixel_normalize_depth.patch
Created October 6, 2014 11:49
support image 1/2 byte pel pixel image(grayscale (+ alpha)) and 4 bytes per pixel image (rgb + alpha)
diff --git a/src/dither.c b/src/dither.c
index 4f777e2..5ac4eeb 100644
--- a/src/dither.c
+++ b/src/dither.c
@@ -218,24 +218,64 @@ sixel_dither_get(int builtin_dither)
}
+void
+sixel_normalize_depth(unsigned char *dst, unsigned char *src, int width, int height, int depth)
@uobikiemukot
uobikiemukot / w3m-sixel.patch
Last active August 29, 2015 14:06
sixel inline image patch for w3m-0.5.3
--- terms.c.orig 2014-09-23 21:36:24.992432936 +0900
+++ terms.c 2014-09-23 21:51:16.598842197 +0900
@@ -463,6 +463,80 @@
#define MOVE(line,column) writestr(tgoto(T_cm,column,line));
+int output_sixel_fp(char *file, int x, int y)
+{
+ int length;
+ long size, rsize, count = 0;
@ttdoda
ttdoda / gist:c9db22ed1668e2e29a76
Last active August 29, 2015 14:03
Application Escape Key Mode改良試験用設定
let &t_SI .= "\e[?14004h"
let &t_EI .= "\e[?14004l"
inoremap <special> <Esc>[=27%~ <nop>
noremap <special> <Esc>[=27%~ <nop>
@uobikiemukot
uobikiemukot / 16palette.sixel
Last active August 29, 2015 14:02
show default 16 color palette of sixel
Pq"1;1;128;36
#0!16~#1!16~#2!16~#3!16~#4!16~#5!16~#6!16~#7!16~$-
#0!16~#1!16~#2!16~#3!16~#4!16~#5!16~#6!16~#7!16~$-
#0!16~#1!16~#2!16~#3!16~#4!16~#5!16~#6!16~#7!16~$-
#8!16~#9!16~#10!16~#11!16~#12!16~#13!16~#14!16~#15!16~$-
#8!16~#9!16~#10!16~#11!16~#12!16~#13!16~#14!16~#15!16~$-
#8!16~#9!16~#10!16~#11!16~#12!16~#13!16~#14!16~#15!16~$-
\
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)
@olofsen
olofsen / rs.jl
Last active May 31, 2020 06:15
Reading, displaying, and converting a Sixel Graphics file with Julia
# The function ds() below reads a Sixel graphics file and creates an RGB Image,
# which can then be displayed and processed using the Image package.
# Public domain example code.
using Color, Images, ImageView
function vt340_palette()
pal = RGB[]
push!(pal, RGB(0.00, 0.00, 0.00))
push!(pal, RGB(0.20, 0.20, 0.80))