Skip to content

Instantly share code, notes, and snippets.

@hashmaparraylist
hashmaparraylist / deploy_modules.sh
Created February 22, 2023 06:29
获取pom.xml中所有module
#!/bin/bash
read_dom () {
#local IFS=\>
#read -d \< ENTITY CONTENT
local IFS=\>
read -d \< ENTITY CONTENT
local ret=$?
TAG_NAME=${ENTITY%% *}
ATTRIBUTES=${ENTITY#* }
@hashmaparraylist
hashmaparraylist / default.conf
Created November 29, 2021 09:14
Nginx方向代理
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;
@hashmaparraylist
hashmaparraylist / nginx.conf
Created February 23, 2018 03:12 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@hashmaparraylist
hashmaparraylist / git_tips.sh
Created February 25, 2017 11:06
重置本地修改的git命令
# 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):
@hashmaparraylist
hashmaparraylist / .vimrc
Created November 22, 2016 07:55
linux 服务器最小.vimrc
" 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
@hashmaparraylist
hashmaparraylist / add_user.sql
Last active August 10, 2016 08:25
create root user on mysql
-- 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';
@hashmaparraylist
hashmaparraylist / sort.js
Created May 30, 2016 07:07
各种排序算法
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];
@hashmaparraylist
hashmaparraylist / hashString.js
Last active May 25, 2016 08:57
use node.js hash string. support sha1, md5 etc. `openssl list-message-digest-algorithms` will display the available digest algorithms.
let crypto = require('crypto');
function hashString(algorithm, string) {
return crypto.createHash(algorithm).update(string).digest('hex');
};
@hashmaparraylist
hashmaparraylist / todo.sh
Last active February 11, 2017 13:40
ubuntu 环境架构 常用shell
# 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
@hashmaparraylist
hashmaparraylist / db.createUser.js
Created January 6, 2016 15:44
mongodb create user
db.createUser({
createUser: "<name>",
pwd: "<cleartext password>",
customData: { <any information> },
roles: [
{ role: "dbOwner", db: "demo" }
]
});