Skip to content

Instantly share code, notes, and snippets.

View coolicer's full-sized avatar
🎯
Focusing

e.e.p coolicer

🎯
Focusing
View GitHub Profile
/*
* 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 April 8, 2018 03:57
rename file
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))
})
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 / vps-login-via-key.md
Last active April 1, 2018 07:03
vps key login

[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
@coolicer
coolicer / koa-upload-file.js
Created March 8, 2018 07:14
百度文字识别
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 March 2, 2018 09:51
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 / iptables.txt
Last active February 22, 2018 03:35
shadowsocks android afwall
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
@coolicer
coolicer / demo.js
Created January 30, 2018 10:27
115 get download process
(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 / app.js
Created November 22, 2017 02:43
wechat test
var express = require('express'),
weixin = require('weixin-api'),
app = express(),
bodyParser = require('body-parser');
var OAuth = require('wechat-oauth');
var setting = {
id: '',
sceret: ''
}
@coolicer
coolicer / sysctl.conf
Created March 21, 2015 09:11
shadowsocks 内核优化
fs.file-max = 51200
#提高整个系统的文件限制
net.ipv4.tcp_syncookies = 1
#表示开启SYN Cookies。当出现SYN等待队列溢出时,启用cookies来处理,可防范少量SYN攻击,默认为0,表示关闭;
net.ipv4.tcp_tw_reuse = 1
#表示开启重用。允许将TIME-WAIT sockets重新用于新的TCP连接,默认为0,表示关闭;
net.ipv4.tcp_tw_recycle = 0
#表示开启TCP连接中TIME-WAIT sockets的快速回收,默认为0,表示关闭;
#为了对NAT设备更友好,建议设置为0。
net.ipv4.tcp_fin_timeout = 30