Skip to content

Instantly share code, notes, and snippets.

View HuakunShen's full-sized avatar

Huakun Shen HuakunShen

View GitHub Profile
@HuakunShen
HuakunShen / README.md
Created April 20, 2022 20:38
Remove Duplicate Image from Dataset

Remove Duplicate Images from a Dataset

We will be using Python package imagededup to detect duplicate images.

There are multiple options (algorithms) for detecting duplicates.

  • Convolutional Neural Network (CNN)
  • Perceptual hashing (PHash)
  • Difference hashing (DHash)
  • Wavelet hashing (WHash)
@HuakunShen
HuakunShen / Browser-Bookmark-Shortcut.md
Created April 12, 2022 20:16
Browser Bookmark Shortcuts

Browser Bookmark Shortcut

Browser allows you to run JavaScript by clicking on a bookmark prefilled with JS code.

Simply Create a new bookmark, give it any name, and input the js code in a special format in the URL input box.

Video Playback Rate

javascript: var v = v = document.querySelector("video"); var t = prompt('Set the playback rate'); v.playbackRate = parseFloat(t);;
@HuakunShen
HuakunShen / Nginx-Load-Balancer.md
Last active July 18, 2021 01:06
Nginx Load Balancer

A simple Nginx Load Balancer implemented with 3 Nginx docker containers.

@HuakunShen
HuakunShen / README.md
Last active June 19, 2021 21:27
GitHub OAuth 2.0 Web Flow
@HuakunShen
HuakunShen / README.md
Last active June 19, 2021 21:28
GitHub OAuth 2.0 Device Flow
@HuakunShen
HuakunShen / openvpn3-usage.md
Last active December 28, 2023 14:49
openvpn3 Usage

openvpn3 Usage

Install openvpn3 from this website.

If you look at the man page of openvpn3, there are 2 main concepts:

  1. config: a configuration of vpn where you connects to
  2. session: a vpn session

Config

Suppose you have a configuration file called vpn.ovpn that’s connecting to a server in New York.

@HuakunShen
HuakunShen / remote-jupyter-notebook.md
Last active July 2, 2021 05:54
Remote Jupyter notebook

Option 1

Run this command on server

jupyter notebook --no-browser --ip <private ip> --port 8888

Access with http://<private ip>:8888

package main
import (
"encoding/hex"
"fmt"
"net"
"strings"
)
func main() {
@HuakunShen
HuakunShen / nginx-static-hosting.md
Last active September 29, 2021 23:23
Nginx host static files

Nginx host static files

server {
    listen 8080 default_server;
    listen [::]:8080 default_server;

    root /var/www/html;

 index index.html index.htm index.nginx-debian.html;
@HuakunShen
HuakunShen / nginx-non-443-https.md
Last active March 13, 2021 07:39
HTTPS on Non-Default Port (Nginx)

HTTPS on Non-Default Port

Obtain an SSL certificate, https://zerossl.com/ is an option.

Get the following 3 files

  • ca_bundle.crt
  • certificate.crt
  • private.key

Combine the certificates