Skip to content

Instantly share code, notes, and snippets.

View jdhao's full-sized avatar
:octocat:
Swimming 🏊 in the sea of code~~

jdhao jdhao

:octocat:
Swimming 🏊 in the sea of code~~
View GitHub Profile
@jdhao
jdhao / .bash_profile
Created April 18, 2019 07:33
Bash configurations
export PATH=$HOME/local/bin:$PATH
export SHELL=`which zsh`
[ -f "$SHELL" ] && exec "$SHELL" -l
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
@jdhao
jdhao / .tmux.conf
Created April 18, 2019 07:34
Tmux configuratons
#######################################################################
# key bindings #
#######################################################################
# SET THE PREFIX TO CTRL-W.
unbind C-b
set-option -g prefix C-w
bind-key C-w send-prefix
# make split pane similar to vim
@jdhao
jdhao / words
Last active September 16, 2019 02:59
Dictionary for Neovim (adapted from the dict on Linux systems)
A.A.A.
AAAAAA
Aaberg
Aachen
aahing
Aalborg
Aalesund
aaliis
Aandahl
A-and-R
@jdhao
jdhao / markdown.snippets
Last active September 16, 2019 02:04
My snippet files for Ultisnips: https://github.com/SirVer/ultisnips
snippet kbd "HTML kbd tag"
<kbd>${1:KEY}</kbd>$0
endsnippet
snippet head "Markdown header" b
---
title: "$1"
date: `!v strftime("%Y-%m-%d %H:%M:%S%z")`
tags: [$2]
categories: [$3]
@jdhao
jdhao / ConEmu.xml
Created April 29, 2019 03:22
Settings for Cmder: https://cmder.net/
<?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"/>
@jdhao
jdhao / .pylintrc
Last active June 19, 2019 09:17
pylint config
[MASTER]
# 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
extension-pkg-whitelist=cv2
# Add files or directories to the blacklist. They should be base names, not
# paths.
ignore=CVS
@jdhao
jdhao / Markdown2docx.sublime-build
Created May 30, 2019 08:51
Markdown to docx build system for Sublime Text 3
{
"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",
"variants":
[
{
@jdhao
jdhao / str_byte_convert.md
Created May 31, 2019 10:30
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
jdhao / cpp.vim
Last active September 12, 2019 09:56
Filetype plugins for Neovim
nnoremap <F9> :w <CR> :!g++ -Wall -std=c++11 % -o %<&&./%<<CR>
@jdhao
jdhao / utils.vim
Created September 12, 2019 09:57
My utils functions used in init.vim
" Remove trailing white space, see https://vi.stackexchange.com/a/456/15292
function utils#StripTrailingWhitespaces() abort
let l:save = winsaveview()
" vint: next-line -ProhibitCommandRelyOnUser -ProhibitCommandWithUnintendedSideEffect
keeppatterns %s/\v\s+$//e
call winrestview(l:save)
endfunction
" Create command alias safely, see https://bit.ly/2ImFOpL.
" The following two functions are taken from answer below on SO: