Skip to content

Instantly share code, notes, and snippets.

@TzuChiehHung
TzuChiehHung / .tmux.conf
Last active January 24, 2019 09:33
[tmux config] #tmux #powerline #config
# TC's tmux.conf
# =============================
# -----------------------------
# General settings
# -----------------------------
# scrollback buffer n lines
set -g history-limit 5000
@TzuChiehHung
TzuChiehHung / snippet.ipynb
Last active May 4, 2021 07:48
[TFRecord dataset shuffle batch example] #tensorflow #python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@TzuChiehHung
TzuChiehHung / python.vim
Last active May 5, 2018 07:28
[Python PEP8 style for vim] #vim #python
" vimrc file for following the coding standards specified in PEP 7 & 8.
"
" To use this file, source it in your own personal .vimrc file (``source
" <filename>``) or, if you don't have a .vimrc file, you can just symlink to it
" (``ln -s <this file> ~/.vimrc``). All options are protected by autocmds
" (read below for an explanation of the command) so blind sourcing of this file
" is safe and will not affect your settings for non-Python or non-C files.
"
"
" All setting are protected by 'au' ('autocmd') statements. Only files ending
@TzuChiehHung
TzuChiehHung / .vimrc
Last active June 12, 2018 03:36
[vim config] #vim #config
" Set the default file encoding to UTF-8:
set encoding=utf-8
" For full syntax highlighting:
let python_highlight_all=1
syntax on
" Automatically indent based on file type:
filetype indent on
" Keep indentation level from previous line:
@TzuChiehHung
TzuChiehHung / snippet.py
Last active September 23, 2019 00:49
[Convert dictionary to attribute] convert dictionary to class attribute for easily using. #python
class DictToAttr:
def __init__(self, **entries):
for key, value in entries.items():
value2 = (DictToAttr(**value) if isinstance(value, dict) else value)
self.__dict__[key] = value2
@TzuChiehHung
TzuChiehHung / snippet.py
Last active September 23, 2019 00:48
[Parse argument into class] #python
import argparse
class MyClass(object):
def __init__(self, foo, bar):
self.foo = foo
self.bar = bar
def Print(self):
print self.foo
print self.bar
@TzuChiehHung
TzuChiehHung / .inputrc
Last active May 14, 2020 01:53
[inputrc config] #config
"\e[A": history-search-backward
"\e[B": history-search-forward
set completion-ignore-case on
set completion-prefix-display-length 3
set mark-symlinked-directories On
set show-all-if-ambiguous On
set show-all-if-unmodified On
set visible-stats On
@TzuChiehHung
TzuChiehHung / .gitconfig
Last active June 25, 2018 08:21
[git config] #git #config
[user]
email = hungtc@solab.me.ntu.edu.tw
name = tc.hung
[core]
editor = vim
ignorecase = false
[push]
default = matching
[alias]
tree = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) %C(cyan)%ar%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)' --all
@TzuChiehHung
TzuChiehHung / run.sh
Last active September 23, 2019 00:54
[Change author and Email] #git
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="hungtc@solab.me.ntu.edu.tw"
CORRECT_NAME="tc.hung"
CORRECT_EMAIL="hungtc@solab.me.ntu.edu.tw"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
@TzuChiehHung
TzuChiehHung / README.md
Last active May 4, 2021 07:47
[Auto mount Samba share on Linux] #ubuntu
  • Create .smbcredentials

    username=username
    passowrd=password
    
  • Chage permission to prevent unwanted access