Skip to content

Instantly share code, notes, and snippets.

View retorillo's full-sized avatar

Retorillo retorillo

View GitHub Profile
@retorillo
retorillo / vim_throw_number.md
Created January 28, 2017 05:16
Vim can throw number

Vim can also throw number. But it will be automatically stringified and stored into v:exception

try
  throw 123
catch
  echo type(v:exception) == type('')
  " will be 1
endtry

Vim Script cross-platform scripting between Windows and Linux

Test Environment

  • Vim 8 on Windows 10 (from chocolatey)
  • Vim 7 on Bash on Ubuntu on Windows 10

system()

Playing short audio file on Firefox

The following problems seems to raise only on Firefox. (Chrome and Edge can play short audio file well)

This problems and solutions are confirmed on Firefox 52.0.2 (32-bit) on Windows 10 (x64)

Go to mute state

let list = split(globpath('./,lib,bin,test', '*'), '\v\r?\n')
for l in list
if !isdirectory(l) && filewritable(l)
exec printf('e %s', l)
exec 'set ff=unix'
exec 'set nobomb'
exec '%s/\s*$//'
endif
endfor

Frequently Used

  • Pencil B
  • Erase E
  • Default Foregroud/Background Colors D
  • Toggle Quick Mask X
  • Hue/Saturation Ctrl + U
  • Color Balance Ctrl + B
  • Image Size Alt + Ctrl + I
  • Canvas Size Alt + Ctrl + C
@retorillo
retorillo / lzw-refs.md
Last active July 14, 2017 10:27
GIF and LZW References
@retorillo
retorillo / unpacking-variable-length-bitstream-for-gif-like-lsb-first-packing.gif
Last active July 19, 2017 12:26
Unpacking Variable-Length Bitstream for GIF-like LSB first Packing
unpacking-variable-length-bitstream-for-gif-like-lsb-first-packing.gif

CL command does not work on the following batch file because build.bat will stop by showing message "Hit any key to close this window..." before CL. (vcvarsall.bat uses exit /b)

rem buid.bat
...\vcvarsall.bat x64
cl ...

USE &&

How to display OutputDebugMessage-output without Visual Studio

According of my attempt, windbg could not accomplish this task. dbgview is one of alternative.

dbgview is not included to common SDK or Devtools. Can download from: https://technet.microsoft.com/en-us/sysinternals/bb896647.aspx

To use, run dbgview.exe and configure its filter, finally run debug target application. For modern Windows, must run dbgview.exe as Administrator, otherwise cannot receive debug messages from common applications.

Note that OutputDebugMessage (https://msdn.microsoft.com/en-us/library/windows/desktop/aa363362(v=vs.85).aspx) seems to work fine without debug configuration. (/Zi, /DEBUG) So, should do like this for release build:

WinHTTP Development Tips

WinHTTP vs WinINet

According to this chart, WinHTTP has a lot weak points in comparison with WinINet. But WinHttp supports the following features:

  • Services Support (Can be run from a service or a service account)
  • Session Isolation(Separate sessions do not impact each other)
  • Impersonation(Supports being called while the thread is impersonating a different user)