Sign a ssl cert and renew by cronjob.
softwares:
- wget
- nginx
- nano
| // http://imweb.io/topic/59dc5a8b856028aa249e2a58 | |
| // https://segmentfault.com/a/1190000006930013 | |
| // 總之,IE真的是毒瘤... | |
| { | |
| "presets": [ | |
| ["es2015", | |
| { | |
| "loose": true | |
| }], | |
| "stage-0" |
| class Counting extends Array { | |
| constructor(...items) { | |
| if (items.length > 1) super(...items); | |
| else { | |
| super(); | |
| this.push(...items); | |
| } | |
| } | |
| swap(idx1, idx2) { | |
| const length = this.length; |
| /** | |
| * Remove html tag, css, js of html string to extract the contents | |
| * @param {String} html | |
| * @return {String} contents of the html | |
| */ | |
| function extractContents(html) { | |
| return html | |
| .replace(/(\n|\r|\t)/gm, '') // remove linebreaks | |
| .replace(/<(style|script|link|noscript).*?>.*?<\/(style|script|link|noscript)>/g, '') // remove css, js blocks | |
| .replace(/<!--.*?-->/g, '') // remove comments |
| function isBalanced(val) { | |
| if(val.length) { | |
| // strip off the nestest braces | |
| const replaced_val = replaceBraces(val); | |
| if(val === replaced_val) | |
| return 'NO'; | |
| else | |
| return isBalanced(replaced_val); | |
| } else { | |
| return 'YES'; |
| /** | |
| * Transform CSV to a 2D array | |
| * @param {String} csvString | |
| * @param {String} [separator=,] | |
| * | |
| */ | |
| function csvToArray(csvString, separator = ',') { | |
| const sRegExp = new RegExp(`(^"|${separator}"|{linebreak}")(.*?)("${separator}|"{linebreak}|"$)`, 'g'); // matching field contents | |
| return csvString | |
| .replace(/\r/g, '') // remove part of window linebreak symbols |
| /** | |
| * @param {Function} fn - The function wanted to be currified | |
| * @return {Function} a currified function | |
| */ | |
| function curry(fn) { | |
| return curryHelper(fn); | |
| } | |
| // private helper, not expose to client | |
| function curryHelper(fn, memory = [], ...args) { |
| 'use strict'; | |
| /** | |
| * Deep object flattener | |
| * flatten an object, the message will be pull out, array index/nested key will be chained to be a new key. | |
| * @param {object} obj - the target object | |
| * @param {string} [prefix = ''] - the prefix of each key | |
| * @return {object} flattened object | |
| */ | |
| function deepFlatten(obj, prefix = '') { |