Python打包上传

你可以用pip导出你的dependency:

$ pip freeze > requirements.txt

然后在通过以下命令安装dependency:

Python虚拟环境设置

Python2环境

首先,我们用pip安装virtualenv:

pip3 install virtualenv

然后,假定我们要开发一个新的项目,需要一套独立的Python运行环境,可以这么做:

centos6安装redis

  1. 检查安装依赖程序
yum install gcc-c++
yum install -y tcl
yum install wget
  1. 获取安装文件
wget http://download.redis.io/releases/redis-2.8.13.tar.gz
  1. 解压文件
tar -xzvf redis-2.8.19.tar.gz
mv redis-2.8.19 /usr/local/redis
  1. 进入目录
cd /usr/local/redis
  1. 编译安装
make
make install
  1. 设置配置文件路径
mkdir -p /etc/redis
cp redis.conf/etc/redis
  1. 修改配置文件
vi /etc/redis/redis.conf
仅修改: daemonize yes (no-->yes)
  1. 启动
/usr/local/bin/redis-server /etc/redis/redis.conf
  1. 查看启动
ps -ef | grep redis 
  1. 使用客户端
redis-cli
>set name david
OK
>get name
"david"
  1. 关闭客户端
redis-cli shutdown
  1. 开机启动配置
echo "/usr/local/bin/redis-server /etc/redis/redis.conf &" >> /etc/rc.local

开机启动要配置在 rc.local 中,而 /etc/profile 文件,要有用户登录了,才会被执行。

Ubuntu 16.04 为 PHP7 添加 memcached 以及 redis 扩展

切换到 PHP 7 之后,网站的速度大幅提升,不过通常的扩展可能某一个就还没有支持 PHP7

Memcached

比如说我现在使用了最新的 Ubuntu 16.04,虽然内置了 PHP 7 源,但 memcached 就还没有,不过好在,它已经支持了 PHP 7 ,只是没有源而已,我们手动编译它。

Mysql常用命令

导入sql文件

在MySQL命令行中中直接导入*.sql脚本,在mysql中执行sql文件的命令:

mysql> source   /root/db.sql;

增加用户

格式:

部署tinyproxy透明代理服务

线上需要一个https的透明代理,开始打算用nginx,调试了一段时间发现配置较复杂且没有成功。后来用的tinyproxy做的透明代理。安装配置过程就是下载、解压、编译、安装、配置、启动一波流:

