Skip to content

Instantly share code, notes, and snippets.

View azhai's full-sized avatar
🪁
Focusing

azhai

🪁
Focusing
View GitHub Profile
@felix021
felix021 / socks5_proxy.go
Created November 21, 2020 08:12
Minimal socks5 proxy implementation in Golang
package main
import (
"encoding/binary"
"errors"
"fmt"
"io"
"net"
)
@mouselangelo
mouselangelo / avd-hardware-profile-huawei-mate-20x.xml
Created July 23, 2019 10:51
Android: Basic AVD Hardware profile for the Huawei Mate 20 X phone
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<d:devices xmlns:d="http://schemas.android.com/sdk/devices/3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<d:device>
<d:name>HUAWEI Mate 20 X</d:name>
<d:manufacturer>HUAWEI</d:manufacturer>
<d:meta/>
<d:hardware>
<d:screen>
<d:screen-size>large</d:screen-size>
<d:diagonal-length>7.20</d:diagonal-length>
@dhb52
dhb52 / ustc-brew-origin.md
Created April 20, 2019 13:19
中科大brew源

中科大brew源

git -C "/usr/local/Homebrew" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

恢复官方源

git -C "/usr/local/Homebrew" remote set-url origin https://github.com/Homebrew/brew.git
package main
import (
"context"
"fmt"
"net"
"os/exec"
"strconv"
"strings"
"sync"
<?php
$uploadUrl = 'http://test.com/upload.php';
// 转发从其它客户端上传的文件,name="file"
upload_file($uploadUrl, realpath($_FILES['file']['tmp_name']), $_FILES['file']['type'], $_FILES['file']['name']);
/**
* curl上传文件
*/
function upload_file($url, $path, $type, $filename){
@zupzup
zupzup / main.go
Created March 20, 2017 10:03
Go TCP Proxy / Port Forwarding Example (https://zupzup.org/go-port-forwarding/)
package main
import (
"flag"
"fmt"
"io"
"log"
"net"
"os"
"os/signal"
@magnetikonline
magnetikonline / README.md
Last active November 25, 2023 13:59
Nginx & PHP-FPM systemd services.

Nginx & PHP-FPM systemd services

A basic set of systemd units for starting Nginx and PHP-FPM daemons on system startup.

  • Ensures Nginx web server has started before the PHP-FPM process.
  • Nginx pid file placed at /run/nginx.pid.
  • PHP-FPM pid file placed at /run/php7/php-fpm.pid, PHP7 PHP-FPM config at /etc/php7.
  • Based on usage with Ubuntu 16.04LTS / 18.04LTS.

Unit files are placed in /etc/systemd/system and enabled with:

@saelo
saelo / decorator.go
Created March 8, 2015 19:45
Decorators in Go
package main
import (
"fmt"
"reflect"
)
func Decorate(impl interface{}) interface{} {
fn := reflect.ValueOf(impl)
@danharper
danharper / gulpfile.js
Last active April 11, 2024 08:31
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@denji
denji / http-benchmark.md
Last active June 20, 2024 14:22
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)