作者归档:夜明兔

PHP8.2 + OPENSSL 3 编译安装记录

// 编译openssl
wget https://www.openssl.org/source/openssl-3.0.9.tar.gz
tar zxf openssl-3.0.9.tar.gz && cd openssl-3.0.9
./config shared -Wl,--enable-new-dtags -Wl,-rpath=/opt/openssl/lib64 --prefix=/opt/openssl --openssldir=/opt/openssl
make && make install

// 编译PHP8.2
wget https://www.php.net/distributions/php-8.2.8.tar.gz
tar zxf php-8.2.8.tar.gz && cd php-8.2.8
export LDFLAGS="-L/opt/openssl/lib64 -Wl,-rpath=/opt/openssl/lib64"
export PKG_CONFIG_PATH=/opt/openssl/lib64/pkgconfig
// 安装其他扩展可以添加相应的参数
./configure -prefix=/usr/local/php --with-openssl
make && make install

需要注意的地方

  • LDFLAGS 变量告诉链接器把指定的openssl路径添加到php可执行文件中。如果 openssl 安装在非标准路径,运行 php 可能找不到库错误。
  • PKG_CONFIG_PATH 变量是指定新装openssl 库的位置。

NGACN跳转广告过滤

2013-9-4 更新: 添加版面跳转

NGACN.cc 论坛会随机转向到需要点击才能继续浏览的广告,所以写了个脚本来自动跳转,很简单的三行代码。

脚本需要FireFox + scriptish扩展  点我安装

// ==UserScript==
// @id             github.com-c89fe7d1-a59b-42b2-a17a-a88c024f6f4e@scriptish
// @name           NGA跳转广告过滤
// @version        1.1
// @namespace      hmmabc.com
// @author         hmmabc
// @description    自动跳转NGA广告
// @include        http://bbs.ngacn.cc/misc/*
// @run-at         document-start
// ==/UserScript==

var currentURL = window.location.href;
var url = [/http:\/\/bbs.ngacn.cc\/read.*$/,/http:\/\/bbs.ngacn.cc\/thread.*$/];
for(i=0;i<url.length;i++){
	var real = url[i].exec(currentURL);
	if(real){
		window.location.href = real;
	}
}

 

1.0 [email protected]
1.1 [email protected]

Windows8.1 RTM下载地址

Windows 8.1 简体中文专业版+核心版(64位):

RELEASE DATE: 08/21/2013 
BUILD: 6.3.9600.16384.WINBLUE_RTM.130821-1623 
FILE: 9600.16384.130821-1623_x64fre_Client_ZH-CN-IRM_CCSA_DV5.ISO 
SIZE: 4,076,017,664 byte 
SHA-1: F79E0093DDEDD488F40D4AE6B6F0FA3C529051E1 

MD5: BCB0FA9947C0F0E5E57F3A83EC7171D7 

下载地址: magnet:?xt=urn:btih:4115C08F071C9DCCB1850E914887CC48F4FF86C8 

Windows 8.1 简体中文专业版+核心版(32位):

MICROSOFT.WINDOWS.8.1.RTM.X86.CHINESE.SIMPLIFIED_ZH-CN.DVD-WZT 
RELEASE DATE: 08/21/2013 
BUILD: 6.3.9600.16384.WINBLUE_RTM.130821-1623 
FILE: 9600.16384.130821-1623_x86fre_Client_ZH-CN-IRM_CCSA_DV5.ISO 
SIZE: 3,055,904,768 byte 
SHA-1: D07E7CA99B455FFC0B58BE96333D1F554FE83D8A 
MD5: 1C797D06A63DC65D068212A804A4D774 

下载地址: magnet:?xt=urn:btih:F1623CD26279DAA08C3B16CB38EC676194891A3E

Windows 8.1 简体中文企业版(64位):

MICROSOFT.WINDOWS.8.1.ENTERPRISE.RTM.X64.VOLUME.CHINA.DVD-WZT 
RELEASE DATE: 08/21/2013 
BUILD: 6.3.9600.16384.WINBLUE_RTM.130821-1623 
FILE: ?Windows_8.1_Ent_ZH-CN_Vl_x64.ISO 
SIZE: 3,973,625,856 byte 
SHA-1: 665F4830BB7D377EBF7DE5C8C411A769350ED454 
MD5: 6B5773E55DD915B65D3121166483404E

