Skip to content

Instantly share code, notes, and snippets.

View huyaoyu's full-sized avatar
🎯
Focusing

Yaoyu Hu huyaoyu

🎯
Focusing
  • Carnegie Mellon University
  • Pittsburgh, PA, USA
View GitHub Profile
@huyaoyu
huyaoyu / rename_iphone_images.py
Created November 4, 2023 03:58
Rename the media files copied from an iPhone on Windows. Use time string to compose a filename.
import argparse
import datetime
import glob
import os
import pathlib
import PIL.Image
import PIL.ExifTags
import pytz
import re
@huyaoyu
huyaoyu / wsl2-network.ps1
Last active October 29, 2022 20:02 — forked from daehahn/wsl2-network.ps1
WSL 2 TCP NETWORK FORWARDING
# WSL2 network port forwarding script v1
# for enable script, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser' in Powershell,
# for delete exist rules and ports use 'delete' as parameter, for show ports use 'list' as parameter.
# written by Daehyuk Ahn, Aug-1-2020
# Display all portproxy information
If ($Args[0] -eq "list") {
netsh interface portproxy show v4tov4;
exit;
}
@huyaoyu
huyaoyu / main.cpp
Last active March 3, 2022 03:04
CGAL nearest neighbor search from Point_set_3 with properties
#include <array>
#include <iostream>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Point_set_3.h>
#include <CGAL/Orthogonal_k_neighbor_search.h>
#include <CGAL/Search_traits_3.h>
#include <CGAL/Search_traits_adapter.h>
@huyaoyu
huyaoyu / install_rtc.sh
Created February 20, 2022 00:11
Raspberry Pi RTC
#!/bin/bash
# The content of this file is copied from
# https://raw.githubusercontent.com/km4ack/pi-scripts/master/rtc
# and
# https://learn.adafruit.com/adding-a-real-time-clock-to-raspberry-pi/set-rtc-time
#install/configure real time clock
#20190203 km4ack
#script based on directions from the following web site
@huyaoyu
huyaoyu / install_dependencies_cgal.sh
Last active February 9, 2022 16:36
Install dependencies for CGAL
#!/bin/bash
LIBRARIES_PATH=/home/$USER/Libraries/CGAL
sudo apt-get install -y
libgmp-dev libmpfr-dev \
libreadline-dev coinor-libipopt-dev \
libqt5svg5-dev libqt5script5 libqt5scripttools5 libqt5websockets5-dev qtscript5-dev \
glpk-utils libglpk-dev glpk-doc python-swiglpk
@huyaoyu
huyaoyu / start_docker.sh
Created January 25, 2022 06:20
Start a Docker container for TartanAir development.
#!/bin/bash
# This file is obtained from
# https://answers.ros.org/question/300113/docker-how-to-use-rviz-and-gazebo-from-a-container/
# and
# https://medium.com/intro-to-artificial-intelligence/rviz-on-docker-bdf4d0fca5b
# If not working, first do: sudo rm -rf /tmp/.docker.xauth
# It still not working, try running the script as root.
@huyaoyu
huyaoyu / add_user.dockerfile
Created January 25, 2022 06:08
Dockerfile for adding a new user.
# Author:
# Yaoyu Hu <yaoyuh@andrew.cmu.edu>
#
# Date:
# 2021-12-28
# Arguments.
ARG base_image
FROM ${base_image}
@huyaoyu
huyaoyu / test_remove.cpp
Last active December 2, 2021 05:05
Assertion failure doing collect_garbage() after removing isolated vertices from a surface mesh. CGAL.
#include <fstream>
#include <iostream>
#include <sstream>
#include <vector>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Surface_mesh/IO/PLY.h>
@huyaoyu
huyaoyu / small_cluster_removal.cpp
Created November 18, 2021 15:17
Remove small clusters from a CGAL::Point_set_3
template < typename Iterable_t >
static std::map<int, int>
compute_cluster_size(const Iterable_t& cluster_map) {
    std::map<int, int> cluster_size;
    for ( const auto& idx : cluster_map ) {
        if ( cluster_size.find(idx) == cluster_size.end() ) {
            // New idx.
            cluster_size[idx] = 1;
        } else {
@huyaoyu
huyaoyu / cuda10.1_vulkan1.1.121_ubuntu18.04.dockerfile
Created June 3, 2021 22:02
Dockerfile for running packaged Unreal Engine projects or binaries with UE 4.25 or 4.26 on a headless server in offscreen mode
FROM nvidia/vulkan:1.1.121-cuda-10.1--ubuntu18.04
# This is found at
# https://askubuntu.com/questions/909277/avoiding-user-interaction-with-tzdata-when-installing-certbot-in-a-docker-contai
# and
# http://p.cweiske.de/582
#
# Allow using GUI apps.
ENV TERM=xterm