Skip to content

Instantly share code, notes, and snippets.

View xuanyuanaosheng's full-sized avatar

xuanyuanaosheng xuanyuanaosheng

View GitHub Profile

#JavaScript第三次记录整理

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

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

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

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

#JavaScript第五次记录整理

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

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

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

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

@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
@xuanyuanaosheng
xuanyuanaosheng / js_index.md
Created April 13, 2016 06:27 — forked from quietlynn/js_index.md
JavaScript交流记录索引

测试平台: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 / 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')
@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 / compild.py
Created August 24, 2016 09:54 — forked from alex-1q84/compild.py
使用python的sched和Timer执行定时任务
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sched, time
from threading import Thread, Timer
import subprocess
s = sched.scheduler(time.time, time.sleep)
class Job(Thread):
@xuanyuanaosheng
xuanyuanaosheng / mysql2sqlite.sh
Created October 22, 2016 04:38 — forked from esperlu/mysql2sqlite.sh
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@xuanyuanaosheng
xuanyuanaosheng / ss-go_att.py
Created November 28, 2016 03:35
Shadowsocks-go attack
#!/usr/bin/env python
#-*- coding: utf-8 -*-
'''
Copyleft (c) 2016 breakwa11
https://github.com/breakwa11/shadowsocks-rss
'''
import socket
import traceback