下载地址: magnet:?xt=urn:btih:D89B625885A76F09EAFA96051F95F16493F71F20

Windows 8.1 简体中文企业版(32位):

MICROSOFT.WINDOWS.8.1.ENTERPRISE.RTM.X86.VOLUME.CHINA.DVD-WZT 
RELEASE DATE: 08/21/2013 
BUILD: 6.3.9600.16384.WINBLUE_RTM.130821-1623 
FILE: ?Windows_8.1_Ent_ZH-CN_Vl_x86.ISO 
SIZE: 2,968,020,992 byte 
SHA-1: CB1BAA1B477DB128117CF9633D60C8518B2A60E5 
MD5: 0DEA6E3C17662484DC0F47DED9B1022C 

下载地址: magnet:?xt=urn:btih:EB9312723CBD458C93AA6C854897F7A654AC5BD2

Windows 8.1 简体中文单语言版(64位):

RELEASE DATE: 08/21/2013 
BUILD: 6.3.9600.16384.WINBLUE_RTM.130821-1623 
FILE: 9600.16384.130821-1623_x64fre_Client_CSingleLanguage_ZH-CN-IRM_CSLA_DV5.ISO 
SIZE: 4,014,051,328 byte 
SHA-1: 332CEC09C37D28061583A22958A6908B1EE38359 
MD5: 7BAB50FC09F91821F50C38878A2782A4 

下载地址: magnet:?xt=urn:btih:CF3413A64515FF987B6AF1B3E3D6F5BBA43C27F5 

Windows 8.1 简体中文单语言版(32位):

RELEASE DATE: 08/21/2013 
BUILD: 6.3.9600.16384.WINBLUE_RTM.130821-1623 
FILE: 9600.16384.130821-1623_x86fre_Client_CSingleLanguage_ZH-CN-IRM_CSLA_DV5.ISO 
SIZE: 3,011,039,232 byte 
SHA-1: C344159D30409F14C665407BA0BE523D068921E5 
MD5: 7C887D7E4214AFE55483EA7E79F17A78 

下载地址: magnet:?xt=urn:btih:26C04F06E85C54BA737383A950F386FEB423B8EA 

Windows 8.1 英文专业版+核心版零售镜像(64位):

MICROSOFT.WINDOWS.8.1.RTM.X64.ENGLISH.DVD-WZT
RELEASE DATE: 08/21/2013
BUILD: 6.3.9600.16384.WINBLUE_RTM.130821-1623
FILE: Windows_8.1_EN-US_x64.ISO
SIZE: 3,899,295,744 byte
SHA-1: BC2F7FF5C91C9F0F8676E39E703085C65072139B
MD5: F104B78019E86E74B149AE5E510F7BE9

下载地址: magnet:?xt=urn:btih:958ED16A00869C0BA4C04815AB500FFA1F2EE92E

Windows 8.1 英文专业版+核心版零售镜像(32位):

MICROSOFT.WINDOWS.8.1.RTM.X86.ENGLISH.DVD-WZT
RELEASE DATE: 08/21/2013
BUILD: 6.3.9600.16384.WINBLUE_RTM.130821-1623
FILE: Windows_8.1_EN-US_x86.ISO
SIZE: 2,915,131,392 byte
SHA-1: 802CFCD3A411D99C097EA7E747F0B6697F9BDAC4
MD5: 7DD36FEA0D004ACFEDBDB3A5521EF5FF

下载地址: magnet:?xt=urn:btih:D40A31912E9C1227826397B208228EFF3839802D

Windows 8.1 英文企业版(64位):

MICROSOFT.WINDOWS.8.1.ENTERPRISE.RTM.X64.VOLUME.ENGLISH.DVD-WZT
RELEASE DATE: 08/21/2013
BUILD: 6.3.9600.16384.WINBLUE_RTM.130821-1623
FILE:  Windows_8.1_Ent_EN-US_Vl_x64.ISO
SIZE: 3,798,214,656 byte
SHA-1: 8311958EDDEDD29E326ED91FDF025D39B88E0FC8
MD5: 2A9589AEEFDC4B94CD527476FA979EE5

