Skip to content

Instantly share code, notes, and snippets.

View hungnphan's full-sized avatar

Hung Phan hungnphan

  • Earth, Milky Way galaxy
View GitHub Profile
@hungnphan
hungnphan / app.py
Created May 7, 2024 13:35 — forked from vovavili/app.py
Streamlit + Firebase authorization example
"""Module for handling authentication, interactions with Firebase and JWT cookies.
This solution is refactored from the ‘streamlit_authenticator’ package . It leverages JSON
Web Token (JWT) cookies to maintain the user’s login state across browser sessions. For the
backend, It uses Google’s Firebase Admin Python SDK. This solution ensures that the content
of the page and user settings panel are only displayed if the user is authenticated. Similarly,
the login page can only be accessed if the user is not authenticated. Upon registration, the
user is sent a verification link to their e-mail address.
Important - to make this app run, put the following variables in your secrets.toml file:
COOKIE_KEY - a random string key for your passwordless reauthentication
@hungnphan
hungnphan / git_submodules.md
Created December 30, 2023 15:24 — forked from gitaarik/git_submodules.md
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
@hungnphan
hungnphan / pdfmod.py
Created September 11, 2023 01:36 — forked from jrsmith3/pdfmod.py
Convert specified pages from a PDF to png
"""
This script was used to create the figures for http://jrsmith3.github.io/sample-logs-the-secret-to-managing-multi-person-projects.html from a PDF file containing some old CMU sample logs.
"""
import PyPDF2
from wand.image import Image
import io
import os
@hungnphan
hungnphan / comprehensive_header.py
Created February 2, 2023 07:11 — forked from NicolasBizzozzero/comprehensive_header.py
Python template of a comprehensive header, with shebang, docstring, GPLv3 license and all metadata.
#!/usr/bin/env python
""" Short description of this Python module.
Longer description of this module.
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
@hungnphan
hungnphan / Kubeflow.md
Created June 6, 2022 05:14 — forked from John-Lin/Kubeflow.md
Kubeflow on Minikube

Deploy Kubeflow on Minikube

Install minikube

Please see How to Minikube

Running a minikube with 4CPUs and 8GB memory

$ minikube start --cpus 4 --memory 8192

Conventinal Commit Messages

See how a minor change to your commit message style can make a difference. Examples

Have a look at CLI util git-conventional-commits to ensure this conventions and generate changelogs

Commit Formats

Default

@hungnphan
hungnphan / automated_opencv_compilation_in_docker.sh
Last active July 19, 2021 03:15 — forked from ntcuong777/automated_opencv_compilation_in_docker.sh
Install OpenCV 4.5.1 as root user inside Docker - not tested on parent OS
#!/bin/bash
# THIS FILE WILL REQUIRES SUDO
# NOTE: Use <full path>, dont use ~/ to point to home, since it will point to /root/ if you use `sudo`
# or if you are currently the `root` user, IDK.
# Set your OpenCV install prefix path for CMake here
OPENCV_PREFIX_PATH=/home/cuong/compiled_libraries
OPENCV_DOWNLOAD_LINK=https://github.com/opencv/opencv/archive/4.5.1.zip
OPENCV_CONTRIB_DOWNLOAD_LINK=https://github.com/opencv/opencv_contrib/archive/4.5.1.zip
@hungnphan
hungnphan / xsukax-ffmpeg-installer.sh
Created June 8, 2021 06:42
Installing ffmpeg on Kali Linux 2.0
#!/bin/bash
echo "---------------------"
echo "Installing ffmpeg ..."
echo "---------------------"
cd /root/Desktop/
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
./configure
make
make install
@hungnphan
hungnphan / submit.md
Created March 9, 2021 06:46 — forked from tanaikech/submit.md
Downloading Shared Files on Google Drive Using Curl

Downloading Shared Files on Google Drive Using Curl

When the shared files on Google Drive is downloaded, it is necessary to change the download method by the file size. The boundary of file size when the method is changed is about 40MB.

File size < 40MB

CURL

filename="### filename ###"
fileid="### file ID ###"
curl -L -o ${filename} "https://drive.google.com/uc?export=download&amp;id=${fileid}"
@hungnphan
hungnphan / compile_opencv_w_cuda.sh
Created January 30, 2021 07:20 — forked from ntcuong777/compile_opencv_w_cuda.sh
CVIP Compile OpenCV from source
#!/bin/bash
# Note that this is intended to be used inside docker container by CVIP lab docker settings
# However, if you compile on your machine, IDK, it might work. It should be
# intuitively easy to modify
# Also, CUDA & CUDNN is required to be already installed.
######### IMPORTANT ##############
This is just a script with minor details
For more details guide, go here: