Skip to content

Instantly share code, notes, and snippets.

@Anebrithien
Anebrithien / ReadMe.md
Created March 6, 2024 08:48
Generate openmeteo api client jar from OpenAPI spec yaml files.

How to generate client Jar from OpenAPI spec file

Use openapi-generator-maven-plugin, steps:

  1. Create folder open-meteo-client
    mkdir open-meteo-client
    cd open-meteo-client
  2. Create pom.xml in folder, structure should be like

WGS-84 坐标系,是 GPS 系统所采用的坐标系。一切正常工作的 GPS 或 GPS 芯片所返回的坐标值都是这个坐标系下的数值。Google 地图采用的卫星图也是按照这个坐标系摆放的。

GCJ-02 坐标系,是我天朝政府搞出来的加密坐标系,也常常被称为“火星坐标系”。包括(但可能不限于)高德地图在内的国内地图服务商采用它来绘制地图。Apple、Google等国外公司在其道路地图中使用的也是高德的数据。BD-09 坐标系则是百度地图专用的坐标系。

在开发一些 LBS 应用时,如果不加处理,很容易出现几种形式的地图之间出现偏移的情况。因此在这几个坐标系之间进行转换非常重要。以下代码就是网络上泄露出的从 WGS-84 转 GCJ-02 的算法,以及 GCJ-02 与 BD-09 的互相转换算法。

@Anebrithien
Anebrithien / ReadFile.java
Created August 15, 2020 17:41
Just a simple autoClose test
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Optional;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Anebrithien
Anebrithien / PatternBenchmarkTest.java
Created November 14, 2019 02:27
Benchmark between java.util.regex and org.springframework.web.util.pattern.PathPattern
import java.util.ArrayList;
import java.util.List;
import java.util.LongSummaryStatistics;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.junit.Test;
2017-09-02 02:25:01.328 [entLoopGroup-3-2] INFO TcpServerTest - Try to decode 72fe1d130000000000000002000186a00001977c0000000000000000000000000000000000000000
2017-09-02 02:25:01.328 [entLoopGroup-3-2] INFO TcpServerTest - Server received r�\00\00\00\00\00\00\00\00��\00�|\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00
2017-09-02 09:18:17.622 [entLoopGroup-3-3] INFO TcpServerTest - Try to decode 474554202f20485454502f312e300d0a0d0a
2017-09-02 09:18:17.622 [entLoopGroup-3-3] INFO TcpServerTest - Server received GET / HTTP/1.0
2017-09-03 02:05:11.225 [entLoopGroup-3-4] INFO TcpServerTest - Try to decode 72fe1d130000000000000002000186a00001977c0000000000000000000000000000000000000000
2017-09-03 02:05:11.225 [entLoopGroup-3-4] INFO TcpServerTest - Server received r�\00\00\00\00\00\00\00\00��\00�|\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00
2017-09-03 03:04:02.840 [entLoopGroup-3-5] INFO TcpServerTest - Try to decode 0300002b26e000000000004
@Anebrithien
Anebrithien / sys.log
Created October 2, 2015 17:50
自从apt-get upgrade了BCM43228驱动,我的无线就废了
Oct 3 01:09:40 Alice wpa_supplicant[1452]: CTRL-EVENT-DISCONNECTED bssid=54:e6:fc:xx:xx:xx reason=0
Oct 3 01:09:40 Alice kernel: [ 2142.076577] cfg80211: All devices are disconnected, going to restore regulatory settings
Oct 3 01:09:40 Alice kernel: [ 2142.076589] cfg80211: Restoring regulatory settings
Oct 3 01:09:40 Alice kernel: [ 2142.076597] cfg80211: Calling CRDA to update world regulatory domain
Oct 3 01:09:40 Alice NetworkManager[1318]: <info> (wlan0): supplicant interface state: completed -> disconnected
Oct 3 01:09:40 Alice kernel: [ 2142.083762] cfg80211: Updating information on frequency 2412 MHz for a 20 MHz width channel with regulatory rule:
Oct 3 01:09:40 Alice kernel: [ 2142.083766] cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
Oct 3 01:09:40 Alice kernel: [ 2142.083767] cfg80211: Updating information on frequency 2417 MHz for a 20 MHz width channel with regulatory rule:
Oct 3 01:09:40 Alice kernel: [ 2142.083768] cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KH

LiteFileServer

使用Google Dart构建的轻量级、简单的文件下载服务器。 不需要安装nginx/apache,占用更少的资源。

1.安装dart sdk

请参考:这里

2.添加pub到环境变量

@Anebrithien
Anebrithien / gist:3b5dcf19575849ed3eab
Last active August 29, 2015 14:11
某日从聊天记录里翻出来的C++代码
/*没记错的话,应该是从n个元素中选出m个。当时以英文字母a~z加上数字0~9为元素范围,那么n最大是36了。
印象里1对应该元素被输出,0则不输出,然后……然后???
不过,三年过去了,完全看不懂了怎么办?!
似乎去掉system("pause")就能在Linux上编译通过了
*/
#include <fstream>
#include <iostream>
using namespace std;
#define getbit(bits, bit_index) ( bits[bit_index / sizeof(char)] & (1<< (bit_index % sizeof(char))) )
#define setzero(bits, bit_index) ( bits[bit_index / sizeof(char)] &= ~(1<< (bit_index % sizeof(char))) )
//作业1:摄氏度转换为华氏度
var c = 39;
var f = 9/5 * c + 32;
console.log(c + "摄氏度等于" + f +"华氏度");
//作业2:交换两个变量的值
var alice = 8;
var bob = 5;
//如果我取巧直接console.log("交换后: " + bob + " , " + alice),静琴会拍死我吧
//除了直观的使用中间变量temp以外,XOR最有趣了,就用这个了。JS也是用^来算的啊