yum install ntp
chkconfig ntpd on
ntpdate pool.ntp.org
service ntpd start
This file contains hidden or 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
class LRUCache { | |
constructor(size) { | |
this.size = size; | |
this.cache = new Map(); | |
} | |
put(key, value) { | |
const { cache, size } = this; | |
if(cache.has(key)) { | |
cache.delete(key); |
This file contains hidden or 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 curry(fn) { | |
var res; | |
function curried() { | |
args = [].slice.call(arguments); | |
if (!res && args.length == fn.length) { | |
res = fn.apply(this, args); | |
return curried; | |
} else if (!res && args.length > fn.length) { | |
res = fn.apply(this, args); |
This file contains hidden or 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 fetchData(x) { | |
return new Promise((resolve, reject) => { | |
// mock | |
if (x == 3 || x == 4 || x == 5) { | |
reject('error'); | |
} else { | |
resolve(x); | |
} | |
}); | |
} |
This file contains hidden or 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 to64bitFloat(number) { | |
var i, result = ""; | |
var dv = new DataView(new ArrayBuffer(8)); | |
dv.setFloat64(0, number, false); | |
for (i = 0; i < 8; i++) { | |
var bits = dv.getUint8(i).toString(2); | |
if (bits.length < 8) { | |
bits = new Array(8 - bits.length).fill('0').join("") + bits; |
This file contains hidden or 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
.scroll-wrapper { | |
-webkit-overflow-scrolling: touch !important; | |
overflow-y: scroll !important; | |
position: fixed; | |
right: 0; | |
bottom: 0; | |
left: 0; | |
top: 0; | |
} |
export NVM_NODEJS_ORG_MIRROR=http://nodejs.org/dist
This file contains hidden or 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
server { | |
server_name gist.github.com | |
root /usr/share/gist; | |
index index.html | |
location / { | |
try_files $uri $uri/ =404; | |
} | |
location /avenger/ { |
This file contains hidden or 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
'use strict'; | |
const later = require('later'); | |
const logger = require('./logger')('guard'); | |
const pm2 = require('pm2'); | |
const schedule = later.parse.recur().every(10).second(); | |
// set local timezone | |
later.date.localTime(); |
NewerOlder