Skip to content

Instantly share code, notes, and snippets.

View GarryLai's full-sized avatar
🌦️
Earth Science!!

Garry Lai GarryLai

🌦️
Earth Science!!
View GitHub Profile
@GarryLai
GarryLai / import_video.py
Last active March 24, 2025 14:28
Agisoft Metashape videos batch import
#
# Metashape videos batch import v1.0
# Author: Garry Lai
# Usage: "Tools" --> "Run script"
#
import Metashape
doc = Metashape.app.document
chunk = doc.chunk
@GarryLai
GarryLai / plot.sh
Last active September 14, 2024 09:41
NCU Rakit auto plot in background
#!/bin/bash
echo "#####################"
echo "# Rakit auto plot #"
echo "# by GarryLai #"
echo "#####################"
echo "Running in background..."
echo "Press Ctrl + C to exit."
echo ""
while true
do
@GarryLai
GarryLai / windows_iso_driver_patch.bat
Created July 5, 2024 06:38
Patch driver (storage, network etc.) into Windows setup ISO
@echo off
::::: C O N F I G :::::
set source_path=D:\zh-tw_windows_server_2025_preview_x64_dvd_9b147dcd\sources
set driver_path=D:\Software\MegaRAID_Driver
set mount_path=C:\Dism_Mount
:::::::::::::::::::::::
cd "%source_path%"
main classes:
10000000 - Cross Site Scripting
20000000 - Cross Site Scripting (Extended)
30000000 - SQL Injection
40000000 - SQL Injection (Extended)
50000000 - Generic Attacks
60000000 - Generic Attacks(Extended)
70000000 - Trojans
80000000 - Information Disclosure
90000000 - Known Exploits
@GarryLai
GarryLai / vhd_expand.bat
Last active March 13, 2024 09:33
Expand a EXT4 additional VHD in WSL2
@echo off
set VHD_PATH=D:\data.vhdx
set NEW_SIZE_GB=2048
set MOUNT_NAME=data
set WSL_DIST=Ubuntu
set /a NEW_SIZE_MB=%NEW_SIZE_GB%*1024
echo:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.jnlp]
@="jnlp_auto_file"
[HKEY_CLASSES_ROOT\jnlp_auto_file\shell\open\command]
@="\"C:\\Program Files\\ojdkbuild\\java-1.8.0-openjdk-1.8.0.332-1\\webstart\\javaws.exe\" \"%1\""
@GarryLai
GarryLai / Intel_BMC_Password.txt
Last active July 22, 2024 23:38
Intel BMC System Debug Log zip password
@GarryLai
GarryLai / ppi_example.py
Last active November 28, 2023 18:26
Plot RAAS PPI using python
import struct
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import cwbplot.cwb_colorbar as cwbcolor
##### C O N F I G #####
fname_x = 'PPI_20220629074850_b_x_01_00.5'
fname_y = 'PPI_20220629074850_b_y_01_00.5'
fname_feild = 'PPI_20220629074850_bDZ_01_00.5'
@GarryLai
GarryLai / syn_met_01.py
Last active December 23, 2023 22:36
NCUATM天氣學作業1:溫度平流、輻散、渦度、渦度平流
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import netCDF4 as nc
# Note: Using "bin_to_nc.py" convert to NETCDF format first!!
##### C O N F I G #####
ncfile = 'output.nc'
#######################
@GarryLai
GarryLai / cwb_colorbar.py
Created November 12, 2023 14:34
Use cwb_colorbar in Python 3.10
#Usage: https://cwbplot.readthedocs.io/en/dev/use_example.html#colorbar
#Put this file under same folder as your program
#and replace "import cwbplot.cwb_colorbar as cwbcolor"
#to "import cwb_colorbar as cwbcolor".
import matplotlib.colors as mcolors
def lightrain(tranp=0.5):
rain_light_temp = [[1. , 1. , 1. , 0.5 ],