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
function treeify(/*Array*/ flatItems) { | |
var tree = [], index = {}; | |
flatItems.forEach(function (item) { | |
var nodes; | |
if(item.parent){ | |
var parentNode = index[item.parent]; | |
if(!parentNode.nodes){ | |
parentNode.nodes = []; |
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
const AsciiTable = require("ascii-table"); | |
class LuckyDraw { | |
constructor(gifts) { | |
this.gifts = gifts; | |
} | |
analyzeOdds() { | |
const totalOfPriority = this.gifts.reduce((memo, gift) => memo + gift.priority, 0); |
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
s/NUMBER(22,0)/BIGINT/ | |
s/NUMBER(9,0)/INT/ | |
s/NUMBER(8,0)/INT/ | |
s/NUMBER(6,0)/MEDIUMINT/ | |
s/NUMBER(5,0)/SMALLINT/ | |
s/NUMBER(3,0)/TINYINT/ | |
s/NUMBER(2,0)/TINYINT/ | |
s/NUMBER(1,0)/BIT/ | |
s/NUMBER(16,2)/DECIMAL(16,2)/ | |
s/NUMBER(11,2)/DECIMAL(11,2)/ |
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
# see How to Install Redis Server on CentOS 7 - http://linoxide.com/storage/install-redis-server-centos-7/ | |
# --- Compiling --- | |
$ yum install gcc make tcl | |
$ REDIS_VER=3.2.3 | |
$ wget http://download.redis.io/releases/redis-$REDIS_VER.tar.gz | |
$ tar xzvf redis-$REDIS_VER.tar.gz | |
$ cd redis-$REDIS_VER | |
$ make | |
$ make test |
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
# coding: utf-8 | |
import os | |
import shutil | |
import time | |
import math | |
from PIL import Image, ImageDraw | |
import random | |
# === 思路 === |
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
#!/usr/bin/python | |
# Modified by Travis Lee | |
# Last Updated: 4/21/14 | |
# Version 1.16 | |
# | |
# -changed output to display text only instead of hexdump and made it easier to read | |
# -added option to specify number of times to connect to server (to get more data) | |
# -added option to send STARTTLS command for use with SMTP/POP/IMAP/FTP/etc... | |
# -added option to specify an input file of multiple hosts, line delimited, with or without a port specified (host:port) |
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
/* | |
* Amount2RMB.java 2008-6-15 | |
*/ | |
package test; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public class Amount2RMB { | |
private static final Pattern AMOUNT_PATTERN = |
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
# 生成 dhparam.pem 文件, 在命令行执行任一方法: | |
# 方法1: 很慢 | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 | |
# 方法2: 较快 | |
# 与方法1无明显区别. 2048位也足够用, 4096更强 | |
openssl dhparam -dsaparam -out /etc/nginx/ssl/dhparam.pem 4096 |