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
// 高精度定时器,interval为毫秒 | |
function myTimer(callback, interval) { | |
function getTime() { | |
return process.uptime() * 1000; | |
} | |
let previous = getTime(); | |
setInterval(function() { | |
const now = getTime(); | |
if (now - previous >= interval) { | |
previous = now; |
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
{ | |
"name": "cookie example", | |
"version": "1.0.0", | |
"main": "index.js", | |
"license": "MIT", | |
"dependencies": { | |
"connect-redis": "^3.3.3", | |
"cookie-parser": "^1.4.3", | |
"express": "^4.16.2", | |
"express-session": "^1.15.6" |
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 createPromiseCallback() { | |
const callback = (err, ret) => { | |
if (err) { | |
callback.reject(err); | |
} else { | |
callback.resolve(ret); | |
} | |
}; | |
callback.promise = new Promise((resolve, reject) => { | |
callback.resolve = resolve; |
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
html, body { | |
font-family: "Biaodian Pro Sans CNS","Helvetica Neue",Helvetica,Arial,"Zhuyin Heiti","Han Heiti",sans-serif; | |
-webkit-font-smoothing: subpixel-antialiased; | |
line-height: 1.7; | |
word-break: break-word; | |
color: #333; | |
background-color: #f3f2ee; | |
} |
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 httpRequest = require("http").request; | |
const httpsRequest = require("https").request; | |
const parseUrl = require("url").parse; | |
const connect = require("connect"); | |
const colors = require("colors"); | |
const PORT = Number(process.env.PORT || 6666); | |
const REGISTRY_CDN = | |
process.env.REGISTRY_CDN || "https://registry.npm.taobao.org"; | |
const REGISTRY_PRIVATE = |
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
package main | |
import ( | |
"fmt" | |
"io" | |
"log" | |
"net/http" | |
"net/url" | |
"time" | |
) |
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
#!/bin/sh | |
echo "start msfrpcd..." | |
pkill msf | |
msfrpcd -U msf -P msf -f -S -a 127.0.0.1 & | |
echo "wait..." | |
sleep 20 | |
echo "start armitage..." | |
export MSF_DATABASE_CONFIG=~/.msf4/database.yml | |
armitage & |
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
/** | |
* 检查密码是否符合规则,如果符合规则返回true | |
* @param {string} pwd | |
* @return {boolean} | |
*/ | |
function check(pwd) { | |
return ( | |
notSeries(pwd, "1234567890", 3) && | |
notSeries(pwd, "abcdefghijklmnopqrstuvwxyz", 3) && | |
notSeries(pwd, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 3) && |
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
import * as immutable from 'immutable'; | |
export type State = immutable.Map<string, any>; | |
export type Listener = () => void; | |
export const LISTENER_ALL = '@@@@ALL'; | |
export class Store { | |
protected state: State; |
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
package main | |
import ( | |
"fmt" | |
"encoding/json" | |
"github.com/mitchellh/mapstructure" | |
) | |
type A struct { |