买二手车备注

甲方保证发动机、变速箱未拆卸更换,保证此车无任何经济纠纷,可正常过户,保证此车无火烧、无泡水、无事故,车身四梁六柱无切割,公里数为实表。如有以上情况甲方退还车款并以此车款的3倍赔给乙方

gulp与node版本兼容问题

win10系统下使用django时,用到了node,gulp等插件,但是在执行gulp命令时一直报错,网上找了n种方法,靠自己一步步填坑,终于解决了这个bug。记录一下完整的过程。

一、node与gulp版本兼容问题略谈。
我们使用nvm管理node版本,使用npm下载node中的各种插件,包括gulp,node版本需要与gulp版本相适应,比如node12以上的版本不能兼容gulp3,反过来一样gulp4不能适应node12一下的版本(我猜的,嘻嘻)。而node版本号中奇数为测试版,偶数为稳定版,所以我们需要选择合适的版本。我本来打算使用node12版本,但是在下载gulp4.0.2版本时cmd命令行总是显示为2版本,所以最后改为使用node10.20.1,gulp3.9.1。

https://github.com/coreybutler/nvm-windows/releases

二、完整操作过程
首先,假设已经安装了nvm,我们在命令行窗口下安装node10:
nvm install 10.20.1
然后使用10:
nvm use 10.20.1
接下来就可以安装gulp3,注意如果之前安装过其它版本,需要先清空npm_cache文件(在C/用户/APPDATA/roaming/下)并卸载gulp旧版本,卸载命令如下:
npm cache clean -f
npm uninstall –global gulp
安装命令如下:
npm install –global gulp@3.9.1

下面在命令行进入django项目中对应的文件夹,如果之前在该文件夹使用过npm install 命令,还需清空npm_cache 文件夹并清空缓存,命令如下:
npm cache clean -f
然后可以进行安装:
npm install
查看gulp版本:
gulp -v
如果全局与局部都是3.9.1版本,可以执行gulp命令:
gulp
然后会打开浏览器,这就表明命令成功了!!

ubuntu安装uwsgi

sudo apt-get install python3-dev build-essential libpcre3-dev

 

验证pcre

pcre-config --version

pip install uwsgi

验证uwsgi

mkdir /var/www/pyhtml/root

(需要自己保证一下用户ubuntu有权限)

vi wsgi.py
def application(env, start_response):
    start_response('200 OK', [('Content-Type','text/html')])
    return [b"Hello World"]
uwsgi --http :9090 --wsgi-file wsgi.py

mkdir /var/www/pyhtml/uwsgi
(需要自己保证一下用户ubuntu有权限)
cd /var/www/pyhtml/uwsgi
vi uwsgi.ini
[uwsgi]
http = :9090
#http = 127.0.0.1:9090
chdir = /var/www/pyhtml/root
# /var/www/pyhtml/uwsgi/wsgi.py application
module = wsgi:application
master = True
processes = 1
threads = 2
daemonize = wsgi.log
vacuum = true
pidfile = uwsgi.pid

 

sudo vi /etc/systemd/system/uwsgi.service

 

[Unit]
Description=uWSGI server
After=syslog.target

[Service]
User=ubuntu
WorkingDirectory=/var/www/pyhtml/uwsgi
ExecStart=/home/ubuntu/.local/bin/uwsgi --ini uwsgi.ini
Group=www-data

[Install]
WantedBy=multi-user.target

 

安装wasm 1.39.15

安装emsdk 1_39_15

  1. 运行脚本激活fastcomp

{path}/emsdk_1_39_15/emsdk activate latest-fastcomp
source {path}/emsdk_1_39_15/emsdk_env.sh

2. 在~/.bashrc中加入

export EMSDK={path}/emsdk_1_39_15
export EM_CONFIG={path}/emsdk_1_39_15/.emscripten
export EM_CACHE={path}/emsdk_1_39_15/fastcomp/emscripten/cache

export PATH=$PATH:${EMSDK}/fastcomp/fastcomp/bin:${EMSDK}:${EMSDK}/fastcomp/emscripten:${EMSDK}/fastcomp/bin

wasm wrap string

C代码

// C - code
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifndef EM_PORT_API
    #if defined(__EMSCRIPTEN__)
        #include <emscripten.h>
#if defined(__cplusplus)
#define EM_PORT_API(rettype) extern "C" rettype EMSCRIPTEN_KEEPALIVE
#else
#define EM_PORT_API(rettype) rettype EMSCRIPTEN_KEEPALIVE
#endif
    #else
#if defined(__cplusplus)
#define EM_PORT_API(rettype) extern "C" rettype 
#else
#define EM_PORT_API(rettype) rettype 
#endif
    #endif
#endif

EM_PORT_API(char*) fm_substr(char* buf, int pos) {
    char * ret;
    int sz = strlen(buf);

    ret = calloc(sz+1-pos, 1);
    memcpy(ret, buf+pos, sz-pos);

    return ret;
}

 

编译:

emcc -s RESERVED_FUNCTION_POINTERS=20 -s EXPORTED_RUNTIME_METHODS=['ccall','cwrap','stringToUTF8','UTF8ToString'] -s EXPORTED_FUNCTIONS=['_malloc','_free'] test.c -o test.js

 

 

使用:js代码

// JS - code

var result = Module.ccall('fm_substr', // name of C function
  'string', // return type
  ['string', 'number'], // argument types
  ['abc', 1]); // arguments

