Skip to content

Instantly share code, notes, and snippets.


Deliang Yang LanternD

View GitHub Profile
LanternD /
Created Jul 25, 2020
Upgrade all pip upgradable packages
pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U
LanternD / 50-stm32-usb-cdc-vcp.rules
Last active Nov 26, 2019
Prevent the 10-second "Device or Resource Busy" on Ubuntu for STM32 USB Virtual Comm Port
View 50-stm32-usb-cdc-vcp.rules
# Prevent the notification "Device or resource busy" when the STM32 is connected to the System for the first 10 seconds.
# Put the file under /etc/udev/rules.d/
# Reload the rules with:
# $ sudo udevadm control --reload
# $ sudo udevadm trigger
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", ENV{ID_MM_DEVICE_IGNORE}="1"\
MODE:="0666", \
LanternD /
Last active Sep 25, 2019
Print Colorful Text in Python
WARN = '\033[93m[WARN]\033[00m'
INFO = '\033[92m[INFO]\033[00m'
ERR = '\033[91m[ERR]\033[00m'
DBG = '\033[94m[DBG]\033[00m'
def prt_warn(s): print("\033[93m[WARN]\033[00m {0}".format(s))
def prt_info(s): print("\033[92m[INFO]\033[00m {0}".format(s))
def prt_err(s): print("\033[91m[ERR]\033[00m {0}".format(s))
def prt_dbg(s): print("\033[94m[DBG]\033[00m {0}".format(s))
LanternD /
Last active May 31, 2019
Handful Pyspark Functions

A list of useful pyspark functions that I used. A learning note.

Remove rows with NULL value (equivalent to empty string in csv)

non_empty_row_df = df.filter('your_column_name is not NULL')
LanternD / .vimrc
Last active Nov 28, 2018
Some Vim commands that I need every now and then. Keep updating.
View .vimrc
" I put these commands in a '.vimrc' file, but this is not my actually '.vimrc'.
" change the syntax highlight of the current buffer
:set syntax=c
" no syntax highlight
:set syntax=off
" .vimrc. Bind the syntax option to a specific file extension
autocmd BufNewFile,BufRead *.your_ext set syntax=json
LanternD /
Last active Nov 26, 2018
Some useful shortcuts in Ubuntu Nautilus (file browser)

List Version

  • Ctrl + W: Close Nautilus window
  • Ctrl+T: Open a new tab (same as chrome)
  • Ctrl + H: Toggle the hidden file display
  • Ctrl + Q: Quit Nautilus
  • Ctrl + L: Show path to current directory
  • Ctrl + 1/2: Toggle between list view (1) and icon view (2)
  • Ctrl + Shift + W: Close all Nautilus windows, = Ctrl + Q
  • Ctrl + Shift + N: Create new folder
LanternD /
Last active Nov 14, 2018 — forked from fredrick/
GNU Screen Cheat Sheet

GNU Screen Cheat Sheet


  • Ctrl+a c -> Cre­ate new win­dow
  • Ctrl+a A -> Set win­dow name
  • Ctrl+a w -> Show all win­dow
  • Ctrl+a 1|2|3|… -> Switch to win­dow n
  • Ctrl+a " -> Choose win­dow
  • Ctrl+a Ctrl+a -> Switch between win­dow
LanternD /
Last active Sep 25, 2019
Collection of handful Python short snippets.
# Useful short snippets in Python.
# Return the list of all the file names in the given directory
import os
def get_file_list(file_path):
files = []
for root, dirs, files in os.walk(file_path):
print('# of files: {0}'.format(len(files)))
LanternD / fixed_table_column_width_aligned_text_demo.tex
Created Jun 17, 2018
LaTeX - Fixed table column width while aligning text left/center/right
View fixed_table_column_width_aligned_text_demo.tex
You can’t perform that action at this time.