Skip to content

Instantly share code, notes, and snippets.

Avatar
🇭🇰
Code for freedom. Stand with Hong Kong.

Kenson Leung W.K mfkenson

🇭🇰
Code for freedom. Stand with Hong Kong.
View GitHub Profile
View firebeetle.json
{
"packages": [
{
"maintainer": "DFRobot DFRDuino",
"help": {
"online": "http://esp32.com"
},
"websiteURL": "https://github.com/espressif/arduino-esp32",
"platforms": [
{
@mfkenson
mfkenson / .bashrc
Last active Oct 24, 2021
wslg snapd ubuntu 20.04
View .bashrc
# https://github.com/microsoft/wslg/issues/479
# https://github.com/arkane-systems/genie/issues/175#issuecomment-922526126
# Append below to your .bashrc to fix wslg
wsl_mount_root=/mnt
wsl_windir="${wsl_mount_root}/c/WINDOWS/System32"
wsl_distro=Ubuntu-20.04
wsl_wslg_display=0
View plot_3d_plane_by_norm_vec.py
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
#iterate x and y so that z can be obtained
X,Y = np.meshgrid(np.arange(-2, 3),np.arange(-2, 3))
Z = np.zeros(X.shape)
norm_vector = np.array([0.22,0.44,0.65]) # arbitrary normal vector (but z can't be zero)
#norm_vec [A,B,C] representing plane Ax+By+Cz = 1
View plot_3d_points.py
import matplotlib.pyplot as plt
import numpy as np
all_points = np.array([[-0.25, 0.35, 1.29, 0.39, 1.19, 0.18, 0.22, 0.39, 0.67,-0.07],
[-0.19, -0.07, -0.1 , 0.38, 0.18, 0.3 , -0.2 , -0.08, -0.02,0.51],
[ 1.64, 1.46, 1.21, 1.18, 1.04, 1.24, 1.72, 1.43, 1.33,1.09]])
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
x = all_points[0]
@mfkenson
mfkenson / Install NVIDIA Driver and CUDA.md
Created Oct 29, 2019 — forked from zhanwenchen/Install NVIDIA Driver and CUDA.md
Install NVIDIA CUDA 9.0 on Ubuntu 16.04.4 LTS
View Install NVIDIA Driver and CUDA.md
@mfkenson
mfkenson / notion-custom-domain.js
Created Oct 26, 2019 — forked from mayneyao/notion2blog.js
notion.so custom domain
View notion-custom-domain.js
const MY_DOMAIN = "your domain"
const START_PAGE = "start page url"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, HEAD, POST,PUT, OPTIONS",
@mfkenson
mfkenson / install_ros_kinetic_on_ubuntu.sh
Last active Oct 8, 2019 — forked from bugra-derre/install_ros_kinetic_on_ubuntu.sh
Install ROS on Ubuntu, either for Ubuntu Desktop or Ubuntu Server.
View install_ros_kinetic_on_ubuntu.sh
#!/bin/bash
# -------------------------------------------------------------------------
# [Bugra] install_ros_kinetic_on_ubuntu.sh
# An installation script to install ROS on top of Ubuntu Xenial.
# -------------------------------------------------------------------------
doTheInstallation() {
# setup my sources.list
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
# set up your keys
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
@mfkenson
mfkenson / deploy-gh.sh
Created Sep 2, 2018 — forked from nicobytes/deploy-gh.sh
Deploy gh-pages ionic pwa
View deploy-gh.sh
#!/bin/bash
git branch -D gh-pages
git push origin --delete gh-pages
git checkout -b gh-pages
ionic build --prod
find . -type d ! -path './www*' ! -path './.git*' ! -path '.' | xargs rm -rf
rm -r *.*
mv www/* .
rm -rf www
git add .
@mfkenson
mfkenson / datatable.py
Created May 1, 2018 — forked from sirpercival/datatable.py
DataTable widget for kivy
View datatable.py
from kivy.lang import Builder
from kivy.uix.gridlayout import GridLayout
from kivy.properties import DictProperty, NumericProperty, StringProperty, \
BooleanProperty, ObjectProperty
from operator import itemgetter
from kivy.uix.button import Button
from kivy.uix.textinput import TextInput
from kivy.uix.label import Label
Builder.load_string("""
@mfkenson
mfkenson / 1_Install_Tidbit.sh
Created Apr 14, 2016 — forked from chicks/1_Install_Tidbit.sh
Load Testing Sugar Cheat Sheet
View 1_Install_Tidbit.sh
# Download from here: https://github.com/sugarcrm/Tidbit
# Copy Tidbit to your Sugar Root and unpack
cp Tidbit-master.zip /var/www/html
unzip Tidbit-master.zip
# Run Tidbit
cd Tidbit
php -f install_cli.php -- -c