Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

e.e.p coolicer

View GitHub Profile
View bluebird-download.js
/*
* bluebird 顺序批量下载
*/
const Promise = require("bluebird");
const cmd = require('node-cmd');
const cmdRuner = Promise.promisify(cmd.get, { multiArgs: true, context: cmd });
let arr = [];
const makePromise = function(i) {
return new Promise((resolve, reject) => {
@coolicer
coolicer / rename.js
Last active Apr 8, 2018
rename file
View rename.js
const fs = require('fs'), path = require('path')
fs.readdirSync('./').filter(item => item.indexOf('.png') > 0)
.forEach((item, index) => {
let newItem = item.replace(/\.\w+\./, '.')
fs.renameSync(path.join(__dirname, item), path.join(__dirname, newItem))
})
View baidu_ocr_nodejs.js
const Koa = require('koa');
const Router = require('koa-router');
const static = require('koa-static')
const nunjucks = require('koa-nunjucks-2');
const multer = require('koa-multer');
const path = require('path');
const fs = require('fs');
const app = new Koa();
const router = new Router();
const AipOcrClient = require("baidu-aip-sdk").ocr;
View koa-upload-file.js
const Koa = require('koa');
const Router = require('koa-router');
const static = require('koa-static')
const nunjucks = require('koa-nunjucks-2');
const multer = require('koa-multer');
const path = require('path');
const fs = require('fs');
const app = new Koa();
const router = new Router();
const AipOcrClient = require("baidu-aip-sdk").ocr;
@coolicer
coolicer / comb.js
Created Mar 2, 2018
js 排列组合
View comb.js
function C(arr, num)
{
var r=[];
(function f(t,a,n)
{
if (n==0)
{
return r.push(t);
}
for (var i=0,l=a.length; i<=l-n; i++)
@coolicer
coolicer / demo.js
Created Jan 30, 2018
115 get download process
View demo.js
(async function () {
const obj = top.window.Core['OFFL5Plug'].GetDataCtl()._set_sign();
obj.page = 1;
const searchParams = Object.keys(obj).map((key) => {
return encodeURIComponent(key) + '=' + encodeURIComponent(obj[key]);
}).join('&');
const result = await fetch('http://115.com/web/lixian/?ct=lixian&ac=task_lists', {
method: "POST",
credentials: "same-origin",
@coolicer
coolicer / iptables.txt
Last active Feb 22, 2018
shadowsocks android afwall
View iptables.txt
IP6TABLES=/system/bin/ip6tables
IPTABLES=/system/bin/iptables
ULIMIT=/system/bin/ulimit
SS_UID=`dumpsys package com.github.shadowsocks | grep userId | cut -d= -f2 - | cut -d' ' -f1 -`
WZRY_UID=`dumpsys package com.tencent.tmgp.sgame | grep userId | cut -d= -f2 - | cut -d' ' -f1 -`
PORT_DNS=5450
PORT_TRANSPROXY=8200
$ULIMIT -n 4096
$IP6TABLES -F
$IP6TABLES -A INPUT -j DROP
View app.js
var express = require('express'),
weixin = require('weixin-api'),
app = express(),
bodyParser = require('body-parser');
var OAuth = require('wechat-oauth');
var setting = {
id: '',
sceret: ''
}
View vps-login-via-key.md

[server]

  1. 生成SSH Key: ssh-keygen -t rsa

  2. 在vps上生成密钥对,公钥复制多一份叫authorized_keys

  3. 更改权限

[root@host .ssh]$ chmod 600 authorized_keys
[root@host .ssh]$ chmod 700 ~/.ssh
View gist:073bd830ea45895ee467
var datasource = [{
"text": "null",//根节点
"expanded": true,
"items": [
{
"text":"user1",//第一个子菜单
"expanded": true,
"items":[
{
"text":"user2",//二级菜单
You can’t perform that action at this time.