Skip to content

Instantly share code, notes, and snippets.

@hit9
hit9 / gist:cde563db0a84d97a0a4d771c2a86b8da
Last active November 27, 2023 07:45
建议的接口形式

如果不要求轨迹回传,可以只新增一个接口。

配送状态节点(粗颗粒度):

PENDING = 1 // 等待取货
DELIVERING = 5 // 已取货、配送中
ARRIVED = 10 // 已送达
CANCELED = 99 // 已取消
@hit9
hit9 / ngx-lua.sh
Created March 9, 2015 10:57
Script to compile nginx on ubuntu with lua support.
#!/bin/sh
# Script to compile nginx on ubuntu with lua support.
NGX_VERSION='1.6.2'
LUAJIT_VERSION='2.0.3'
LUAJIT_MAJOR_VERSION='2.0'
NGX_DEVEL_KIT_VERSION='0.2.19'
LUA_NGINX_MODULE_VERSION='0.9.15'
@hit9
hit9 / colored_logging.py
Created May 23, 2013 11:44
colored python logging. And add a level 'success'
class Color(object):
"""
utility to return ansi colored text.
"""
colors = {
'black': 30,
'red': 31,
'green': 32,
'yellow': 33,
@hit9
hit9 / 00-index.txt
Created December 8, 2013 14:06 — forked from knzm/00-index.txt
- Install xhtml2pdf (former "pisa").
http://www.xhtml2pdf.com/
- Install Takao Font (TakaoPGothic.ttf).
https://launchpad.net/takao-fonts/
- Modify conf.py as below.
- Modify Makefile as below.
@hit9
hit9 / gist:7639670
Created November 25, 2013 10:58 — forked from kran/gist:6291095
xfconf-query -c xsettings -p /Gtk/KeyThemeName -s Emacs
@hit9
hit9 / foolib.c
Last active December 27, 2015 01:19
typedef struct post {
char *x;
char *y;
int x_z;
} post_t;
void
foo (post_t *o, char *src)
{
@hit9
hit9 / script.py
Last active December 26, 2015 10:39
糗百面试题目
# coding=utf8
"""
思路
~~~~
1. 按行读取文件, 三列入列表start_lst, end_lst, code_lst
2. 对start_lst进行二分法查找,直到找到离目标ip地址x最近的元素start和其
在start_lst中的索引i, 使得恰好有
start=start_lst[i]<=x
@hit9
hit9 / sources.list
Created July 3, 2013 12:59
ubuntu 11.04 源 update date: 2013-07-03
deb http://old-releases.ubuntu.com/ubuntu/ natty main universe restricted multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ natty main universe restricted multiverse
deb http://old-releases.ubuntu.com/ubuntu/ natty-security universe main multiverse restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ natty-security universe main multiverse restricted
deb http://old-releases.ubuntu.com/ubuntu/ natty-updates universe main multiverse restricted
deb http://old-releases.ubuntu.com/ubuntu/ natty-proposed universe main multiverse restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ natty-proposed universe main multiverse restricted
deb http://old-releases.ubuntu.com/ubuntu/ natty-backports universe main multiverse restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ natty-backports universe main multiverse restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ natty-updates universe main multiverse restricted
@hit9
hit9 / daemon.py
Created June 11, 2013 12:49 — forked from jamiesun/daemon.py
#! /usr/bin/env python2.7
#encoding:utf-8
#@description:一个python守护进程的例子
#@tags:python,daemon
import sys
import os
import time
import atexit
from signal import SIGTERM
@hit9
hit9 / color.py
Last active December 17, 2015 15:58
utility to return ansi colored text.
class Color(object):
"""
utility to return ansi colored text.
usage::
>>> from color import colored
>>> colored("text","red")
'\x1b[31mtext\x1b[0m'
"""