Skip to content

Instantly share code, notes, and snippets.

@sunapi386
sunapi386 / mysterious.json
Created July 1, 2019 06:33
What kind of JSON is this, webGL?
{
"mesh": {
"vertices": [53812],
"indices": [300426],
"components": {
"normals": false,
"texCoords": 2
},
"data": [
"t4E9w+P2S0JG1IDCLENcPtBEuL46IjzDOcVLQhbqn8KvA2c+9Uq5vskFPcOQMTZClVSawkHxYz5j7rq+y4E7wxjVZkJCAIPCrWlePv32tb5EyjvDnq9aQt6RlsKKjmQ+orS3vtD1PcNQfCpClqOIwlFJXT4+V7u+n5w+w9IAPUKIY23CYhBYPtk9ub5KSz7DTcRQQrCyW8Lh6VU+xku3vnOnO8Mn8TFCS+iuwp7Naj6jAby+dPQ8w+l3DkIm857C",
Entwine 9f6d9cc compiles with PDAL 58c77bc4
curl localhost:4000 \
-F operations='{ "query": "mutation ($file: Upload!) { singleUpload(file: $file) { id } }", "variables": { "file": null } }' \
-F map='{ "0": ["variables.file"] }' \
-F [email protected]
curl localhost:4000 \
-F operations='{ "query": "mutation ($files: [Upload!]!) { multipleUpload(files: $files) { id } }", "variables": { "files": [null, null] } }' \
-F map='{ "0": ["variables.files.0"], "1": ["variables.files.1"] }' \
-F [email protected] \
-F [email protected]
@sunapi386
sunapi386 / pipeline.hjson
Created April 24, 2019 01:52
Use PDAL to create a ground surface model from point cloud input
# This is a hjson file, https://hjson.org/
# Linux bash
#GET=https://github.com/hjson/hjson-go/releases/download/v3.0.0/linux_amd64.tar.gz
# macOS bash
#GET=https://github.com/hjson/hjson-go/releases/download/v3.0.0/darwin_amd64.tar.gz
# Install
#curl -sSL $GET | sudo tar -xz -C /usr/local/bin
# Translate to Json
#hjson -j pipeline.hjson > pipeline.json
#pdal pipeline pipeline.json --verbose 8
@sunapi386
sunapi386 / ender3.ini
Created April 21, 2019 22:20
profile for ender 3 3d printer
[profile]
layer_height = 0.1
wall_thickness = 0.8
retraction_enable = True
solid_layer_thickness = 1.2
fill_density = 30
print_speed = 50
print_temperature = 200
print_temperature2 = 0
print_temperature3 = 0
@sunapi386
sunapi386 / example-write-laz-point.cpp
Created April 2, 2019 05:49
C++ LAZ-PERF LAZPERF LAS tool example how to use
#include <laz-perf/io.hpp>
#include <laz-perf/las.hpp>
#include <filesystem>
void write_a_fake_laz(const std::string &path) {
const std::filesystem::path &outname (path);
using namespace laszip;
using namespace laszip::formats;
struct point {
las::point10 p;
@sunapi386
sunapi386 / gps2dec.py
Created March 29, 2019 00:33
Convert GPS seconds to decimal
# -*- coding: utf-8 -*-
import re
def dms2dd(degrees, minutes, seconds, direction):
dd = float(degrees) + float(minutes)/60 + float(seconds)/(60*60);
if direction == 'S' or direction == 'W':
dd *= -1
return dd;
def dd2dms(deg):
@sunapi386
sunapi386 / mount_encrypt_drive.md
Created March 23, 2019 00:51
How to mount encrypted drive with same volume group name

Background/Setup

  • I have two physical 1TB disks with identical setup.
  • Both are encrypted.
  • I unlocked and booted off one of them.
  • The other disk is still locked at this point.
  • I am using fish shell.

1. Identify which disk you want to unlock

#!/usr/bin/env python3
# Author: Jason Sun [email protected]
# Date: Mar. 21, 2019
# Print the merged bounds from ept.json files
# E.g.
# ~/wutm> merge_bounds.py
# ./frame1000.laz/ept.json [591595.0, 4137691.0, -27.0, 591677.0, 4137773.0, 55.0]
# ./frame0.laz/ept.json [591503.0, 4137321.0, -25.0, 591587.0, 4137405.0, 59.0]
# ./sample-utm.laz/ept.json [591470.0, 4137314.0, -114.0, 591724.0, 4137568.0, 140.0]
# ./frame2000.laz/ept.json [591657.0, 4137697.0, -28.0, 591739.0, 4137779.0, 54.0]
@sunapi386
sunapi386 / CMakeLists.txt
Created March 8, 2019 03:32
install g++-8 ubuntu 18.04 and configure cmake
cmake_minimum_required(VERSION 3.10)
project(project_name CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_REQUIRED_FLAGS -std=c++17)
include(CheckCXXSymbolExists)
add_executable(project_name project_name.cc)
set_property(TARGET project_name PROPERTY CXX_STANDARD 17)
## target_link_libraries(project_name) # link libraries here