Skip to content

Instantly share code, notes, and snippets.

View hibetterheyj's full-sized avatar
🏎️
Racing never dies!

Yujie He hibetterheyj

🏎️
Racing never dies!
  • Lausanne
View GitHub Profile
@hibetterheyj
hibetterheyj / cuda_11.3_installation_on_Ubuntu_20.04
Last active July 2, 2024 19:18 — forked from Mahedi-61/cuda_11.8_installation_on_Ubuntu_22.04
Instructions for CUDA v11.3 and cuDNN 8.1 installation on Ubuntu 20.04 for Pytorch 1.10
#!/bin/bash
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
### to verify your gpu is cuda enable check
@hibetterheyj
hibetterheyj / repeat_structure2for_dict.py
Created November 6, 2021 00:42
Template for converting repetitive scripts to for-loop and dict structure
# ref: https://stackoverflow.com/a/14241195/7961693
"""
# timestamp can be read from lidars/ folder
stamp_file_path = os.path.join(allf.lidar_dir, seq+'_stamped.npy')
lidar_stamped_dict = np.load(stamp_file_path, allow_pickle=True)
ts_np = lidar_stamped_dict.item().get('timestamp')
all_det_list = []
within_det5_list = []
within_det10_list = []
@hibetterheyj
hibetterheyj / python.json
Last active January 7, 2022 16:26
[VS Code snippet] Create default python header (V2022)
{
// Place your snippets for python here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
@hibetterheyj
hibetterheyj / all_pdf_dl.py
Last active April 11, 2024 12:54
Download all pdf files from a website
import os
import requests
from urllib.parse import urljoin
from bs4 import BeautifulSoup
import argparse
#%% Example
# one pdf
# python all_pdf_dl.py -l https://memento.epfl.ch/academic-calendar/ --save-here
# many pdfs
@hibetterheyj
hibetterheyj / Coursera_Stanford_Algorithm_PA4.py
Last active April 22, 2021 15:12
Implementation of Karger's algorithm in Python3. Randomized algorithm for computing minimum cuts in a connected graph. Originated from Python2: https://gist.github.com/aymanfarhat/6098683
# -*- coding: utf-8 -*-
"""
(original code running in Python2)
https://gist.github.com/aymanfarhat/6098683
@author: HYJ
"""
import random
# generate dict-based graph from txt
def load_graph():
@hibetterheyj
hibetterheyj / uniformPath.m
Last active January 24, 2019 13:59
replace dir path with uniform style (matlab)
% process path to make sure it's uniform
% ispc() 用于判定在win系统下运行,把他改成标准化的'/'
% streep()可以用于替换单个str元素或者cell array中的str
if ispc(), base_path = strrep(base_path, '\', '/'); end
% 在行末补上一个/
if base_path(end) ~= '/', base_path(end+1) = '/'; end