Skip to content

Instantly share code, notes, and snippets.

View maidamai0's full-sized avatar
🎯
Focusing

tonghao.yuan maidamai0

🎯
Focusing
  • United Imaging Intelligence
  • shanghai
  • X @maidamai0
View GitHub Profile
@maidamai0
maidamai0 / pipeline.py
Last active May 31, 2023 15:13
a simple pipeline writen in python suport both map and filter
from typing import Any, Callable, List, Iterable
class Pipeline:
class __processor:
def __init__(self, func, is_filter:bool) -> None:
self.func = func
self.is_filter = is_filter
def __call__(self, *args: Any) -> Any:
return self.func(*args)
@maidamai0
maidamai0 / oh_my_posh.omp.json
Last active April 16, 2021 07:25
my Oh-My_Posh3 theme
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"console_title":true,
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "path",
@maidamai0
maidamai0 / commit.py
Last active April 7, 2021 08:38
create some git commit to do some experiments such as merge and rebase
import subprocess
import time
import os
import argparse
class Commit:
def __init__(self, new: bool) -> None:
self.commit_num = 0
if new:
@maidamai0
maidamai0 / clang_format_all.py
Created April 7, 2021 07:29
format all cpp source files with clang-format
import argparse
import os
import subprocess
def should_foramt(file: str):
if file.endswith(".cpp"):
return True
if file.endswith(".h"):
return True
@maidamai0
maidamai0 / concurrent_queue.c
Last active December 5, 2023 15:26
concurrent queue in c
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
// queue implementation start
const int g_invalid_value = -1000000;
@maidamai0
maidamai0 / swap.cpp
Last active June 27, 2019 01:18
get started test
template<typename T>
void swap(T lhs, T rhs){
T tmp = lhs;
lhs = rhs;
rhs = tmp;
}