下载地址: magnet:?xt=urn:btih:0152402468F3AB720C0F1EFBCB52CC951C310840 

Windows 8.1 英文企业版(32位):

MICROSOFT.WINDOWS.8.1.ENTERPRISE.RTM.X86.VOLUME.ENGLISH.DVD-WZT
RELEASE DATE: 08/21/2013
BUILD: 6.3.9600.16384.WINBLUE_RTM.130821-1623
FILE:  Windows_8.1_Ent_EN-US_Vl_x86.ISO
SIZE: 2,828,421,120 byte
SHA-1: 87DBCDB8491DBEF1BBC14BE8AB599086789E143C
MD5: 405091EFE4D58947DB45A106B37DD064

下载地址: magnet:?xt=urn:btih:FBF03CEA3E388A810CDE76B67A8DF867F002B52A 

Windows 8.1 64位多国语言包  (包含简体中文)

RELEASE DATE: 08/21/2013 
BUILD: 6.3.9600.16384.WINBLUE_RTM.130821-1623 
FILE: 9600.16384.130821-1623_x64fre_Client_MULTI_IRM_CL1_DV5.iso 
SIZE: 1,963,837,440 byte 
SHA-1: 4D567D72CBFF463F5C2C64B0B221E7A408240183 
MD5: 58FE54CFB87506C83DF5BAECF181C5A8 

下载地址: magnet:?xt=urn:btih:315629A04E41F52BEFFD27A8C00C4CBD245DEEB9 

Windows 8.1 32位多国语言包  (包含简体中文)

RELEASE DATE: 08/21/2013 
BUILD: 6.3.9600.16384.WINBLUE_RTM.130821-1623 
FILE: 9600.16384.130821-1623_x86fre_Client_MULTI_IRM_CL1_DV5.iso 
SIZE: 1,483,513,856 byte 
SHA-1: 3B62F16F50F3F80A58BE29B4B3A99885BD8F1AD4 
MD5: 93CCCBFD2F4EC5BB13C7E934CADB4056 

下载地址: magnet:?xt=urn:btih:71CB8DFA797E7493BCCD3FC230545C5255BC427E 

Windows 8.1 安装密钥(只适用安装,不支持激活):

核心版=334NH-RXG76-64THK-C7CKG-D3VPT
专业版=XHQ8N-C3MCJ-RQXB6-WCHYG-C9WKB

Windows Server 2012 R2 英文版(64位)

RELEASE DATE: 08/21/2013 
BUILD: 6.3.9600.16384.WINBLUE_RTM.130821-1623 
FILE: 9600.16384.130821-1623_x64fre_Server_EN-US_IRM_SSS_DV5.iso 
SIZE: 4,268,605,440 byte 
SHA-1: B6F063436056510357CB19CB77DB781ED9C11DF3 
MD5: 0E7C09AAB20DEC3CD7EAB236DAB90E78 

下载地址: magnet:?xt=urn:btih:9BBE032569B4EC7BAF98ED6C6F9DC226B8C7482A 

Windows Server 2012 R2 64位多国语言包  (包含简体中文)

RELEASE DATE: 08/21/2013 
BUILD: 6.3.9600.16384.WINBLUE_RTM.130821-1623 
FILE: 9600.16384.130821-1623_x64fre_Server_MULTI_IRM_SL1_DV5.iso 
SIZE: 1,637,578,752 byte 
SHA-1: E0BD3827BD885E5E4E559158A64D650BCACA991E 
MD5: 13BF1E1409FDE8D6A55DAA50DA4BE42B 

下载地址: magnet:?xt=urn:btih:516C5D807B343332DAF44374C4EFAD10EA6A78BB

Ubuntu编译安装PHP 5.5.3+Nginx 1.5.4

因系统Ubuntu12.04,官方源能升级到最新的PHP版本为5.3.10,感觉版本太旧有漏洞,所以决定编译升级到最新的nginx和php。下面是安装笔记。

注:MySQL用的依然是源里的二进制包,编译MySQL耗时太久,所以就放弃了。

1.编译安装Nginx

#安装nginx依赖
apt-get install build-essential libpcre3-dev libssl-dev
wget http://nginx.org/download/nginx-1.5.4.tar.gz
tar -zxf nginx-1.5.4.tar.gz
cd nginx-1.5.4/
./configure --with-http_ssl_module
make
make install