Windows GVLK密钥对照表(KMS激活专用

以下key来源于微软官网:https://technet.microsoft.com/en-us/library/jj612867.aspx

Windows Server 2016

操作系统KMS激活序列号
Windows Server 2016 DatacenterCB7KF-BWN84-R7R2Y-793K2-8XDDG
Windows Server 2016 StandardWC2BQ-8NRM3-FDDYY-2BFGV-KHKQY
Windows Server 2016 EssentialsJCKRF-N37P4-C2D82-9YXRT-4M63B

Windows 10

操作系统KMS激活序列号
Windows 10 ProfessionalW269N-WFGWX-YVC9B-4J6C9-T83GX
Windows 10 Professional NMH37W-N47XK-V7XM9-C7227-GCQG9
Windows 10 EnterpriseNPPR9-FWDCX-D2C8J-H872K-2YT43
Windows 10 Enterprise NDPH2V-TTNVB-4X9Q3-TJR4H-KHJW4
Windows 10 EducationNW6C2-QMPVW-D7KKK-3GKT6-VCFB2
Windows 10 Education N2WH4N-8QGBV-H22JP-CT43Q-MDWWJ
Windows 10 Enterprise 2015 LTSBWNMTR-4C88C-JK8YV-HQ7T2-76DF9
Windows 10 Enterprise 2015 LTSB N2F77B-TNFGY-69QQF-B8YKP-D69TJ
Windows 10 Enterprise 2016 LTSBDCPHK-NFMTC-H88MJ-PFHPY-QJ4BJ
Windows 10 Enterprise 2016 LTSB NQFFDN-GRT3P-VKWWX-X7T3R-8B639

Windows Server 2012 R2 和 Windows 8.1

操作系统KMS激活序列号
Windows 8.1 ProfessionalGCRJD-8NW9H-F2CDX-CCM8D-9D6T9
Windows 8.1 Professional NHMCNV-VVBFX-7HMBH-CTY9B-B4FXY
Windows 8.1 EnterpriseMHF9N-XY6XB-WVXMC-BTDCT-MKKG7
Windows 8.1 Enterprise NTT4HM-HN7YT-62K67-RGRQJ-JFFXW
Windows Server 2012 R2 Server StandardD2N9P-3P6X9-2R39C-7RTCD-MDVJX
Windows Server 2012 R2 DatacenterW3GGN-FT8W3-Y4M27-J84CP-Q3VJ9
Windows Server 2012 R2 EssentialsKNC87-3J2TX-XB4WP-VCPJV-M4FWM

Windows Server 2012 和 Windows 8

操作系统KMS激活序列号
Windows 8 ProfessionalNG4HW-VH26C-733KW-K6F98-J8CK4
Windows 8 Professional NXCVCF-2NXM9-723PB-MHCB7-2RYQQ
Windows 8 Enterprise32JNW-9KQ84-P47T8-D8GGY-CWCK7
Windows 8 Enterprise NJMNMF-RHW7P-DMY6X-RF3DR-X2BQT
Windows Server 2012BN3D2-R7TKB-3YPBD-8DRP2-27GG4
Windows Server 2012 N8N2M2-HWPGY-7PGT9-HGDD8-GVGGY
Windows Server 2012 Single Language2WN2H-YGCQR-KFX6K-CD6TF-84YXQ
Windows Server 2012 Country Specific4K36P-JN4VD-GDC6V-KDT89-DYFKP
Windows Server 2012 Server StandardXC9B7-NBPP2-83J2H-RHMBY-92BT4
Windows Server 2012 MultiPoint StandardHM7DN-YVMH3-46JC3-XYTG7-CYQJJ
Windows Server 2012 MultiPoint PremiumXNH6W-2V9GX-RGJ4K-Y8X6F-QGJ2G
Windows Server 2012 Datacenter48HP8-DN98B-MYWDG-T2DCC-8W83P

Windows 7 and Windows Server 2008 R2

操作系统KMS激活序列号
Windows 7 ProfessionalFJ82H-XT6CR-J8D7P-XQJJ2-GPDD4
Windows 7 Professional NMRPKT-YTG23-K7D7T-X2JMM-QY7MG
Windows 7 Professional EW82YF-2Q76Y-63HXB-FGJG9-GF7QX
Windows 7 Enterprise33PXH-7Y6KF-2VJC9-XBBR8-HVTHH
Windows 7 Enterprise NYDRBP-3D83W-TY26F-D46B2-XCKRJ
Windows 7 Enterprise EC29WB-22CC8-VJ326-GHFJW-H9DH4
Windows Server 2008 R2 Web6TPJF-RBVHG-WBW2R-86QPH-6RTM4
Windows Server 2008 R2 HPC editionTT8MH-CG224-D3D7Q-498W2-9QCTX
Windows Server 2008 R2 StandardYC6KT-GKW9T-YTKYR-T4X34-R7VHC
Windows Server 2008 R2 Enterprise489J6-VHDMP-X63PK-3K798-CPX3Y
Windows Server 2008 R2 Datacenter74YFP-3QFB3-KQT8W-PMXWJ-7M648
Windows Server 2008 R2 for Itanium-based SystemsGT63C-RJFQ3-4GMB6-BRFB9-CB83V

Windows Vista and Windows Server 2008

操作系统KMS激活序列号
Windows Vista BusinessYFKBB-PQJJV-G996G-VWGXY-2V3X8
Windows Vista Business NHMBQG-8H2RH-C77VX-27R82-VMQBT
Windows Vista EnterpriseVKK3X-68KWM-X2YGT-QR4M6-4BWMV
Windows Vista Enterprise NVTC42-BM838-43QHV-84HX6-XJXKV
Windows Web Server 2008WYR28-R7TFJ-3X2YQ-YCY4H-M249D
Windows Server 2008 StandardTM24T-X9RMF-VWXK6-X8JC9-BFGM2
Windows Server 2008 Standard without Hyper-VW7VD6-7JFBR-RX26B-YKQ3Y-6FFFJ
Windows Server 2008 EnterpriseYQGMW-MPWTJ-34KDK-48M3W-X4Q6V
Windows Server 2008 Enterprise without Hyper-V39BXF-X8Q23-P2WWT-38T2F-G3FPG
Windows Server 2008 HPCRCTX3-KWVHP-BR6TB-RB6DM-6X7HP
Windows Server 2008 Datacenter7M67G-PC374-GR742-YH8V4-TCBY3
Windows Server 2008 Datacenter without Hyper-V22XQ2-VRXRG-P8D42-K34TD-G3QQC
Windows Server 2008 for Itanium-Based Systems4DWFP-JF3DJ-B7DTH-78FJB-PDRHK

Ubuntu下的OpenResty 安装

安装前的准备

您必须将这些库 perl 5.6.1+, libreadline, libpcre, libssl安装在您的电脑之中。 对于 Linux来说, 您需要确认使用 ldconfig 命令,让其在您的系统环境路径中能找到它们。

激活

自己经常用,做个备份

Emeditor激活码

DMAZM-WHY52-AX222-ZQJXN-79JXH

Version 18.9.12 使用正常!

VS2010

版本密钥
旗舰版YCFHQ-9DWCY-DKV88-T2TMH-G7BHP

VS2012

版本密钥
Microsoft Visual Studio Ultimate 2012 旗舰版YKCW6-BPFPF-BT8C9-7DCTH-QXGWC
Microsoft Visual Studio Premium 2012 高级版MH2FR-BC9R2-84433-47M63-KQVWC
Microsoft Visual Studio Professional 2012 专业版4D974-9QX42-9Y43G-YJ7JG-JDYBP

VS2013

版本密钥
Visual Studio Ultimate 2013 旗舰版BWG7X-J98B3-W34RT-33B3R-JVYW9
Visual Studio Premium 2013 高级版FBJVC-3CMTX-D8DVP-RTQCT-92494
Visual Studio Professional 2013 专业版XDM3T-W3T3V-MGJWK-8BFVD-GVPKY
Team Foundation Server 2013MHG9J-HHHX9-WWPQP-D8T7H-7KCQG

VS2015

版本密钥
专业版HMGNV-WCYXV-X7G9W-YCX63-B98R2
企业版HM6NR-QXX7C-DFW2Y-8B82K-WTYJV

vs2017

版本密钥
专业版KBJFW-NXHK6-W4WJM-CRMQB-G3CDH
企业版NJVYC-BMHX2-G77MM-4XJMR-6Q8QF

vs2019

版本密钥
专业版NYWVH-HT4XC-R2WYW-9Y3CM-X4V3Y
企业版BF8Y8-GN2QH-T84XB-QVY3B-RC4DF

vs2022

版本密钥
Visual studio 2022 EnterpriseVHF9H-NXBBB-638P6-6JHCY-88JWH
Visual studio 2022 ProTD244-P4NB7-YQ6XK-Y8MMM-YWV2J

SQL SERVER 2008 R2序列号:

版本密钥
数据中心版PTTFM-X467G-P7RH2-3Q6CG-4DMYB
开发者版MC46H-JQR3C-2JRHY-XYRKY-QWPVM
企业版R88PF-GMCFT-KM2KR-4R7GB-43K4B
标准版B68Q6-KK2R7-89WGB-6Q9KR-QHFDW
工作组版XQ4CB-VK9P3-4WYYH-4HQX3-K2R6Q
WEB版FP4P7-YKG22-WGRVK-MKGMX-V9MTM

Sublime Text 2.0.2注册码

直接输入注册码就可以了

Ubuntu16.04阿里云源

16.04源

deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse

14.04源

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

/usr/share/nodejs/firekylin
sudo ln -s /usr/share/nodejs/firekylin/nginx.conf /etc/nginx/conf.d/luody.conf

asp.net mvc获得请求体所有内容

代码如下

Stream req = Request.InputStream;
req.Seek(0, System.IO.SeekOrigin.Begin);
string json = new StreamReader(req).ReadToEnd();

ubuntu 添加新硬盘

查看硬盘:

# fdisk -l
...
Disk /dev/sdb: 274.9 GB, 274877906944 bytes
255 heads, 63 sectors/track, 33418 cylinders, total     536870912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sdb doesn"t contain a valid partition table

可以看到,有一块大小为256G的磁盘未初始化

ubuntu 上的ruby安装

安装 rbenv

git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
# 用来编译安装 ruby
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
# 用来管理 gemset, 可选, 因为有 bundler 也没什么必要
git clone git://github.com/jamis/rbenv-gemset.git  ~/.rbenv/plugins/rbenv-gemset
# 通过 gem 命令安装完 gem 后无需手动输入 rbenv rehash 命令, 推荐
git clone git://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash
# 通过 rbenv update 命令来更新 rbenv 以及所有插件, 推荐
git clone git://github.com/rkh/rbenv-update.git ~/.rbenv/plugins/rbenv-update
# 使用 Ruby China 的镜像安装 Ruby, 国内用户推荐
git clone git://github.com/AndorChen/rbenv-china-mirror.git ~/.rbenv/plugins/rbenv-china-mirror

然后把下面的代码放到 ~/.bash_profile