Skip to content

Instantly share code, notes, and snippets.

@crazybugliu
crazybugliu / async-test.js
Created September 22, 2020 14:19
async to generater
async function a(n) {
let c = 0;
let s = 0;
while (c < n) {
c += 1;
let x = await c; // c 也可以是其他 promise
s += x;
console.log(s);
}
@crazybugliu
crazybugliu / skeleton-daemon.sh
Created March 11, 2020 06:29 — forked from shawnrice/skeleton-daemon.sh
A template to write a quick daemon as a bash script
#!/bin/sh
# This is a skeleton of a bash daemon. To use for yourself, just set the
# daemonName variable and then enter in the commands to run in the doCommands
# function. Modify the variables just below to fit your preference.
daemonName="DAEMON-NAME"
pidDir="."
pidFile="$pidDir/$daemonName.pid"
@crazybugliu
crazybugliu / kubernetes-filebeat.yaml
Created January 10, 2020 06:51 — forked from tkuther/kubernetes-filebeat.yaml
Filebeat kubernetes config with nginx module for ingress-nginx
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: filebeat
namespace: kube-system
labels:
k8s-app: filebeat
spec:
template:
metadata:
@crazybugliu
crazybugliu / mongodb-s3-backup.sh
Created January 6, 2020 08:37 — forked from eladnava/mongodb-s3-backup.sh
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
#!/bin/sh
# Make sure to:
# 1) Name this file `backup.sh` and place it in /home/ubuntu
# 2) Run sudo apt-get install awscli to install the AWSCLI
# 3) Run aws configure (enter s3-authorized IAM user and specify region)
# 4) Fill in DB host + name
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket)
# 6) Run chmod +x backup.sh
# 7) Test it out via ./backup.sh

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@crazybugliu
crazybugliu / 0_reuse_code.js
Created September 21, 2016 09:16
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
@crazybugliu
crazybugliu / Js-spark-md5.usage.js
Last active June 3, 2016 13:58
Js-spark-md5 的一种使用方式 可以配合drop-zone使用
function getFileMd5 ( file ) {
var dfd = jQuery.Deferred();
/**
* reference:
* https://github.com/satazor/SparkMD5
*/
var blobSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice,
chunkSize = 2097152, // Read in chunks of 2MB
chunks = Math.ceil(file.size / chunkSize),
currentChunk = 0,

Package Control Messages

Anaconda

Anaconda

Anaconda turns your Sublime Text 3 into a full featured Python IDE. Read the plugin documentation on http://damnwidget.github.io/anaconda.

Book Status

开发问题

框架和设计问题

AppManage 不需要和AppCenter那样依赖那么多工程和jar包

各个组件(工程)减少互相依赖, 如:Hibernate的Mapping文件不要都放在com.dist.define工程下,使得一旦引用了define,其他没必要的工程也要引用 建议放在各个模块内部或者是按层划分 com.dist.dap.define、com.dist.smartplan.define、com.dist.project.define