openssl pkcs12 -in path.p12 -out newfile.crt.pem -clcerts -nokeys
openssl pkcs12 -in path.p12 -out newfile.key.pem -nocerts -nodes
After that you have:
certificate in newfile.crt.pem
private key in newfile.key.pem
#天数 | |
TO_DAYS(NOW())-TO_DAYS(t.end_time) = 1 | |
#分钟 | |
TIMESTAMPDIFF(MINUTE,ms.add_date,NOW()) =3600 | |
#几天前 | |
DATE_SUB(NOW(),INTERVAL 7 DAY) | |
# 分组排名 |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
def memoize(f): | |
cache = {} | |
def helper(x): | |
if x not in cache: | |
cache[x] = f(x) | |
return cache[x] | |
return helper |
-- update table with select and group by statement | |
-- Ohs my poor SQL. | |
-- contacts:beginman.cn | |
update group_info as g | |
left join ( | |
select gi.group_id, count(gm.id) as nums from group_info gi | |
inner join group_members gm on gm.group_id = gi.group_id | |
group by gm.group_id | |
) |
#coding=utf-8 | |
__author__ = 'beginman' | |
__describe__ = '图片>>base64>>二进制文本 转换' | |
import binascii | |
import re | |
def pic2bin(data): | |
b64 = binascii.b2a_base64(data) | |
j = 0 |
openssl pkcs12 -in path.p12 -out newfile.crt.pem -clcerts -nokeys
openssl pkcs12 -in path.p12 -out newfile.key.pem -nocerts -nodes
After that you have:
certificate in newfile.crt.pem
private key in newfile.key.pem
import torndb | |
mysql_settings = { | |
'host': 'localhost:3306', | |
'user': 'user', | |
'password': 'password', | |
'database': 'database', | |
'time_zone': '-8:00', | |
'charset': 'utf8' |
# coding=utf-8 | |
# Make sure your gevent version is >= 1.0 | |
import gevent | |
from gevent.wsgi import WSGIServer | |
from gevent.queue import Queue | |
from flask import Flask, Response | |
import time |
/* | |
** 右移计算值为1的位的个数 | |
** 接收一个无符号参数,避免右移歧义 | |
*/ | |
int | |
count_one_bits(unsigned value) | |
{ | |
int ones; | |
for (ones = 0; value != 0; value = value >> 1) { | |
printf("%d\n", value); |
#http://docs.linuxtone.org/ebooks/C&CPP/c/ch23s07.html | |
#include <stdio.h> | |
int main(int argc, const char * argv[]) { | |
char a[4][3][2] = { | |
{ | |
{'a', 'b'}, {'c', 'd'}, {'e', 'f'} | |
}, | |
{ | |
{'g', 'h'}, {'i', 'j'}, {'k', 'l'} |
#include <stdio.h> | |
#include "redirect_ptr.h" | |
/* | |
总结一下,两层指针参数如果是传出的,可以有两种情况: | |
第一种情况,传出的指针指向静态内存(比如上面的例子),或者指向已分配的动态内存(比如指向某个链表的节点); | |
第二种情况是在函数中动态分配内存,然后传出的指针指向这块内存空间. | |
这种情况下调用者应该在使用内存之后调用释放内存的函数,调用者的责任是请求分配和请求释放内存, | |
实现者的责任是完成分配内存和释放内存的操作。 | |
由于这两种情况的函数接口相同,应该在文档中说明是哪一种情况。 |