Dim delayer
Set delayer = CreateObject("WScript.Shell")
WScript.sleep 10000
delayer.Run "C:\Users\Administrator\Desktop\融合.lnk", 1, FALSE
Set delayer = Nothing
WScript.quit
分类: 未分类
GeoIP定位用户位置,若是用户使用了代理,则获取到的是代理地址。
解决方法是安装nginx模块http_realip_module,默认该模块未安装,参考下面连接:
http://nginx.org/en/docs/http/ngx_http_realip_module.html
#configure编译时添加该配置
--with-http_realip_module
增加配置nginx.conf如下:
http{
set_real_ip_from 0.0.0.0/0;
real_ip_header X-Forwarded-For;
}
脚本:
#!/bin/bash
if [ ! -d /usr/local/share/GeoIP ];then
mkdir /usr/local/share/GeoIP
fi
wget -t 5 -O /tmp/GeoIP.dat.gz http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
wget -t 5 -O /tmp/GeoLiteCity.dat.gz http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gzip -df /tmp/GeoIP.dat.gz
gzip -df /tmp/GeoLiteCity.dat.gz
mv -f /tmp/Geo*.dat /usr/local/share/GeoIP/
添加到定时任务便可。
cd /usr/local/src/
wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz
tar -zxvf GeoIP.tar.gz
./configure
make
make install
#使用ldconfig将库索引到系统中
echo '/usr/local/lib' > /etc/ld.so.conf.d/geoip.conf
ldconfig
#检查库是否加载成功
ldconfig -v | grep GeoIP
#根据你当前 Nginx 的安装参数带上 –with-http_geoip_module 重新编译
#查看本地是否已有 GeoIP 数据库
cd /usr/local/share/GeoIP
#如果没有这两个库,则手动下载
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gzip -d GeoLiteCity.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gzip -d GeoIP.dat.gz
#将库地址配置到 nginx.conf 中http位置
geoip_country /usr/local/share/GeoIP/GeoIP.dat;
geoip_city /usr/local/share/GeoIP/GeoLiteCity.dat;
$geoip_country_code – 两个字母的国家代码,如:”RU”, “US”。
$geoip_country_code3 – 三个字母的国家代码,如:”RUS”, “USA”。
$geoip_country_name – 国家的完整名称,如:”Russian Federation”, “United States”(如果可用)。
$geoip_region – 地区的名称(类似于省,地区,州,行政区,联邦土地等),如:”Moscow City”, “DC”(如果可用)。
$geoip_city – 城市名称,如”Moscow”, “Washington”(如果可用)。
$geoip_postal_code – 邮政编码(如果可用)。
$geoip_city_continent_code(如果可用)。
$geoip_latitude – 所在维度(如果可用)。
$geoip_longitude – 所在经度(如果可用)。
这些数字代表的是中国省份地区~~
表如下:
CN,01,”Anhui”
CN,02,”Zhejiang”
CN,03,”Jiangxi”
CN,04,”Jiangsu”
CN,05,”Jilin”
CN,06,”Qinghai”
CN,07,”Fujian”
CN,08,”Heilongjiang”
CN,09,”Henan”
CN,10,”Hebei”
CN,11,”Hunan”
CN,12,”Hubei”
CN,13,”Xinjiang”
CN,14,”Xizang”
CN,15,”Gansu”
CN,16,”Guangxi”
CN,18,”Guizhou”
CN,19,”Liaoning”
CN,20,”Nei Mongol”
CN,21,”Ningxia”
CN,22,”Beijing”
CN,23,”Shanghai”
CN,24,”Shanxi”
CN,25,”Shandong”
CN,26,”Shaanxi”
CN,28,”Tianjin”
CN,29,”Yunnan”
CN,30,”Guangdong”
CN,31,”Hainan”
CN,32,”Sichuan”
CN,33,”Chongqing”
nginx lua安装
wget -c http://luajit.org/download/LuaJIT-2.0.4.tar.gz
tar xzvf LuaJIT-2.0.4.tar.gz
cd LuaJIT-2.0.4
make install PREFIX=/usr/local/luajit
#注意环境变量!
export LUAJIT_LIB=/usr/local/luajit/lib
export LUAJIT_INC=/usr/local/luajit/include/luajit-2.0
wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz
tar -xzvf v0.3.0.tar.gz
wget https://github.com/openresty/lua-nginx-module/archive/v0.10.8.tar.gz
tar -xzvf v0.10.8.tar.gz
wget http://nginx.org/download/nginx-1.10.3.tar.gz
tar -xzvf nginx-1.10.3.tar.gz
cd nginx-1.10.3
./configure --add-module=/usr/local/src/ngx_devel_kit-0.3.0 --add-module=/usr/local/src/lua-nginx-module-0.10.8
#注意ngx_devel_kit和lua-nginx-module以实际解压路径为准
make -j2
make install
ln -s /usr/local/luajit/lib/libluajit-5.1.so.2 /lib64/libluajit-5.1.so.2
需求:重定向访问地址www.geekapp.cn/test/到二级域名test.geekapp.cn
配置如下,亲测有效:
listen 80;
server_name www.geekapp.cn;
if ( $uri ~ "www.geekapp.cn/test/" ){
rewrite ^/(.*) http://test.geekapp.cn/ permanent;
break;
}
1、导入obj格式文件。
2、新建一个GameObject并添加MeshFilter和MeshRenderer部件
3、obj关联GameObject
Nginx配置网页只能指定浏览器访问,项目需求,网页只能在微信内置浏览器打开,非内置浏览器禁止打开。
2种思路:
1、Nginx判断UA只能微信打开,此方式无法避免伪造的UA。
location / {
if ( $http_user_agent !~ "MicroMessenger" ){
return 405;
}
}
2、使用微信内置的JS接口判断是否微信环境。
附:多条件判断指定mobile目录只能微信访问
location / {
set $flag 0;
if ( $uri ~ "/mobile/" ){
set $flag "${flag}1";
}
if ( $http_user_agent !~ "MicroMessenger" ){
set $flag "${flag}1";
}
if ($flag = "011"){
return 405;
}
}
VBoxManage setextradata “Android-4.3” CustomVideoMode1 “1280x720x16”
VBoxManage setextradata “Android-4.3” CustomVideoMode2 “1920x1280x16”
启动Android界面,按E键编辑,vga=ask查看可以看到刚刚添加的自定义分辨率
1、下载OpenCV3.4.1
https://docs.opencv.org/3.4.1.zip
2、下载并配置CMake,然后编译OpenCV
安装编译命令
cd opencv-3.4.1
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install
安装成功后目录
/usr/local/share/OpenCV/
CentOS时区在/etc/localtime中配置,可用时区列表在/usr/share/zoneinfo
修改时区文件
vi /usr/share/zoneinfo/Asia/Shanghai
修改最后结尾为:CST-8
软连接或copy时区文件
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
也可以直接覆盖
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
验证查看时间
date
设置好时区之后,使用ntp同步标准时间
yum install ntp
ntpdate pool.ntp.org
1、安装pjproject-2.7
官网下载:http://www.pjsip.org
2、安装SWIG
下载地址:http://www.swig.org/
老三步:configure/make/make install
3、安装jdk
4、安装python3
官网下载安装。
5、编译java和python库
cd pjproject-2.7/pjsip-apps/src/swig
make
make intall
遇到的坑:
1、编译时可能需要javac命令,默认的openjdk版本可能不包含,需要安装开发版的openjdk并配置java环境,已我的服务器为例:
yum install java-1.8.0-openjdk-devel.x86_64
2、配置环境变量
修改/etc/profile文件
如果你的计算机仅仅作为开发使用时推荐使用这种方法,因为所有用户的shell都有权使用这些环境变量,可能会给系统带来安全性问题。用文本编辑器打开/etc/profile在profile文件末尾加入:
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.144-0.b01.el6_9.x86_64/
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
3、重新登录
4、报错:swig: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory yum安装pcre命令:
yum install pcre
查找一下libpcre.so.1位置,我的在/usr/local/lib/目录中。
cd /usr/lib64
ln -s /usr/local/lib/libpcre.so.1
WIDTH为屏幕宽度,SPLIT_HEIGHT为Header或Footer高度,MAINBGCOLOR为修改的背景色。
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, SPLIT_HEIGHT)];
view.backgroundColor = MAINBGCOLOR;
return view;
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, SPLIT_HEIGHT)];
view.backgroundColor = MAINBGCOLOR;
return view;
}
java以指定编码格式读写文件工具类:
package cn.geekapp.utils;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
/**
* 文件读写类
*/
public class FileUtil {
/**
* 读取文件
* @param file
* @param charset
* @return
*/
public static String readFile(File file, String charset){
if(file == null)
return "";
if(!file.exists())
return "";
StringBuffer buffer = new StringBuffer();
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), charset));
String line = "";
while((line = reader.readLine()) != null){
buffer.append(line);
}
} catch (Exception e) {
// TODO: handle exception
System.out.println("readFile exception:"+e);
}finally{
try {
if(reader != null)
reader.close();
} catch (Exception e2) {
// TODO: handle exception
}
}
return buffer.toString();
}
/**
* 保存文件
* @param file
* @param content
* @param charset
* @return
*/
public static boolean saveFile(File file, String content, String charset){
if(file == null)
return false;
BufferedWriter writer = null;
boolean flag = false;
try {
if(!file.exists())
file.createNewFile();
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset));
writer.write(content);
writer.flush();
flag = true;
} catch (Exception e) {
// TODO: handle exception
System.out.println("readFile exception:"+e);
}finally{
try {
if(writer != null)
writer.close();
} catch (Exception e2) {
// TODO: handle exception
}
}
return flag;
}
}
原创内容转载请保留出处GEEK笔记(http://www.geekapp.cn/)。