Skip to content

Instantly share code, notes, and snippets.

View xuanyuanaosheng's full-sized avatar

xuanyuanaosheng xuanyuanaosheng

View GitHub Profile
@xuanyuanaosheng
xuanyuanaosheng / file_path_test.sh
Created June 30, 2016 01:55 — forked from feng-ming/file_path_test.sh
unix shell 判断目录/文件是否存在, 以及是否有读写权限。
shell判断文件,目录是否存在或者具有权限
#!/bin/sh
Path="/var/log/httpd/"
File="/var/log/httpd/access.log"
#这里的-x 参数判断$Path是否存在并且是否具有可执行权限
if [ ! -x "$Path"]; then
mkdir "$Path"
fi
@xuanyuanaosheng
xuanyuanaosheng / gelfsender.sh
Created June 21, 2016 09:21 — forked from gm3dmo/gelfsender.sh
Send a log message to a gelf server using the shell.
# This script can be used to raise a graylog2/gelf message
# gzip it and send it to a graylog server using netcat (nc)
hostname='gelftester'
short_message='test message short version'
full_message='longer test message. dont\n worry be happy'
level=1
facility='gelftester'
# gnu date
date=$(date +'%s.%N')

测试平台:DigitalOcean VPS ubuntu14.04 x64, strongswan5.2.2

运行以下命令请使用root权限

一:安装strongswan

由于ubuntu软件仓库中strongswan版本较低,因此从官网源码编译安装

apt-get install build-essential     #编译环境
aptitude install libgmp10 libgmp3-dev libssl-dev pkg-config libpcsclite-dev libpam0g-dev     #编译所需要的软件
@xuanyuanaosheng
xuanyuanaosheng / js_index.md
Created April 13, 2016 06:27 — forked from quietlynn/js_index.md
JavaScript交流记录索引
@xuanyuanaosheng
xuanyuanaosheng / 0_reuse_code.js
Created February 16, 2016 01:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

#JavaScript第五次记录整理

###关于上次函数的复习

对象的属性也可以是一个函数,比如 var a = {b: 9, c: function () {} };

这里 a.c 就是一个函数,对象的函数称为方法。其实没什么特殊的,只不过是一个属性而已.

不过呢,JS语言规定,在以 a.c() 这种形式调用函数时,在函数c调用过程中设置 this 变量为 a.

#JavaScript第三次记录整理

作业地址传送门 ##一.数组

上次交流的时候,我们讨论过JS的两个基本类型,Number和String类型,分别表示数和字符串。

但是只有 Number 和 String 类型是不够的。表示更加复杂的类型则需要数组(Array)和对象(Object)。

先讲数组。一个数组类似于一个列表,可以储存多个JS的类型值。