Skip to content

Instantly share code, notes, and snippets.

@ringsaturn
ringsaturn / gist:4fbd116ad286fd043034782a06171e3f
Created November 9, 2020 12:24 — forked from singhabhinav/gist:132b8196abac026b43fa
Install SSL certificate in Nginx (Using .crt & .ca-bundle certificate files)
Step 1 - Create .crt file
cat domainname.crt domainname.ca-bundle > domainname-ssl-bundle.crt
Step 2-
Add lines for ssl_certificate in nginx configuration
server {
listen 80 default_server;
@ringsaturn
ringsaturn / gist:d617fb7d0c2a55d88c1301e980ecb8e7
Created November 9, 2020 12:24 — forked from singhabhinav/gist:132b8196abac026b43fa
Install SSL certificate in Nginx (Using .crt & .ca-bundle certificate files)
Step 1 - Create .crt file
cat domainname.crt domainname.ca-bundle > domainname-ssl-bundle.crt
Step 2-
Add lines for ssl_certificate in nginx configuration
server {
listen 80 default_server;

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

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

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

@ringsaturn
ringsaturn / add_utf8_BOM.md
Created May 29, 2019 06:33 — forked from windsting/add_utf8_BOM.md
为 UTF-8 编码的文本文件添加BOM

为 UTF-8 编码的文本文件添加 BOM

应用场景

  • 在 macOS 和 Windows 下同步 Cocos2D 项目

    Cocos2D 项目,在 macOS 下用 Xcode 编辑后,UTF-8 编码文件保存时不带 BOM,导致在 Windows 下用 Visual Studio 编译期报错,给这些文件添加 BOM 后,可以解决这些编译期错误,并且不会导致 Xcode 中编译有问题。

系统需求

@ringsaturn
ringsaturn / ubuntu16_tensorflow_cuda8.sh
Created May 6, 2019 11:19 — forked from ksopyla/ubuntu16_tensorflow_cuda8.sh
How to set up tensorflow with CUDA 8 cuDNN 5.1 in virtualenv with Python 3.5 on Ubuntu 16.04 http://ksopyla.com/2017/02/tensorflow-gpu-virtualenv-python3/
# This is shorthened version of blog post
# http://ksopyla.com/2017/02/tensorflow-gpu-virtualenv-python3/
# update packages
sudo apt-get update
sudo apt-get upgrade
#Add the ppa repo for NVIDIA graphics driver
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
@ringsaturn
ringsaturn / gist:51bd15bbc21ff6c86d6aed528f1d9f0c
Created January 29, 2018 14:58 — forked from bluefuton/gist:1468061
OS X: replace tabs with spaces in all files using expand
find . -name "*.md" | while read line; do expand -t 4 $line > $line.new; mv $line.new $line; done
@ringsaturn
ringsaturn / HuffmanCoding.py
Created May 14, 2017 02:41 — forked from nboubakr/HuffmanCoding.py
Huffman coding implementation in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Le codage de Huffman
# Théorie de l'information et du codage
# Etudiant: Boubakr NOUR <[email protected]>
# Universite Djilali Liabes (UDL) de Sidi Bel Abbes
import heapq
from collections import defaultdict