战狼1. 爱奇艺有
战狼2.测试地址,随时会关闭,请下载后观看
//tb-video.bdstatic.com/tieba-movideo/698079258_65ccd3464a7270292f4725ba795978f8_22231026.mp4
deepxl 8月 19th, 2017
Posted In: live knowledge(生活知识)
编程大锅菜(1)
说实话从自己上大学接触编程到现在,在这个行业里面也混当了9个年头了,断断续续,分分合合,已经发生了很多情结了,每个人的经历不一样,也就导致了他自己对生活或事情的认识也不一样。不管怎么样,干干净净的来到这个世上,有些混混沌沌的离开了,有些人开开心心的离开了,有人很不情愿的离开了,更有来不及道别的离开。相见时难别亦难,合分都是缘,重在过程嘛。很多事都是通的,就比如你现在想学的这个编程,不一定非要学成大牛,当然学成大牛更好,但态度要认清楚,不是每个人都是电量100%的噢,5%可以开机,20%跳过低电量模式,可以正常流畅的运行,以后加足马力让自己更长久,就修行在个人了。
本文开始我们的5%认识。当然如果你已经是大牛或着早已超过20%,好奇本文的话,就大列预览一下,不喜勿喷!!!
事不过三,我比较喜欢把事情努力归类三类,比较喜欢三点,感觉在划分细就记不住了。好了,我把编程语言都安以下划分学习。
*** 类型
* 实类型
* 复合类型
* 自定义
*** 函数方法
* 默认系统方法
* 引入方法
* 自定义**
*** 类
* 默认系统类
* 自定义
**
* 程序架构布局等。**
我记得我刚开始接触的是在大学时候学的C语言,其次是C#,后来老师讲了几节的java,在后来讲html Web开发,在学习.net 网页,快毕业的时候又顺便讲了javascript目的是为了毕业设计。这是大学的认识编程的路程。
毕业后去了吉林的一家单位实习了几个月,那时候感觉很有成就感,做了一个系统类型的软件,现在想起来就呵呵了,好像实习单位给我们一人200快钱,完后包吃住什么的,那时候有几个感觉很牛的工程师来指导我们,我们也会偶然问问问题,一般都是有实现不了的了让人家看代码,人家在电脑前帮我们改一些代码,我们一群人围着看,后面有个同学啪啪的拍照,不过后来也有个感觉很牛的人,我问过一个关于菜单上的问题,他只是给我们提示了一些建议,他站在那半歪着头,说着,我们围着他听着,记得很清楚,完后,完后我就安装他的思路几天后就实现了,等他们在过来,我们演示给他看我们的实现效果,那几个工程师不断的看,完后在点击点击,隔壁那组和我们做着一样系统的也都过来看了,不停的说好,完后那个工程师看了一下我们的代码,也许他已经忘记了那是他指导的思路了。就这点代码,其它组想看我们组的代码,我们组还没给他们看了,也没告诉他们,怕他们组超过我们,后来被打了小报告,我们的美女老师还顺带着批评了我们一下。就这样几个月过去了,等项目验收的时候也是让我们几个组挨个的上去演示了一下,下午风尘仆仆的就返校了。一个都没有把我们留下。其实这只是实习单位与我们学校的一个演习而已。
deepxl 4月 26th, 2017
Posted In: 编程大锅菜
###在亚马孙EC2上构建L2TP VPN (Setup L2TP over IPSec VPN on Ubuntu Linux with Amazon EC2)
由于各种原因本人还是喜欢用自己搭建的服务器上外国的网站。以前经常用PPTP上网,方便配置又简单。但无奈苹果MAC升级10.12 和 IOS 10.02 之后直接去掉PPTP的VPN链接方式,但我又喜欢用系统原生的VPN不想安装什么其它辅助软件,还是动手更新新的VPN方式吧。
废话少说看步骤。
$ sudo apt-get install openswan xl2tpd ppp
打开UDP上端口 500,1701,4500,
Open UDP ports 500, 1701, 4500 for public access.
$ sudo vi /etc/ipsec.conf
# /etc/ipsec.conf - Openswan IPsec configuration file
# This file: /usr/share/doc/openswan/ipsec.conf-sample
#
# Manual: ipsec.conf.5
version 2.0 # conforms to second version of ipsec.conf specification
# basic configuration
config setup
# Do not set debug options to debug configuration issues!
# plutodebug / klipsdebug = "all", "none" or a combation from below:
# "raw crypt parsing emitting control klips pfkey natt x509 dpd private"
# eg:
# plutodebug="control parsing"
# Again: only enable plutodebug or klipsdebug when asked by a developer
#
# enable to get logs per-peer
# plutoopts="--perpeerlog"
#
# Enable core dumps (might require system changes, like ulimit -C)
# This is required for abrtd to work properly
# Note: incorrect SElinux policies might prevent pluto writing the core
dumpdir=/var/run/pluto/
#
# NAT-TRAVERSAL support, see README.NAT-Traversal
nat_traversal=yes
# exclude networks used on server side by adding %v4:!a.b.c.0/24
# It seems that T-Mobile in the US and Rogers/Fido in Canada are
# using 25/8 as "private" address space on their 3G network.
# This range has not been announced via BGP (at least upto 2010-12-21)
virtual_private=%v4:10.0.0.0/8,%v4:192.168.0.0/16,%v4:172.16.0.0/12,%v4:25.0.0.0/8,%v6:fd00::/8,%v6:fe80::/10
# OE is now off by default. Uncomment and change to on, to enable.
oe=off
# which IPsec stack to use. auto will try netkey, then klips then mast
protostack=netkey
# Use this to log to a file, or disable logging on embedded systems (like openwrt)
#plutostderrlog=/dev/null
# Add connections here
# sample VPN connection
# for more examples, see /etc/ipsec.d/examples/
#conn sample
# # Left security gateway, subnet behind it, nexthop toward right.
# left=10.0.0.1
# leftsubnet=172.16.0.0/24
# leftnexthop=10.22.33.44
# # Right security gateway, subnet behind it, nexthop toward left.
# right=10.12.12.1
# rightsubnet=192.168.0.0/24
# rightnexthop=10.101.102.103
# # To authorize this connection, but not actually start it,
# # at startup, uncomment this.
# #auto=add
#conn L2TP-PSK-NAT
# rightsubnet=vhost:%priv
# also=L2TP-PSK-noNAT
conn L2TP-PSK-noNAT
#
# Configuration for one user with any type of IPsec/L2TP client
# including the updated Windows 2000/XP (MS KB Q818043), but
# excluding the non-updated Windows 2000/XP.
#
#
# Use a Preshared Key. Disable Perfect Forward Secrecy.
#
# PreSharedSecret needs to be specified in /etc/ipsec.secrets as
# YourIPAddress %any: "sharedsecret"
authby=secret
pfs=no
auto=add
keyingtries=3
# we cannot rekey for %any, let client rekey
rekey=no
# Apple iOS doesn't send delete notify so we need dead peer detection
# to detect vanishing clients
dpddelay=10
dpdtimeout=90
dpdaction=clear
# Set ikelifetime and keylife to same defaults windows has
ikelifetime=8h
keylife=1h
# l2tp-over-ipsec is transport mode
type=transport
#
left=YOUR.SERVER.IP.ADDRESS #AWS EC2 Internal IP
#
# For updated Windows 2000/XP clients,
# to support old clients as well, use leftprotoport=17/%any
leftprotoport=17/1701
#
# The remote user.
#
right=%any
# Using the magic port of "%any" means "any one single port". This is
# a work around required for Apple OSX clients that use a randomly
# high port.
rightprotoport=17/%any
forceencaps=yes
$ vi /etc/ipsec.secrets
# This file holds shared secrets or RSA private keys for inter-Pluto
# authentication. See ipsec_pluto(8) manpage, and HTML documentation.
# RSA private key for this host, authenticating it to any other host
# which knows the public part. Suitable public keys, for ipsec.conf, DNS,
# or configuration of other implementations, can be extracted conveniently
# with "ipsec showhostkey".
# AWS EC2 Internal IP
YOUR.SERVER.IP.ADDRESS %any: PSK "YourSharedSecrets"
# this file is managed with debconf and will contain the automatically created RSA keys
#include /var/lib/openswan/ipsec.secrets.inc
$ service ipsec restart
$ vi /etc/xl2tpd/xl2tpd.conf
;
; Sample l2tpd configuration file
;
; This example file should give you some idea of how the options for l2tpd
; should work. The best place to look for a list of all options is in
; the source code itself, until I have the time to write better documetation :)
; Specifically, the file "file.c" contains a list of commands at the end.
;
; You most definitely don't have to spell out everything as it is done here
;
[global] ; Global parameters:
ipsec saref = yes
; port = 1701 ; * Bind to port 1701
; auth file = /etc/l2tpd/l2tp-secrets ; * Where our challenge secrets are
; access control = yes ; * Refuse connections without IP match
; rand source = dev ; Source for entropy for random
; ; numbers, options are:
; ; dev - reads of /dev/urandom
; ; sys - uses rand()
; ; egd - reads from egd socket
; ; egd is not yet implemented
;
[lns default] ; Our fallthrough LNS definition
; exclusive = no ; * Only permit one tunnel per host
; ip range = 192.168.0.1-192.168.0.20 ; * Allocate from this IP range
ip range = 10.1.2.2-10.1.2.255
local ip = 10.1.2.1
refuse chap = yes
refuse pap = yes
require authentication = yes
ppp debug = yes
pppoptfile = /etc/ppp/options.xl2tpd
length bit = yes
; no ip range = 192.168.0.3-192.168.0.9 ; * Except these hosts
; ip range = 192.168.0.5 ; * But this one is okay
; ip range = lac1-lac2 ; * And anything from lac1 to lac2's IP
; lac = 192.168.1.4 - 192.168.1.8 ; * These can connect as LAC's
; no lac = untrusted.marko.net ; * This guy can't connect
; hidden bit = no ; * Use hidden AVP's?
; local ip = 192.168.1.2 ; * Our local IP to use
; length bit = yes ; * Use length bit in payload?
; require chap = yes ; * Require CHAP auth. by peer
; refuse pap = yes ; * Refuse PAP authentication
; refuse chap = no ; * Refuse CHAP authentication
; refuse authentication = no ; * Refuse authentication altogether
; require authentication = yes ; * Require peer to authenticate
; unix authentication = no ; * Use /etc/passwd for auth.
; name = myhostname ; * Report this as our hostname
; ppp debug = no ; * Turn on PPP debugging
; pppoptfile = /etc/ppp/options.l2tpd.lns ; * ppp options file
; call rws = 10 ; * RWS for call (-1 is valid)
; tunnel rws = 4 ; * RWS for tunnel (must be > 0)
; flow bit = yes ; * Include sequence numbers
; challenge = yes ; * Challenge authenticate peer ;
; rx bps = 10000000 ; Receive tunnel speed
; tx bps = 10000000 ; Transmit tunnel speed
; bps = 100000 ; Define both receive and transmit speed in one option
; [lac marko] ; Example VPN LAC definition
; lns = lns.marko.net ; * Who is our LNS?
; lns = lns2.marko.net ; * A backup LNS (not yet used)
; redial = yes ; * Redial if disconnected?
; redial timeout = 15 ; * Wait n seconds between redials
; max redials = 5 ; * Give up after n consecutive failures
; hidden bit = yes ; * User hidden AVP's?
; local ip = 192.168.1.1 ; * Force peer to use this IP for us
; remote ip = 192.168.1.2 ; * Force peer to use this as their IP
; length bit = no ; * Use length bit in payload?
; require pap = no ; * Require PAP auth. by peer
; require chap = yes ; * Require CHAP auth. by peer
; refuse pap = yes ; * Refuse PAP authentication
; refuse chap = no ; * Refuse CHAP authentication
; refuse authentication = no ; * Refuse authentication altogether
; require authentication = yes ; * Require peer to authenticate
; name = marko ; * Report this as our hostname
; ppp debug = no ; * Turn on PPP debugging
; pppoptfile = /etc/ppp/options.l2tpd.marko ; * ppp options file for this lac
; call rws = 10 ; * RWS for call (-1 is valid)
; tunnel rws = 4 ; * RWS for tunnel (must be > 0)
; flow bit = yes ; * Include sequence numbers
; challenge = yes ; * Challenge authenticate peer
;
; [lac cisco] ; Another quick LAC
; lns = cisco.marko.net ; * Required, but can take from default
; require authentication = yes
$ service xl2tpd restart
$ sudo vi /etc/ppp/options.xl2tpd
require-mschap-v2
refuse-mschap
ms-dns 8.8.8.8
ms-dns 8.8.4.4
auth
mtu 1200
mru 1000
crtscts
hide-password
modem
name l2tpd
proxyarp
lcp-echo-interval 30
lcp-echo-failure 4
$ sudo vi /etc/ppp/pap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
username l2tpd password *
$ sudo iptables --table nat --append POSTROUTING --jump MASQUERADE
保存iptable Save current iptables:
$ sudo apt-get install iptables-persistent
$ sudo vi /etc/sysctl.conf
增加下面的行到sysctl.conf: Add the following lines to sysctl.conf:
net.ipv4.ip_forward = 1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0
应用改变, Apply changes:
$ sudo sysctl -p
$ tail -f /var/log/auth.log
#####⚠️注意要吧 YOUR.SERVER.IP.ADDRESS 改成EC2的内网IP
可以用ifconfig 查看eth0的地址
form: http://tanshuai.com/l2tp-over-ipsec-vpn-ubuntu-linux-aws-ec2/
deepxl 10月 20th, 2016
Posted In: computer knowledge(电脑知识)
/etc/webmin/miniserv.conf
ssl=0
/etc/init.d/webmin restart
或者
service webmin restart
选择你可以用 http://你服务器IP:10000来访问了
参考:https://techjourney.net/disable-https-ssl-for-virtualmin-webmin-miniserv/
admin 7月 29th, 2016
Posted In: computer knowledge(电脑知识)
最近做项目遇到一个问题是,当UIWebView加载的网页中图片少的时候还可以正常响应,加载多了,网页里面的JS响应的特别慢,经过多次尝试是下面语句调用的非常慢:
- (void)webViewDidFinishLoad:(UIWebView *)webView
从而导致下面这几句javascript桥的注册函数调用慢而响应的慢:
NSString *filePath = [bundle pathForResource:@"WebViewJavascriptBridge.js" ofType:@"txt"];NSString *js = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
[webView stringByEvaluatingJavaScriptFromString:js];
于是改为本bridge的js直接引入到网页当中:
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"WebViewJavascriptBridge.js" ofType:@"txt"];NSString *js = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
// webview load html string .....
@"\n<script type=\"text/javascript\"> %@; dosomethingbyjavascribebridge(); </script>\n"
OK,几天的烦恼终于解决了
deepxl 7月 8th, 2016
Posted In: IOS开发短笔记