This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
read_dom () { | |
#local IFS=\> | |
#read -d \< ENTITY CONTENT | |
local IFS=\> | |
read -d \< ENTITY CONTENT | |
local ret=$? | |
TAG_NAME=${ENTITY%% *} | |
ATTRIBUTES=${ENTITY#* } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server | |
{ | |
listen 80 default; | |
server_name _; | |
index index.html index.htm index.php; | |
root /data/httpd/; | |
location ^~ /ms/b/ { | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you want to revert changes made to your working copy, do this: | |
git checkout . | |
# If you want to revert changes made to the index (i.e., that you have added), do this. Warning this will reset all of your unpushed commits to master!: | |
git reset | |
#If you want to revert a change that you have committed, do this: | |
git revert <commit 1> <commit 2> | |
# If you want to remove untracked files (e.g., new files, generated files): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Get out of VI's compatible mode | |
set nocompatible | |
" Set how many lines of history VIM to remember | |
set history=400 | |
" Enable filetype plugin | |
filetype plugin on | |
filetype indent on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- create a root user at 192.168.11.0/24 | |
CREATE USER 'root'@'192.168.11.%' IDENTIFIED BY 'some_pass'; | |
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; | |
-- create a replication user | |
CREATE USER repl_user; | |
GRANT REPLICATION SLAVE ON *.* TO repl_user IDENTIFIED BY 'some_pass'; | |
-- start reolication on slave | |
CHANGE MASTER TO MASTER_HOST = 'master', MASTER_PORT = 3306, MASTER_USER = 'repl_user', MASTER_PASSWORD = 'some_pass'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var defaultComparator = function (a, b) { | |
return a > b; | |
}; | |
// 冒泡排序 | |
var bubbleSort = function(arr, comparator) { | |
for(var i = 0; i < arr.length; i++) { | |
for (var j = 0; j < arr.length - i; j++) { | |
if (comparator(arr[j], arr[j + 1])) { | |
var temp = arr[j]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let crypto = require('crypto'); | |
function hashString(algorithm, string) { | |
return crypto.createHash(algorithm).update(string).digest('hex'); | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# update ubuntu source | |
sudo apt-get update | |
# add sudo user | |
sudo adduser username | |
sudo adduser username sudo | |
# install nvm | |
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.createUser({ | |
createUser: "<name>", | |
pwd: "<cleartext password>", | |
customData: { <any information> }, | |
roles: [ | |
{ role: "dbOwner", db: "demo" } | |
] | |
}); |
NewerOlder