Skip to content

Instantly share code, notes, and snippets.

@leegcc
leegcc / nginx.conf
Created August 24, 2020 05:50 — forked from fotock/nginx.conf
Nginx SSL 安全配置最佳实践.
# 生成 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
@leegcc
leegcc / Amount2RMB.java
Created May 18, 2020 06:48 — forked from binjoo/Amount2RMB.java
JAVA:字符串金额转成中文大写
/*
* 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 =
@leegcc
leegcc / heartbleed.py
Created February 7, 2018 16:49 — forked from eelsivart/heartbleed.py
Heartbleed (CVE-2014-0160) Test & Exploit Python Script
#!/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)
# coding: utf-8
import os
import shutil
import time
import math
from PIL import Image, ImageDraw
import random
# === 思路 ===
@leegcc
leegcc / 1. Install Redis
Created June 20, 2017 16:00 — forked from pbolduc/1. Install Redis
Install redis on CentOS 7
# 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
@leegcc
leegcc / oracle2mysql.sed
Created September 10, 2016 16:11 — forked from jabley/oracle2mysql.sed
Help convert Oracle DDL to MySQL
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)/
@leegcc
leegcc / treeify.js
Created June 23, 2016 16:06
扁平结构转树形结构
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 = [];
const AsciiTable = require("ascii-table");
class LuckyDraw {
constructor(gifts) {
this.gifts = gifts;
}
analyzeOdds() {
const totalOfPriority = this.gifts.reduce((memo, gift) => memo + gift.priority, 0);