Skip to content

Instantly share code, notes, and snippets.

View mygoare's full-sized avatar
:octocat:

Gore mygoare

:octocat:
View GitHub Profile
@mygoare
mygoare / http.js
Last active March 3, 2022 09:52
httpServer setTimeout & timeout event
const http = require('http')
const port = 3000;
const server = http.createServer((req, res) => {
res.writeHead(200);
res.write('OK');
res.end();
});
// 如果超时3秒,就触发 timeout event
@mygoare
mygoare / index.js
Last active June 16, 2020 09:54
利用微信小程序云开发 云函数 规避 域名请求限制
// 云函数代码
// querycloud/
const request = require('request');
exports.main = async (event, context) => {
return new Promise((resolve, reject) => {
request(event, (err, res, body) => {
if (err) return reject(err);
resolve(body);
@mygoare
mygoare / v2ex_sign.js
Created May 3, 2020 03:51
v2ex sign everyday
const request = require('request');
const rp = require('request-promise');
const j = rp.jar();
const cookie = rp.cookie(`
YOUR_V2EX_COOKIE
`.trim());
const url = "https://v2ex.com";
j.setCookie(cookie, url);
@mygoare
mygoare / cn.conf
Created April 10, 2020 09:32
Top 500 Websites in China (for dnsmasq use)
server=/cn/114.114.114.114
@mygoare
mygoare / api-sample.js
Created January 2, 2020 14:08
api sample
// 返回的接口结构 如下:
// 游戏Id不存在
const idDoNotExist =
{
error: 1,
msg: '游戏Id不存在'
}
// 游戏Id存在
@mygoare
mygoare / vue-nginx.conf
Created July 14, 2019 08:43 — forked from namdau/vue-nginx.conf
Nginx config for Vuejs project with an API upstream
server {
server_name default_server;
# This is for Let's Encrypt certification renewal
include /etc/nginx/snippets/letsencrypt.conf;
# Redirect to https
location / {
return 301 https://$server_name$request_uri;
}
}
@mygoare
mygoare / Vagrantfile
Created June 25, 2019 06:49
sample vagrant conf
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@mygoare
mygoare / ss-test.js
Created June 8, 2019 10:13
ss 可用性测试
const request = require('request');
const SocksProxyAgent = require('socks-proxy-agent');
const proxy = 'socks5://127.0.0.1:1086';
const agent = new SocksProxyAgent(proxy)
request({
method: 'get',
url: 'https://ipinfo.io',
headers: {
@mygoare
mygoare / up.ahk
Last active May 12, 2019 13:57
战地1挂机脚本
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#MaxThreadsPerHotkey 255
toggle := 0
F1::
toggle := !toggle
@mygoare
mygoare / cn_rules.conf
Created July 30, 2018 08:30
gfw 相关
# https://github.com/fivesheep/chnroutes
# 下载分配给国内运营商的 IP 段
# curl 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' | grep ipv4 | grep CN | awk -F\| '{ printf("%s/%d\n", $4, 32-log($5)/log(2)) }' > chnroute.txt
# 输出所有ip段
# curl http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest | grep 'apnic|CN|ipv4' | awk -F\| '{ printf("-A SHADOWSOCKS -d %s/%d -j RETURN\n", $4, 32-log($5)/log(2)) }' > cn_rules.conf
# 输出如下:
-A SHADOWSOCKS -d 1.0.1.0/24 -j RETURN