Skip to content

Instantly share code, notes, and snippets.

View nanaHa1003's full-sized avatar

Pochuan Wang nanaHa1003

  • National Taiwan University
  • Taipei, Taiwan
View GitHub Profile
@nanaHa1003
nanaHa1003 / dicomSeries.py
Last active February 6, 2020 06:35
[Dicom series extractor] A sample code to extract series from a messy dicom directory. #DICOM #PyDICOM
import os
import dicom
import shutil
srcpath = 'DICOM-PATH'
outpath = 'DICOM-SERIES-PATH'
fileList = os.listdir(srcpath)
fileList = [f for f in fileList if not ".DS_Store" in f]
@nanaHa1003
nanaHa1003 / build-rathena.sh
Last active January 31, 2021 09:00
[rAthena build script] #rAthena #RO
#!/usr/bin/bash
# This Script is tested on CentOS 7
# Install dependencies
sudo yum install gcc gcc-c++ make mysql mysql-devel mysql-server pcre-devel zlib-devel git
# Clone Source
git clone https://github.com/rAthenaCN/rAthenaCN.git
@nanaHa1003
nanaHa1003 / RO_Cards.txt
Last active February 6, 2020 06:30
[rAthena card list] Boss cards list #rAthena #RO
setarray .@mvp_cards, 4662, 4143, 4146, 4135, 4128, 4123, 4144, 4236, 4121, 4134,
4142, 4132, 4131, 4376, 4147, 4148, 4137, 4318, 4276, 4534,
4168, 4372, 4324, 4419, 4399, 4457, 4263, 4342, 4527, 4330,
4305, 4302, 4425, 4636, 4456, 4525, 4403, 4374, 4386, 4441,
4408, 4509, 4352, 4407, 4578, 4574, 4580, 4652, 4430, 4576,
4145, 4529, 4528, 4361, 4367, 4365, 4565, 4563, 4561, 4562,
                    4564, 4560, 4566, 4625, 4602, 4604, 4674, 4357, 4359, 4363,
                    4556, 31026;
// 以上共 72 張
// 這兩張怪怪的XD
@nanaHa1003
nanaHa1003 / 20181221_Edmond_Chow_Short_Course_HW4.csv
Last active December 21, 2017 13:49
Test ichol and paric on Florida matrix collection SPD matrices.
Group Name ichol success? ichol pcg converged? paric success? paric pcg converged?
Oberwolfach t2dah_e.mat Yes Yes No No
Oberwolfach LF10.mat No No No No
Oberwolfach gyro_k.mat No No No No
Oberwolfach gyro.mat No No No No
Oberwolfach LF10000.mat No No No No
Oberwolfach LFAT5.mat No No No No
Oberwolfach bone010.mat No No No No
Oberwolfach boneS10.mat No No No No
Oberwolfach boneS01.mat No No No No
@nanaHa1003
nanaHa1003 / avx2_transpose_kernel.cpp
Last active February 3, 2025 17:59
[AVX2 matrix transpose] A double precision matrix transpose kernel implemented in avx2 intrinsics. You can compile this code with -mavx2 flag. #NLA
#include <iostream>
#include <immintrin.h>
inline void transpose_kernel(double *A, int lda, double *B, int ldb) {
__m256d row0, row1, row2, row3;
row0 = _mm256_load_pd(A + 0 * lda);
row1 = _mm256_load_pd(A + 1 * lda);
row2 = _mm256_load_pd(A + 2 * lda);
row3 = _mm256_load_pd(A + 3 * lda);
@nanaHa1003
nanaHa1003 / Automator.py
Last active February 6, 2020 06:32
[Python automation with OCR] This script will move you move to line #18 on the text "2018-10-02" then double click on it. #Automation #OCR #Windows
import pyautogui as gui
import pytesseract
from PIL import Image
TESSERACT_EXE = "C:/Program Files (x86)/Tesseract-OCR/tesseract.exe"
pytesseract.pytesseract.tesseract_cmd = TESSERACT_EXE
# Path to screenshot
TMP_PATH = "C:/Users/Yukie Nanahara/Desktop/tmp.png"

MARCH Course Computation Resources

Login

Command: ssh -J <username>@<login node> <username>@<GPU node>

Login nodes

  • 140.112.51.229 (z-gotham.math.ntu.edu.tw)
  • 140.112.51.228 (z-greenwich.math.ntu.edu.tw)
" Edited by Pochuan Wang at 2019/1/6
" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by
" the call to :runtime you can find below. If you wish to change any of those
" settings, you should do it in this file (/etc/vim/vimrc), since debian.vim
" will be overwritten everytime an upgrade of the vim packages is performed.
" It is recommended to make changes after sourcing debian.vim since it alters
" the value of the 'compatible' option.
" This line should not be removed as it ensures that various options are
@nanaHa1003
nanaHa1003 / calc_diameter.py
Last active March 27, 2020 08:10
[Calculate volume diameter]
import numpy as np
from scipy.ndimage import morphology
def calc_diameter(labels, target):
# Find slice with maximum area
i = np.argmax(np.where(labels == target, 1, 0).sum(axis=(0, 1)))
s = np.where(labels[:, :, i] == target, 1, 0)
# Extract contour points of target area
c = s - morphology.binary_erosion(s)
p = np.argwhere(c == 1)
@nanaHa1003
nanaHa1003 / ornt_transform.py
Last active March 3, 2022 09:58
How to convert a Nifti image affine.
import os
from argparse import ArgumentParser
import numpy as np
import nibabel as nib
import nibabel.orientations as ornts
def main(args):
image = nib.load(args.input)