安装后默认目录在/usr/local/nginx,执行/usr/local/nginx/sbin/nginx 测试是否安装成功。

2.编译安装PHP

#安装PHP依赖,重要
apt-get install libiconv-hook-dev libmcrypt-dev libxml2-dev libmysqlclient-dev libcurl4-openssl-dev libjpeg8-dev libpng12-dev libfreetype6-dev

#下载源码,用的是美国镜像
wget -O php5.5.3.tar.gz http://cn2.php.net/get/php-5.5.3.tar.gz/from/us1.php.net/mirror
tar -zxf php5.5.3.tar.gz
cd php-5.5.3/

#配置,MySql用的是mysqlnd
./configure -prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-iconv-dir --with-freetype-dir --with
-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr -enable-xml -disable-rpath -enable-bcmath -enable-shmop -enable-sysv
sem -enable-inline-optimization --with-curl  -enable-mbregex -enable-fpm -enable-mbstring --with-mcrypt -enable-ftp --with-gd -e
nable-gd-native-ttf --with-openssl --with-mhash -enable-pcntl -enable-sockets --with-xmlrpc -enable-zip -enable-soap --without-p
ear --with-gettext --with-mysqli=mysqlnd --with-mysql=mysqlnd --with-pdo-mysql

make
make install

默认安装目录在/usr/local/php

3.配置nginx+php

#进入/usr/local/php/etc目录,复制一份php-fpm配置
cp php-fpm.conf.default php-fpm.conf

#从源码目录复制一份php.ini文件到/usr/local/php
cp {PHP_SOURCE_PATH}/php.ini-production /usr/local/php/etc/php.ini

#准备php-fpm服务脚本
cp {PHP_SOURCE_PATH}/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm

 4.结束

启动php-fpm
/etc/init.d/php-fpm start

启动nginx
/usr/local/nginx/sbin/nginx

最后收尾工作就是权限配置和nginx的站点配置了。

node.js 批量下载百度贴吧图片

有需求就有动力,你懂的…

才学Node.js,如法炮制了一个脚本,有不足之处多多指教!

用法:
指定要下载的贴吧URL,node执行即可。(默认是第一页50个帖子)
图片保存在以帖子id命名的文件夹中,由于百度返回的是gbk编码,貌似node.js不支持非utf-8 显示乱码,只能用id当文件夹名字了。

依赖: jquery,request,mkdirp 用npm 安装即可。

//
//  By hmmabc@OSC
//

var fs = require('fs');
var mkdirp = require('mkdirp');
var request = require('request');
var $ = require('jquery').create();

//萌妹吧
//var url = "http://tieba.baidu.com/f?ie=utf-8&kw=%E8%90%8C%E5%A6%B9%E5%AD%90";
//美女吧
//var url = "http://tieba.baidu.com/f?ie=utf-8&kw=%E7%BE%8E%E5%A5%B3";
//黑丝吧
var url = "http://tieba.baidu.com/f?ie=utf-8&kw=%E9%BB%91%E4%B8%9D";

var baseUrl = "http://tieba.baidu.com";
var posts = [];
var count = 0;

$.get(url,function(data){
	$(data).find("a.j_th_tit").each(function(){
		posts.push({title: this.title,url: baseUrl + $(this).attr("href")});
	});
	console.log("共有帖子"+posts.length);
	$.each(posts,function(index,post){
		downpost(post.url);
	});
});

var downpost = function(url){
	$.get(url,function(data){
		var imgs = [];
		var dir = "";
		$(data).find(".BDE_Image").each(function(){
			imgs.push(this.src);
		});
		if(imgs.length == 0) return;
		dir = url.match(/\d+$/)[0];
		mkdirp(dir,function(err){
			if(err) console.log(err);
		});
		$.each(imgs,function(index,value){
			download(value,dir,Math.floor(Math.random()*100000)+ value.substr(-4,4));
		});
		console.log("已完成" + ++count);
	});
}

var download = function(uri, dir,filename){
	request.head(uri, function(err, res, body){
		request(uri).pipe(fs.createWriteStream(dir + "/" + filename));
	});
};

 

无法正常访问Google谷歌及其相关应用,无法同步Google Chrome解决办法

