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 / wissdom.py
Last active August 25, 2023 12:44
Python讀取WISSDOM三維風場反演系統輸出格式
def wissdom_getvar(filename, nx, ny, nz, feild_id):
#filename: wissdom_out bin檔位置
#nx, ny, nz: 反演範圍大小,可參考Grads ctl檔的XDEF、YDEF、ZDEF
#feild_id: 欲讀取的參數場類別,可參考Grads ctl檔的VARS下面那一段
# 照順序下來第一個參數場為0,第二個為1,以此類推
# 常用0=u1, 1=v1, 2=w1, 3=u2, 4=v2, 5=w2
#輸出為Numpy矩陣,維度是(nz, ny, nx)
data = []
with open(filename,"rb") as f:
f.seek(4*nz*ny*nx*feild_id) #將指標偏移到欲讀取的參數場
@GarryLai
GarryLai / wiss_to_nc.py
Last active October 4, 2023 05:27
將WISSDOM輸出檔(大多數的Fortran Binary也可以)轉為NETCDF格式
########## N O T I C E ##########
#此版本尚未實做時間維度(TDEF)的轉換
#因此只適用於轉換單一時間維度的檔案
#################################
import numpy as np
import struct
import netCDF4
import os, sys
import glob
@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 ],
@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 / 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 / Intel_BMC_Password.txt
Last active July 22, 2024 23:38
Intel BMC System Debug Log zip password
L3@p.Ah3@d
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 / 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:
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 / 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%"