包括用linux自带openssl签postfix证书、流媒体证书按网上教程(找不到之类的问题,最后自己把证书试出来了,见第一部分,还有博客cdn换成tx云因为配置不一样导致好久没发现cdn没启用等尴尬的问题

证书

ubuntu自带的openssl包含的证书和RSA密钥等,相当于一套封装的加密套件。

  • based on SSL&TLS
  • 生成常用key的指令如下(很久远了,之前记下的只有几个,以后更新)
  • 如果没有的话可以下载包ca-certificates
1
2
3
4
5
6
7
8
9
10
11
12
public:
openssl rsa -in rsa_private.key -pubout -out rsa_public.key

private ase256加密:
openssl genrsa -aes256 -passout pass:111111 -out rsa_aes_private.key 2048

签postfix实现加密,关键的两步:
由于Thawte_Premium_Server_CA.pem证书失效,在新的cacert包里面更换成thawte_Primary_Root_CA.pem
cat /etc/ssl/certs/thawte_Primary_Root_CA.pem | sudo tee -a /etc/postfix/cacert.pem
修改main.cf的smtp_tls_CAfile = /etc/postfix/cacert.pem,
使用postmap生成用户名和密码的hash表
重新加载/etc/init.d/postfix(postfix服务的jio本)就可以使用了

怪事情,opencv的cvtColor突然不能用,但是服务器上没问题

  • 解决方法找了其他源。。
    1
    conda install --channel https://conda.anaconda.org/menpo opencv3

shell以前记的笔记(_ _)

1
2
3
4
5
6
7
8
开头加一句#!/bin/bash 说明是一个脚本
变量不需要声明可以直接用
变量取值的话加美元
If while中条件注意空格
变量赋值不加空格
Echo重定向:如果需要变量值和字符串相连,加大括号。
没写i自增导致死循环
If后一定要写fi代表结束,汇编格式吼啊
  • 一个技巧,似乎是以前在用别人写的caffe库的时候出现了这个问题,忘了报什么错了,不是记得很清楚
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
    在Linux下编程时,或者说在一个有很多头文件互相 include 的场景中,经常会遇到不清楚一个变量
的完整类型定义的情况(因为有用 typedef 封装),从而有可能遇到编译出错。
例如在使用 stat 来读取文件属性的 i-node number 时,查看 stat 的手册,得知这个变量 st_ino 的变量类型是 ino_t,而我们不清楚 ino_t的准确定义究竟是什么。
可以用如下方法:声明一个这样的变量即可。

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

int main() {
ino_t blah;

return 0;
}
然后运行如下指令:

gcc -E test.c | grep ino_t
-E 选项的意思是:在预处理过程后结束并输出到标准输出。
文档原文如下
-E Stop after the preprocessing stage; do not run the compiler proper.
The output is in the form of preprocessed source code, which is sent to the standard output.
  • c文件生成的步骤
1
C/C++文件经过预处理(preprocessing)、编译(compilation)、汇编(assembly)、和连接(linking)才能变成可执行文件。
  • 查看已经建立的tcp链接数量,包括close_waite ,established,time_wait状态,
  • 不会awk的时候感觉这是个什么东西orz
1
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

安装lua的时候 readline缺失

1
安装一下 libreadline-dev,或者readline-dev,版本不一样有哪个装哪个

树莓派摄像头(非dsi口)

  • 可以这样

    1
    mplayer -tv driver=v4l2:width=800:height=700:device=/dev/video1 tv://
  • python调用的时候使用PiCamera库或者cv库,PiCamera可以测试下能不能用,毕竟两行代码,做视觉还是用cv了

    tx云cdn

    1
    2
    3
    配置cdn
    源站信息: 自有源站,waynamigo.github.io
    回源配置: 回源host,waynamigo.cn

发现使用shadowsocks还行,那个ssr扔了

1
sudo sslocal -c /etc/shadowsocks/config.json -d start

sslocal 直接用apt安装shadowsocks

使用的

流媒体搭建

1
2
3
4
5
6
7
8
9
10
11
12
13
git clone https://github.com/arut/nginx-rtmp-module.git

wget http://nginx.org/download/nginx-1.8.1.tar.gz
tar -zxvf nginx-1.8.1.tar.gz
cd nginx-1.8.1
先安装一下依赖
yum install pcre-devel
yum install zlib zlib-devel
yum install openssl openssl-devel

./configure --prefix=/usr/local/nginx --add-module=../nginx-rtmp-module --with-http_ssl_module
make
make install
  • /usr/local/nginx/conf/nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

rtmp {

server {

listen 1935; #监听的端口

chunk_size 4000;


application hls { #rtmp推流请求路径
live on;
hls on;
hls_path /usr/share/nginx/html/hls;
hls_fragment 5s;
}
}
}
修改server模块的
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}

git配置多用户

.ssh/config

1
2
3
4
Host github.com
HostName github.com
IdentityFile ~/.ssh/id_rsa_qq
User nanamya
1
2
3
4
5
6
7
cd  .git
设置本项目的用户名和邮箱
git config user.name "yourname"
git config user.email "youremail"
如果重设 则:
git config --global --unset user.name
git config --global --unset user.email

如果还是8行,检查一下,正常的话会有如下提示,否则会有debug的信息
ssh -vT git@github.com

  • 提示Hi waynamigo! You’ve successfully authenticated, but GitHub does not provide shell access.

更换用户

作死小能手

  • :() { function :|:& }; :