Skip to content

Instantly share code, notes, and snippets.

"""
This module is a decorator which use to measure the total execution time of a function.
"""
__author__ = 'Khiem Doan'
__email__ = 'doankhiem.crazy@gmail.com'
from functools import wraps
from logging import Logger
from time import process_time, time
@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
@khiemdoan
khiemdoan / install_microk8s.sh
Last active September 30, 2023 21:53
Install Microk8s on Ubuntu machine
# Install microk8s from the edge channel (Rancher requires Helm 2.15.1 or above)
sudo snap install microk8s --classic
# Enable useful plugins
sudo microk8s.enable dns dashboard storage ingress helm
# Allow running priviledged Pods (required by Rancher's `cattle-node-agent`)
sudo sh -c 'echo "--allow-privileged=true" >> /var/snap/microk8s/current/args/kube-apiserver'
sudo systemctl restart snap.microk8s.daemon-apiserver.service
# Setup and install Tiller (part of Helm)
# ansible-playbook shutdown.yml -K
---
- name: shutdown
hosts: all
become: 'yes'
become_method: sudo
tasks:
- name: shutdown hosts
command: /sbin/shutdown -h now
@khiemdoan
khiemdoan / How to Install WSL 2 on Windows 10
Last active December 17, 2020 02:35
How to Install WSL 2 on Windows 10
WSL 2 in CLI Mode:
winver (needs Windows 10 2004 or above)
Open> Turn Windows features on and off
Select>
- Virtual Machine Platform
- Windows Subsystem for Linux
Press> OK (system restart)
@khiemdoan
khiemdoan / Unstrict ssh in WSL.md
Last active June 25, 2021 08:31
No checking ssh
mkdir -p ~/.ssh   
echo "Host *" > ~/.ssh/config     
echo " StrictHostKeyChecking no" >> ~/.ssh/config
ssh -o StrictHostKeyChecking=no user@host
@khiemdoan
khiemdoan / MacOS.md
Last active October 3, 2023 14:18
MacOS Setup

MacOS

This note about software, config in my MacOS.

Check CPU temperature

sudo powermetrics -s smc | grep -i "CPU die temperature"
@khiemdoan
khiemdoan / gitconfig.md
Last active November 10, 2022 02:45
Default config for git
git config --global pull.rebase false
git config --global fetch.prune true
git config --global diff.colorMoved zebra
git config --global commit.gpgsign true
@khiemdoan
khiemdoan / active_m$_products.md
Last active February 17, 2023 03:39
Active M$ products

Active Windows 11

Active Windows 11 Pro

# Open Powershell/Command Prompt as administrator
slmgr /ipk W269N-WFGWX-YVC9B-4J6C9-T83GX
slmgr /skms kms8.msguides.com
slmgr /ato