Skip to content

Instantly share code, notes, and snippets.

@khiemdoan
khiemdoan / 01-netcfg.yaml
Created April 9, 2020 01:54
Config static ip in ubuntu (netplan)
# Config static ip in ubuntu (netplan)
# /etc/netplan/01-netcfg.yaml
network:
version: 2
ethernets:
ens32:
dhcp4: no
addresses:
- 172.16.175.130/24
"""
This module is a decorator which use to measure the total execution time of a function.
"""
__author__ = 'Khiem Doan'
__email__ = '[email protected]'
from functools import wraps
from logging import Logger
from time import process_time, time

Linux configs

Hardware clock in local time

sudo timedatectl set-local-rtc 1 --adjust-system-clock

Increasing the amount of inotify watchers

If you are running Debian, RedHat, or another similar Linux distribution, run the following in a terminal:

VLC media player

sudo snap install vlc

GitKraken

sudo snap install gitkraken
from IPython.display import display

def summary_data(data):
    print(f'Dataframe dimensions: {data.shape}')
    tab_info = pd.DataFrame(data.dtypes).T.rename(index={0: 'column type'})
    tab_info = tab_info.append(pd.DataFrame(data.isnull().sum()).T.rename(index={0: 'null values (nb)'}))
    tab_info = tab_info.append(pd.DataFrame(data.isnull().sum() / data.shape[0] * 100).T.rename(index={0: 'null values (%)'}))
    display(tab_info)
import logging
import logging.handlers
from pathlib import Path
from utils import Filesystem
__author__ = 'KhiemDH'
__github__ = 'https://github.com/khiemdoan'
__email__ = '[email protected]'

Manjaro Setup

This note is about softwares, configs in my Manjaro.

Update mirrorlist with the fastest mirrors

sudo pacman-mirrors --fasttrack && sudo pacman -Syyu

Snap

// KhiemDH - 2019-06-26
#ifndef _DBG_PRINT_KHIEMDH_
#define _DBG_PRINT_KHIEMDH_
#ifndef _DEBUG
#define DbgPrint(_exp, ...) __noop
#!/bin/sh
# Auto install Google Chrome
# Khiem Doan <[email protected]>
# use for Ubuntu
sudo rm -f /etc/apt/sources.list.d/google-chrome.list
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list
sudo apt update
@khiemdoan
khiemdoan / remove_vietnamese_tones.py
Last active July 1, 2019 03:46
Remove Vietnamese Accent
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Remove Vietnamese tones function"""
"""Author: Khiem Doan"""
uni_chars_l = 'áàảãạâấầẩẫậăắằẳẵặđèéẻẽẹêếềểễệíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵ'
uni_chars_u = 'ÁÀẢÃẠÂẤẦẨẪẬĂẮẰẲẴẶĐÈÉẺẼẸÊẾỀỂỄỆÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴ'
no_tone_chars_l = 'a'*17 + 'd' + 'e'*11 + 'i'*5 + 'o'*17 + 'u'*11 + 'y'*5