Skip to content

Instantly share code, notes, and snippets.

View nondanee's full-sized avatar
💪

Nzix nondanee

💪
  • Hangzhou, China
View GitHub Profile
@nondanee
nondanee / index.js
Last active January 25, 2024 03:58
safely replace npm registry in lock file
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const url = require('url');
const http = require('http');
const https = require('https');
const { promisify } = require('util');
const lockfile = require('@yarnpkg/lockfile');
@nondanee
nondanee / server.js
Last active February 14, 2022 06:14
a proxy pipe server
const URL = require('url')
const http = require('http')
const https = require('https')
const {
PORT = 8080,
HTTP_PROXY = 'https://username:password@localhost:443',
} = process.env
const proxy = URL.parse(HTTP_PROXY)
@nondanee
nondanee / index.js
Created July 20, 2021 13:06
http+websockt reverser proxy
const URL = require('url')
const HTTP = require('http')
const QUERY = require('querystring')
const port = parseInt(process.argv[2]) || 8223
const server = HTTP.createServer().listen(port)
const target = URL.parse('http://locahost:8080')
const host = target.host
@nondanee
nondanee / weapi.worker.js
Created September 18, 2020 01:51
cloudflare worker for weapi encrypt
ArrayBuffer.prototype.toString = function (encode) {
switch (encode) {
case 'base64':
return btoa(String.fromCharCode.apply(null, new Uint8Array(this)))
default:
return Object.prototype.toString.call(this)
}
}
const Buffer = { from: string => {
@nondanee
nondanee / tun.js
Created March 29, 2020 17:37
TCP port tunnel server
const net = require('net')
const local = { host: '0.0.0.0', port: 12000 }
const remote = { host: '127.0.0.1', port: 8080 }
net
.createServer({ allowHalfOpen: true })
.listen(local)
.on('connection', socket => {
const proxySocket = net.connect(remote.port, remote.host)
@nondanee
nondanee / simple.js
Created March 22, 2020 07:57
Simple Proxy Server
const net = require('net')
const http = require('http')
const parse = require('url').parse
const port = parseInt(process.argv[2]) || 8080
const server = http.createServer().listen(port)
// MITM Mode
server.on('request', (req, res) => {
if (!req.url.startsWith('http://')) return res.end('invalid')
const url = parse(req.url)
@nondanee
nondanee / index.js
Created February 4, 2020 07:06
Reverse Proxy Server
const url = require('url')
const net = require('net')
const http = require('http')
const https = require('https')
const [HOST, PORT = 8000] = process.argv.slice(2)
const target = url.parse(HOST.startsWith('http') ? HOST : `http://${HOST}`)
console.log('Reverse proxy', target.href, '@', PORT)
const server = http.createServer().listen(parseInt(PORT))
@nondanee
nondanee / MSE.test.js
Created November 24, 2019 14:20
MediaSource supported type test
[
'video/webm;codecs="vp8"',
'video/webm;codecs="vorbis"',
'video/webm;codecs="vp8,vorbis"',
'video/webm;codecs="vorbis, vp8"',
'audio/webm;codecs="vorbis"',
'AUDIO/WEBM;CODECS="vorbis"',
'audio/webm;codecs="opus"',
'video/webm;codecs="opus"',
'video/mp4;codecs="avc1.4d001e"',
@nondanee
nondanee / run.sh
Created November 6, 2019 06:07
doc2unix
find . -type f -exec dos2unix {} \;
@nondanee
nondanee / ip.txt
Created October 5, 2019 09:05
Preset IP in NeteaseMusic APK
59.111.21.13
59.111.179.213
59.111.21.14
59.111.179.214
1.81.5.114
1.81.5.115
110.185.122.114
110.185.122.115
14.18.239.11
14.18.239.12