Skip to content

Instantly share code, notes, and snippets.

@ald2004
ald2004 / logger.py
Last active April 26, 2023 08:29
python logger.
import logging
import os
import sys
import time
import atexit
from termcolor import colored
import functools
from fvcore.common.file_io import PathManagerBase
from fvcore.common.config import CfgNode as _CfgNode
import functools
@ald2004
ald2004 / docker_start.sh
Last active February 22, 2023 08:02
docker starter
server.sh
#!/bin/sh
cd /opt/yuanpu/aiplatform
uvicorn model_package:app --reload --port 43034 --host 0.0.0.0 2>&1 >> nohup.log
docker_start.sh
#! /bin/bash
rm ./nohup.out
docker rm -f $(docker ps -a -q --filter "name=aipackage")
@ald2004
ald2004 / python_process_pool.py
Created October 13, 2022 03:27
python process pool executor
from asyncio import as_completed
from multiprocessing import Pool
import multiprocessing as mp
from re import X
import re
import time
import concurrent.futures
def xx(a):
for _ in range(2):
@ald2004
ald2004 / static_inline_example.md
Created July 18, 2022 08:13 — forked from htfy96/static_inline_example.md
static inline vs inline vs static in C++

In this article we compared different behavior of static, inline and static inline free functions in compiled binary. All the following test was done under g++ 7.1.1 on Linux amd64, ELF64.

Test sources

header.hpp

#pragma once

inline int only_inline() { return 42; }
static int only_static() { return 42; }
@ald2004
ald2004 / cool_gpu2.sh
Created July 5, 2022 08:12 — forked from squadbox/cool_gpu2.sh
A script to control Nvidia GPU fan speed on headless (non-X) linux nodes
#!/bin/bash
# cool_gpu2.sh This script will enable or disable fixed gpu fan speed
#
# Description: A script to control GPU fan speed on headless (non-X) linux nodes
# Original Script by Axel Kohlmeyer <[email protected]>
# https://sites.google.com/site/akohlmey/random-hacks/nvidia-gpu-coolness
#
# Modified for newer drivers and removed old work-arounds
@ald2004
ald2004 / instructions.txt
Created July 1, 2022 05:42 — forked from m-ou-se/instructions.txt
Compiling a cross compiler for armv7l-unknown-linux-gnueabihf (RPi3)
wget http://ftp.snt.utwente.nl/pub/software/gnu/binutils/binutils-2.29.tar.xz
wget ftp://ftp.nluug.nl/mirror/languages/gcc/releases/gcc-7.2.0/gcc-7.2.0.tar.xz
wget http://ftp.gnu.org/gnu/glibc/glibc-2.26.tar.xz
tar xvf binutils-2.29.tar.xz
tar xvf gcc-7.2.0.tar.xz
cd binutils-2.29
./configure --target=armv7l-unknown-linux-gnueabihf --disable-multilib
make -j9
sudo make install
cd ..
@ald2004
ald2004 / buildcrossgcc.sh
Created July 1, 2022 05:42 — forked from rikka0w0/buildcrossgcc.sh
Build gcc cross-compiler for armv7l (arm-linux-gnueabi)
#!/bin/sh
mkdir ~/tmp
cd ~/tmp
# See
# Typical ARM triples (see "armv7l-linux-gnueabi")
# https://bgamari.github.io/posts/2019-06-12-arm-terminology.html
# GCC -march options
# https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html