Skip to content

Instantly share code, notes, and snippets.

View nevikw39's full-sized avatar
🉑
🉑抹茶拿鐵 o'_'o

牜攵 nevikw39

🉑
🉑抹茶拿鐵 o'_'o
View GitHub Profile
@nevikw39
nevikw39 / interval.py
Created August 18, 2024 12:32
Python function decorator to execute a function in another thread at every given interval
from collections.abc import Callable
from threading import Timer, Event
def interval(sec: int, event: Event = None):
def decorator(func: Callable):
timer: Timer
def wrapper(*args, **kwargs):
@nevikw39
nevikw39 / openmpi_4.0.2-intel20.4.txt
Created April 21, 2024 11:29
PSC Bridges 2 OpenMPI Info
Package: Open MPI [email protected]
Distribution
Open MPI: 4.0.2
Open MPI repo revision: v4.0.2
Open MPI release date: Oct 07, 2019
Open RTE: 4.0.2
Open RTE repo revision: v4.0.2
Open RTE release date: Oct 07, 2019
OPAL: 4.0.2
OPAL repo revision: v4.0.2
@nevikw39
nevikw39 / Makefile
Last active November 27, 2023 14:27
Advanced High Performance Computing Cluster Practice HW2
CC = icc
CFLAGS = -O0 -g -fp-model strict -fsanitize=address -xCORE-AVX512
CXX = icpc
BINS = mat_mul_a_naive mat_mul_b_transpose mat_mul_c_block mat_mul_d_avx
SRCS = $(addsuffix .c,$(BINS))
DATS = a.dat b.dat
.PHONY: all clean distclean
@nevikw39
nevikw39 / Dockerfile
Created April 7, 2023 14:11
vivado-docker
FROM nevikw39/vivado-base
ENV DISPLAY=host.docker.internal:0
# SHELL ["/bin/bash", "-c"]
RUN \
apt update && \
apt install -y libtinfo5 xorg && \
apt clean && \
@nevikw39
nevikw39 / README.md
Last active October 20, 2022 16:11
CSST Linux Terminal Demo

CSST Linux Terminal Demo

這個 gist 主要是用以補充課堂上的 Demo 過於臨時倉促而可能沒有讓大家仔細觀察體驗,而這可能才是這堂課最重要的東西我竟然在有人發問之後才想到臨場發揮。

我個人覺得學習 Linux 不必想著一開始就記得所有指令,有什麼需求能夠在網路上搜尋到解決方案就可以了,常用的自然而然就會記起來。因此,以下的 demo 即使不一定能完全看懂,嘗試去猜或者理解,感受一下就行!!

看不太懂很正常也沒關係,可以照著步驟執行看看,體會操作 terminal 的感覺,這些指令都很安全沒有惡意也不會炸掉你的電腦,也可以動手改點參數、數字觀察會發生什麼事!!

Demo

@nevikw39
nevikw39 / match.py
Created July 3, 2022 16:14
Perform a `match` based on the measure adopted by the Div. of Curriculum, NTHU to assign the students to GE & PE courses.
import random
from typing import List
class Member:
def __init__(self, s: str, lst: List[int]) -> None:
self.s = s
self.lst = lst
self.n = 0
@nevikw39
nevikw39 / mathjax.txt
Last active July 3, 2022 16:22
Polyfill to support LaTeX on NTHU OJ. Insert this to the source.
<style>
@font-face {
font-family: "MJXTEX";
src: url(data:application/octet-stream;base64,d09GRk9UVE8AAIVwAAsAAAAAuhgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABDRkYgAAABCAAAe4MAAKkD+UhnsEZGVE0AAHyMAAAAHAAAABxdKvr2R0RFRgAAfKgAAAAfAAAAIAFQAARPUy8yAAB8yAAAAFIAAABgQXBY2GNtYXAAAH0cAAAC0AAABEpuir4+aGVhZAAAf+wAAAAzAAAANg5mmLloaGVhAACAIAAAACEAAAAkBK0IB2htdHgAAIBEAAACUwAABIzBgCUabWF4cAAAgpgAAAAGAAAABgEjUABuYW1lAACCoAAAAroAAAZdqQQjYHBvc3QAAIVcAAAAEwAAACD/hgAyeJy8vAd8W0X2L65rW9KQgIEIhW4DAQKhpVMCpAcCpJKeOIl770Vusnq599x71WW5996tNKdCCqGTLBBa2IRddmGBQCCBkblmf2+ulEB22d237/3f52/ZHumWmTNnzjnf75mZK0oSESGhKEq5LLYg5bnY4m3LYlOzHlqdmFyYEZsnocIklOTRwHWSwDEq8EpY4Hh44NWIXxRC623y8T/fJL1dIpHffi35L5FcR/5fFXe9+P4h8q/hxgmSfvFmJLlWMlFyu+RuyUOS2ZKnJEskyyRrJJslcZJUSY5EJamQGCRWCSdxSTySSkmtpEXSLumS9Et2SvZLjkhel5yUfCg5I/mL5BvJBYlARVDXUjdSt1H3UA9Ss6m51LPUKmoDtY1KojKpAqqM0lM0ZacqqXqqjRqi9lGvUu9RZ6kvqPOUECYLiwybGHZ72OSwR8Jmhz0VtihsZdj6sK1hiWG5YSVhFWGmMDbMG9YQ1hM2GLYn7FDYK2FvhZ0K+yzsy7DvwnB4WPj48BvDo8LvCX8wfEb43PBl4RvDk8OzwgvDy8MN4Uy4O7wmvCt8MHx3+MHwY+Fvh
@nevikw39
nevikw39 / ptt_ip.md
Last active October 21, 2022 08:34
ptt IP

ptt IP

Detect whether an IP address on ptt belong to VPN or proxy networks

一款 userscript, 令您只要雙擊選取 pttIP 便可即時取得相關資訊.

適用於 www.ptt.cc, term.ptt.cc.

安裝步驟

@nevikw39
nevikw39 / seg_tree_node.cpp
Last active June 9, 2021 11:24
Segment Tree Node w/o build function
struct node
{
T val, tag_update, tag_modify;
bool modified;
node *nl, *nr;
node()
{
val = tag_update = modified = 0;
nl = nr = nullptr;
}
@nevikw39
nevikw39 / 1253.cpp
Created January 28, 2021 02:57
TIOJ 1253
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
vector<int> g[1001];
bool v[1001];
int m[1001];
bool dfs(int x)
{
for (const int &i : g[x])