将下面的内容添加进hosts文件即可。
Linux在/etc/hosts
Windows在C:\Windows\System32\drivers\etc\HOSTS

#Google By Gjia.me
203.208.46.163 0-focus-opensocial.googleusercontent.com
203.208.46.163 3hdrrlnlknhi77nrmsjnjr152ueo3soc-a-calendar-opensocial.googleusercontent.com
203.208.46.163 accounts.google.com
203.208.46.163 ajax.googleapis.com
203.208.46.163 android.l.google.com
203.208.46.163 a-oz-opensocial.googleusercontent.com
203.208.46.163 apis.google.com
203.208.46.163 appengine.google.com
203.208.46.163 bks0.books.google.com
203.208.46.163 bks1.books.google.com
203.208.46.163 bks2.books.google.com
203.208.46.163 bks3.books.google.com
203.208.46.163 bks4.books.google.com
203.208.46.163 bks5.books.google.com
203.208.46.163 bks6.books.google.com
203.208.46.163 bks7.books.google.com
203.208.46.163 bks8.books.google.com
203.208.46.163 bks9.books.google.com
203.208.46.163 blogsearch.google.cn
203.208.46.163 blogsearch.google.com.hk
203.208.46.163 books.google.com 继续阅读

MacOS去除优酷“呃。。。广告无法正常播放了”提示

即使用了Adblock等去广告扩展,看优酷广告时候还是有可能出现优酷来卖萌:“呃。。。广告无法正常播放了”,去除方法也很简单,可以效仿Windows的去除方法。以下以Chrome为例。

  1. 打开一个终端输入:
    cd /Users/yemingtu/Library/Application Support/Google/Chrome/Default/Pepper Data/Shockwave Flash/WritableRoot/#SharedObjects/YDZRQQ4C
    其中蓝色部分改成你的用户名;红色部分可能和上面的不一样,随机字母。
  2. 输入rm -rf static.youku.com删除目录
  3. 用touch static.youku.com 创建一个空文件
  4. 输入chmod -w static.youku.com 设置为只读

重新打开Chrome即可摆脱优酷卖萌。

vim映射CTRL+S保存快捷键

禁用掉终端CTRL+S快捷键功能
“CTRL-S:挂起终端(XON)
“CTRL-Q:恢复终端(XOFF)
“要禁止这些键盘映射,在~/.bashrc中加入
stty -ixon
然后修改vim中的按键映射,在 ~/.vimrc中加入

nmap <C-S> :update<CR>
vmap <C-S> <C-C>:update<CR>
imap <C-S> <C-O>:update<CR>

解决gcc4.5编译L2TP一键安装包 openswan出错问题

错误大概是:

In file included from /home/users/z/rpm/BUILD/openswan-2.6.25/programs/addconn/addconn.c:51:0:
/home/users/z/rpm/BUILD/openswan-2.6.25/include/ipsecconf/confread.h:37:19: error: comparison between ‘enum keyword_string_config_field’ and ‘enum keyword_string_conn_field’
/home/users/z/rpm/BUILD/openswan-2.6.25/include/ipsecconf/confread.h:38:19: error: comparison between ‘enum keyword_numeric_config_field’ and ‘enum keyword_numeric_conn_field’
/home/users/z/rpm/BUILD/openswan-2.6.25/include/ipsecconf/confread.h:39:34: error: comparison between ‘enum keyword_string_config_field’ and ‘enum keyword_string_conn_field’
/home/users/z/rpm/BUILD/openswan-2.6.25/include/ipsecconf/confread.h:40:34: error: comparison between ‘enum keyword_numeric_config_field’ and ‘enum keyword_numeric_conn_field’
make3* [addconn.o] Error 1
make3: Leaving directory `/home/users/z/rpm/BUILD/openswan-2.6.25/OBJ.linux.i386/programs/addconn’
make2
[programs] Error 1
make2: Leaving directory `/home/users/z/rpm/BUILD/openswan-2.6.25/OBJ.linux.i386/programs’
make1
[programs] Error 1
make1: Leaving directory `/home/users/z/rpm/BUILD/openswan-2.6.25/OBJ.linux.i386′
make: *
 [programs] Error 2

 

这是个bug,打上补丁即可解决
https://www.openswan.org/issues/1108

补丁详细信息:

继续阅读