Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

e.e.p coolicer

Block or report user

Report or block coolicer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
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 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 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 / 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
@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",
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: ''
}
@coolicer
coolicer / sysctl.conf
Created Mar 21, 2015
shadowsocks 内核优化
View sysctl.conf
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
You can’t perform that action at this time.