Skip to content

Instantly share code, notes, and snippets.

View BbsonLin's full-sized avatar
🏚️
Working...

Bobson Lin BbsonLin

🏚️
Working...
View GitHub Profile
@BbsonLin
BbsonLin / jupyter_theme_setup.sh
Last active July 17, 2022 20:06
Jupyter Notebook Installation and Setting
pip install jupyter jupyterthemes
jt -t monokai -f sourcemed -fs 13 -tf sourcesans -tfs 16 -nf source -nfs 14
jupyter notebook
@BbsonLin
BbsonLin / gradient-cover.scss
Created December 5, 2017 14:00
Background Gradient Cover
$color-primary: #55c57a;
$color-primary-light: #7ed56f;
$color-primary-dark: #28b485;
.header {
height: 95vh;
background-image: linear-gradient(
to right bottom,
rgba($color-primary-light, 0.8),
rgba($color-primary-dark, 0.8)),
@BbsonLin
BbsonLin / animate-pseudo.scss
Last active December 6, 2017 01:56
Animation with pseudo element
// html code
// <a href="#" class="btn btn--white">Button</a>
$color-grey-dark: #777;
$color-white: #fff;
$color-black: #000;
html {
// Let 1rem = 10px
font-size: 62.5%;
@BbsonLin
BbsonLin / dev_setup.md
Last active June 4, 2018 01:35
Backend System Develop Setup (Flask + Vuejs)

Backend Setup

Using the pipenv for a clean Python environment

1. Install pipenv

$ sudo apt-get install python3-pip
$ sudo pip3 install pipenv
import time
import hashlib
serial = 'QQ0001'
if __name__ == '__main__':
now_time = time.time()
print(now_time)
h1 = hashlib.sha1()
h1.update((str(now_time) + serial).encode('utf-8'))
@BbsonLin
BbsonLin / python3_time_snippet.py
Created April 26, 2018 14:04
How time transfer is always being annoying, so I make this gist for record~
import time
from datetime import datetime, timedelta
print('------------------------------------')
# Get now timestamp & datetime
now_dt = datetime.today()
print('Now datetime is:', now_dt)

Setup for developer

  1. Install Basic
sudo apt install vim git tig htop
  1. Git cz-cli (Ref)
@BbsonLin
BbsonLin / .vimrc
Last active October 12, 2018 12:48
My .vimrc. Need to install https://github.com/junegunn/vim-plug first.
set nu
set bg=dark
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
endif
call plug#begin('~/.vim/plugged')
@BbsonLin
BbsonLin / python3_filter_dict.py
Created November 14, 2018 08:10
How to filter dictionary key or value by list
d = {'Bobson': 20, 'Bob': 22, 'Lin': 33}
# filter by key
d2 = {k : v for k,v in filter(lambda t: t[0] in ['Bobson', 'Lin'], d.items())}
print('d2 = ', d2)
# filter by value
d3 = {k : v for k,v in d.items() if v in [22, 33]}
print('d3 = ', d3)
import serial
FLAG = 0x7E
HEX_NUMBER = 0xFF
HEX_NUMBERS = [0xFF, 0x15]
# INT <---> STRING(hex)
print(FLAG, type(FLAG)) # 126 <class 'int'>
print(hex(FLAG), type(hex(FLAG))) # 0x7e <class 'str'>
print(int(hex(FLAG), 16)) # 126