Skip to content

Instantly share code, notes, and snippets.

@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
@sunapi386
sunapi386 / slack-export.md
Created January 8, 2019 03:23
Guide to getting your own slack export
@sunapi386
sunapi386 / gist:c6d489c43592552d1f7c2732ac703aae
Created November 15, 2018 22:59
Clean up /boot partition

First check your kernel version, so you won't delete the in-use kernel image, running:

uname -r

Now run this command for a list of installed kernels:

dpkg --list 'linux-image*' | grep ii

and delete the kernels you don't want/need anymore by running this:

@sunapi386
sunapi386 / defaults.new
Last active September 7, 2019 21:57
Remove the WeKnow.ac Chrome newtab hijack key in defaults
{
DefaultSearchProviderEnabled = 1;
HomepageIsNewTabPage = 0;
HomepageLocation = "https://www.google.com/";
ILMediaBrowserAudioSplitViewPosition = 140;
ILMediaBrowserExpandedGroups1 = (
"com.apple.Photos.Photos",
"com.apple.Photos.TopLevelAlbums"
);
ILMediaBrowserImageSplitViewPosition = 106;
@sunapi386
sunapi386 / flush.md
Created September 6, 2018 22:56
ddclient not updating?

Flush cache and restart


sudo service ddclient stop
sudo rm /var/cache/ddclient/ddclient.cache
sudo service ddclient startsudo service ddclient stop sudo rm