Skip to content

Instantly share code, notes, and snippets.

@cloudy9101
cloudy9101 / node-v8-max-old-space-size.md
Last active December 23, 2020 05:51 — forked from tjunghans/node-v8-max-old-space-size.md
Node V8 max-old-space-size

Node V8 Option max-old-space-size

Problem

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed — Javascript process out of memory

This error occurs when the memory allocated for the execution application is less than the required memory when run application. By default the memory limit in Node.js is 512 mb, to solve this issue you need to increasing the memory limit use command —- max-old-space-size .It can be avoid the memory limit issue.

Command line

@cloudy9101
cloudy9101 / nginx.conf
Created January 20, 2016 04:42 — 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
@cloudy9101
cloudy9101 / lucky_draw.rb
Last active January 13, 2016 03:14
lucky_draw
require 'date'
current_path = File.expand_path(File.dirname(__FILE__))
# 获得参与抽奖的用户 users
def get_users file
users = []
File.open(file) do |f|
f.readlines.each do |line|
users << line.sub(/\n/, '').split(',')
The sequence of Hamming numbers 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24, 25, 27, 30, 32, 36......
Axiom 1: The value 1 is in the sequence.
Axiom 2: If x is in the sequence, so are 2 * x, 3 * x, and 5 * x.
Axiom 3: The sequence contains no other values other than those that belong to it on account of Axioms 1 and 2.
写一个方法 hamming(n), 返回hamming number序列(升序排列)中的第n个数 (要求输入5000能得出正确结果,并且不超时)
@cloudy9101
cloudy9101 / gist:6c5a724c609e9e79c198
Created April 1, 2015 10:47
每日一题 2015.4.1
secret_1 = "whatisup"
triplets_1 = [
['t','u','p'],
['w','h','i'],
['t','s','u'],
['a','t','s'],
['h','a','p'],
['t','i','s'],
['w','h','s']
]