var c_js_ds_substr = Module.cwrap('fm_substr', // name of C function
  'string', // return type
  ['string', 'number']); // argument types
// Call c_javascript_add normally

console.log(c_js_ds_substr('abc', 1));
console.log(c_js_ds_substr('abc', 2));

 

openssl coding得到过期时间

#include <stdio.h>
#include <string.h>

#include <openssl/rand.h>
#include <openssl/asn1t.h>
#include <openssl/pem.h>
#include <openssl/bio.h>

#include "lws-pub.h"
#include "lws-sha1-base64.h"


static char* ECDSACertPEM = "-----BEGIN CERTIFICATE-----\n"
"MIIGxzCCBa+gAwIBAgIIc54uwAnLX20wDQYJKoZIhvcNAQELBQAwgbQxCzAJBgNV\n"
"...\n"
"...\n"
"MXYXS/YRsQ1FZrOK0RL3Ts624N4QZnfIxLspqiRo6wlCvUutLRe1QieqVfjm7SYp\n"
"r7rWE+e3ef9C+es=\n"
"-----END CERTIFICATE-----\n";

int main()
{
    uint8_t * p = NULL;
    lws_filepos_t flen = 0;

    BIO* bio_buf = BIO_new(BIO_s_mem());
    BIO_write(bio_buf, ECDSACertPEM, strlen(ECDSACertPEM));
    X509 * cert = PEM_read_bio_X509(bio_buf, NULL, NULL, NULL);
    const ASN1_TIME *tm = X509_get0_notAfter(cert);
    printf("date: %s \r\n", tm->data);

    BIO_free(bio_buf);
    X509_free(cert);

    struct tm tm1;
    ASN1_TIME_to_tm(tm, &tm1);
    
    printf("date: %d-%d-%d \r\n", 1900+tm1.tm_year, 1+tm1.tm_mon, tm1.tm_mday);

    getchar();
    return 0;
}

 

鹊桥仙·赠鹭莺 辛亦疾

溪边白鹭,来吾告汝:“溪里鱼儿堪数。主人怜汝汝怜鱼,要物我欣然一处。
白沙远浦,青泥别渚,剩有虾跳鳅舞。听君飞去饱时来,看头上风吹一缕。”
14.下列对这首词的理解与赏析,不正确的一项是(3分)
A.上阙结尾句“要物我欣然一处”,表达了人与自然和谐共处的美好愿望。
B.因“溪里鱼儿堪数”,故作者建议鹭莺去虾鳅较多的“远浦”“别渚”。
C.本词将鹭作为题赠对象,以“汝”“君”相称,营造出轻松亲切的氛围。
D.词末从听觉和视觉,上分别书写了鹭鹫饱食后心满意足的状态,活灵活现。
15.这首词的语言特明,请简要分析。(6分)


14. D项词末两句是说那里的虾鳅任你饱餐,我当看你乘风归来。“听君飞去饱时来”中的“听”字是“任凭”的意思,可依据教材李密《陈情表》一文中“听臣微志”的“听任,允许”之意,而选项误解成“听觉”,所以D项手法分析有误
15.  ①本词语言多用口语,风格亲切自然,清新明快,句式整散结合,和谐统一。
②将鹭鸶作为题赠对象,以第二人称“汝”“君”称之,以“来”字呼之,词人好似抚摸着白鹭说着悄悄话,营造出轻松亲切的氛围,显得自然而亲切。
③使用拟人、对比的修辞手法。“虾跳鳅舞”,写出了远渚的虾鳅舞动的生机,与“溪里鱼儿堪数”形成对比。词人将笔下的山水湖泊、鱼虫虾草、青天白鹭、人鸟私语融合,展现出一幅人与自然和谐共生的画面。

Bug with TLS 1.2 in Win7 IE11

介绍这个bug
https://serverfault.com/questions/741706/bug-with-tls-1-2-in-internet-explorer-11-windows-7#answer-845167

MS14-066:Schannel 中的漏洞可能允许远程执行代码:2014 年 11 月 11 日https://support.microsoft.com/zh-cn/topic/ms14-066-schannel-%E4%B8%AD%E7%9A%84%E6%BC%8F%E6%B4%9E%E5%8F%AF%E8%83%BD%E5%85%81%E8%AE%B8%E8%BF%9C%E7%A8%8B%E6%89%A7%E8%A1%8C%E4%BB%A3%E7%A0%81-2014-%E5%B9%B4-11-%E6%9C%88-11-%E6%97%A5-4740940a-5fe0-8d9b-88b5-2e2ca5999537

c++11 获得精确时间

#include <iostream>
#include <chrono>
#include <ctime>

#include <sys/timeb.h>
using namespace std;

int main()
{
	// using timeb.h -- deprecated
	struct timeb ft;
	ftime(&ft);	
	
	// using chrono
	auto tp = std::chrono::system_clock::now();
	auto now = std::chrono::system_clock::to_time_t(tp);		
	long long eee = std::chrono::system_clock::period::den / (1000* std::chrono::system_clock::period::num);
	long long fff = tp.time_since_epoch().count();
	int ms = (fff / eee) % 1000;


	printf("A1 %ld, %d\r\n", now, ms);
	
	printf("A2 %ld, %d\r\n", ft.time, ft.millitm);
	

	// change to readable string
	struct tm* gmtm = gmtime(&now);
// gmtm->tm_year+1900
// tmtm->tm_mon+1
	char* dt = asctime(gmtm);
	
	return 0;
}