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 / PointCloudForAFSReconstruction.ply
Last active September 9, 2020 16:21
Files associated with cgal-discuss topic "Isotropic remeshing failed with is_valid_polygon_mesh()"
This file has been truncated, but you can view the full file.
@huyaoyu
huyaoyu / FrameExtraction.py
Last active October 21, 2020 02:46
Extract images for multiple topics from a ROS bagfile.
# Yaoyu Hu <yaoyuh@andrew.cmu.edu>
# Referred to https://gist.github.com/wngreene/835cda68ddd9c5416defce876a4d7dd9
# when I was writing this code.
import argparse
import cv2
import os
import sys
@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
@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 / 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 / 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 / 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 / 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 / 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 / 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>