Skip to content

Instantly share code, notes, and snippets.

@think8848
think8848 / write_png_to_memory_with_libpng.cpp
Created February 26, 2025 13:05 — forked from dobrokot/write_png_to_memory_with_libpng.cpp
encode and write PNG to memory (std::vector) with libpng on C++
#include <png.h>
#include <vector>
#include <iostream>
#include <stdlib.h>
//encode and write PNG to memory (std::vector) with libpng on C++
typedef unsigned char ui8;
#define ASSERT_EX(cond, error_message) do { if (!(cond)) { std::cerr << error_message; exit(1);} } while(0)
@think8848
think8848 / Demo.cs
Created April 16, 2022 16:52 — forked from OlegKarasik/Demo.cs
Code Tip: How to work with asynchronous event handlers in C#?
public class Demo
{
public event EventHandler DemoEvent;
public void Raise()
{
this.DemoEvent?.NaiveRaiseAsync(this, EventArgs.Empty).GetAwaiter().GetResult();
Console.WriteLine("All handlers have been executed!");
}
}

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@think8848
think8848 / hillshade.py
Created October 12, 2017 13:15 — forked from dbuscombe-usgs/hillshade.py
shaded relief algorithm in python
import numpy as np
def cart2pol(x, y):
'''
cartesian to polar coordinates
'''
theta = np.arctan2(y, x)
rho = np.sqrt(x**2 + y**2)
return (theta, rho)
/**
* 百度坐标(BD09)、国测局坐标(火星坐标,GCJ02)、和WGS84坐标系之间的转换的工具
*
* 参考 https://github.com/wandergis/coordtransform 实现的Java版本
* @author geosmart
*/
public class CoordinateTransformUtil {
static double x_pi = 3.14159265358979324 * 3000.0 / 180.0;
// π
static double pi = 3.1415926535897932384626;