Skip to content

Instantly share code, notes, and snippets.

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

laoxu haixuxu

💭
🔪 ⚡️ 🗡 🔨 ⚔️
View GitHub Profile
@haixuxu
haixuxu / gist:6fdb1e1b3b4459d6ad886a8beb39c63a
Created November 3, 2025 02:01
update_env_development
```bash
# 1. 临时从 .gitignore 中删除规则(或注释掉)
sed -i 's/^.env.development$/# .env.development/' .gitignore
# 2. 修改配置文件
vim .env.development
# 3. 强制添加文件
git add -f .env.development
#!/bin/bash
# 函数:输出错误信息并退出
print_error_and_exit() {
echo "Error: $1"
exit 1
}
# 步骤1:检查并创建/tmp/sangforinstallationtemp目录
if [ ! -d "/tmp/sangforinstallationtemp" ]; then
@haixuxu
haixuxu / gist:c45c3795445f81dfb8144c1661eba041
Last active August 29, 2023 12:57
cpu_limit_cf_security_change

参考

#!/bin/bash
#cf.security.change.sh
##近期平均负载情况判定

usage=`echo $(cat /proc/loadavg | awk '{print $2}')` #获取当前系统平均负载值
max=2 #设置最大阈值
@haixuxu
haixuxu / rust_readwrite_client.js
Last active June 28, 2023 05:23
rust_read_write_client
use std::env;
use std::io::{Error, Read, Write};
use std::net::{TcpStream, ToSocketAddrs};
use std::ptr::eq;
use std::sync::{Arc, Mutex};
use std::time::Duration;
use tokio::time::sleep;
#[derive(Debug)]
pub struct TcpTransport {
@haixuxu
haixuxu / server.js
Created June 28, 2023 05:14
rust_readwrite_test.js
// a simple test server by nodejs
var net = require('net');
net.createServer(function(socket){
socket.on('data', function(data){
console.log("recv data:",data);
});
setInterval(() => {
var data = Buffer.from("hello");
var datalen = data.length;
@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;
@haixuxu
haixuxu / inputEventMask
Created May 13, 2021 08:05
inputEventMask
function inputEvent(val) {
if (val) {
var len = (val + '').length;
console.log(`len:${len},val:${val}`);
var res = '*'.repeat(len - 1) + val.substr(-1);
console.log(res);
this.inputModel = res;
} else {
return '';
}