Skip to content

Instantly share code, notes, and snippets.

Swimming 🏊 in the sea of code~~

jdhao jdhao

Swimming 🏊 in the sea of code~~
Block or report user

Report or block jdhao

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jdhao / build.bat
Last active Oct 14, 2019
Create Markdown tags for use in tagbar
View build.bat
pyinstaller --onefile --console
jdhao /
Created Sep 17, 2019
How to grep unicode character in command line

How do I grep unicode characters using its code point?

For example, if we want to grep a(unicode code point is u+0041), we can use the following trick:

grep "$(printf '\u0041')" my_file.txt


View gist:43d2d12c3d9e9e3cb31878f4452cb704

When log in to server, I see the following error message;

RSA host key for xxxx has changed and you have requested strict checking. Host key verification failed.

You can remove the offending host key from file ~/.ssh/known_hosts. For example, if line 1 includes the offending hosts info, just remove it:

sed -i.bak -e '1d' ~/.ssh/known_hosts
jdhao / en.utf-8.add
Created Sep 16, 2019
Nvim spell file
View en.utf-8.add
jdhao / utils.vim
Created Sep 12, 2019
My utils functions used in init.vim
View utils.vim
" Remove trailing white space, see
function utils#StripTrailingWhitespaces() abort
let l:save = winsaveview()
" vint: next-line -ProhibitCommandRelyOnUser -ProhibitCommandWithUnintendedSideEffect
keeppatterns %s/\v\s+$//e
call winrestview(l:save)
" Create command alias safely, see
" The following two functions are taken from answer below on SO:
jdhao / cpp.vim
Last active Sep 12, 2019
Filetype plugins for Neovim
View cpp.vim
nnoremap <F9> :w <CR> :!g++ -Wall -std=c++11 % -o %<&&./%<<CR>
jdhao /
Created May 31, 2019
Convert Unicode string to bytes and convert bytes back to Unicode string in Python 3

Conversion between bytes and string in Python 3

To convert Unicode string to bytes object, you can use two methods:

  • 'hello'.encode('utf-8')
  • bytes('hello', encoding='utf-8')

To convert bytes back to Unicode string, you can use two methods:

  • b'\xe4\xbd\xa0\xe5\xa5\xbd'.decode('utf-8')
jdhao / Markdown2docx.sublime-build
Created May 30, 2019
Markdown to docx build system for Sublime Text 3
View Markdown2docx.sublime-build
"shell_cmd": "pandoc \"${file}\" -o \"${file_path}/${file_base_name}.docx\" ",
// "path": "C:/Users/east/AppData/Local/Pandoc/;%PATH%",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "text.html.markdown",
jdhao / .pylintrc
Last active Jun 19, 2019
pylint config
View .pylintrc
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code
# Add files or directories to the blacklist. They should be base names, not
# paths.
View ConEmu.xml
<?xml version="1.0" encoding="utf-8"?>
<key name="Software">
<key name="ConEmu">
<key name=".Vanilla" modified="2019-04-29 11:20:20" build="180626">
<value name="ColorTable00" type="dword" data="00222827"/>
<value name="ColorTable01" type="dword" data="009e5401"/>
<value name="ColorTable02" type="dword" data="0004aa74"/>
<value name="ColorTable03" type="dword" data="00a6831a"/>
<value name="ColorTable04" type="dword" data="003403a7"/>
<value name="ColorTable05" type="dword" data="009c5689"/>
You can’t perform that action at this time.