Skip to content

Instantly share code, notes, and snippets.

@jinuljt
jinuljt / streaming_template.md
Last active August 22, 2017 04:11
flask 使用模板 stream 每次返回一块数据
@jinuljt
jinuljt / ksuid.py
Created August 14, 2017 02:57
python ksuid
import time
import uuid
def ksuid():
return hex(int(time.time()))[2:] + uuid.uuid4().hex
@jinuljt
jinuljt / snippet.py
Created August 10, 2017 07:46
python snippet
import socket
def get_local_ip():
'''
获得本机可联网的IP
'''
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.connect(("baidu.com", 80))
ip = sock.getsockname()[0]
sock.close()
@jinuljt
jinuljt / MacOS_Install_OpenCV.py
Created June 14, 2017 07:24 — forked from vishwanath79/MacOS_Install_OpenCV.py
Install OpenCV on Mac OS Sierra on Python 3.5
# 1. Download and install the latest Anaconda distribution from https://www.continuum.io/downloads#macos
# 2. Create a new Python environment. Make sure you choose python 3.5 as your python version for the virtual environment:
conda create -n myenv python=3.5
# 3. Activate the new environment using:
source activate myenv
@jinuljt
jinuljt / clear_wechat_website_data.md
Last active May 22, 2020 06:23
清除微信网页缓存(iOS)

清除safari缓存即可。  
原理是因为Apple限制,在iOS上微信只能使用webview。

1 image image image

@jinuljt
jinuljt / golang-tls.md
Created February 22, 2017 09:30 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
openssl ecparam -genkey -name secp384r1 -out server.key
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# created: Mon Sep 15 13:27:15 2014
# filename: mkpasswd.py
# author: juntao liu
# email: [email protected]
# descritpion:
import datetime
import random
@jinuljt
jinuljt / 各种坑.md
Last active February 5, 2018 11:41
各种坑

redis

redis 命令参数数量不能超过 1024*1024 个,包含命令哦。 比如:

SADD key 1 2 3 4...n (n <= 1024*1024 - 2)

source

emacs

@jinuljt
jinuljt / docker_service_discovery_architecture.md
Last active August 29, 2015 14:25
docker 服务自动发现 架构实现

架构图

底层使用 shipyard这类docker cluster。

Docker container 到etcd上注册自己的地址。

HAProxy 转发请求到Docker Container。

Confd 监控 etcd,动态更新HAProxy配置,并重启。