Skip to content

Instantly share code, notes, and snippets.

@luckymrwang
luckymrwang / golang_pipe_http_response.go
Created December 17, 2020 12:03 — forked from ifels/golang_pipe_http_response.go
golang pipe the http response
package main
import (
"io"
"net/http"
"os/exec"
)
var (
BUF_LEN = 1024
@luckymrwang
luckymrwang / identifypanic.go
Created March 22, 2019 09:28 — forked from swdunlop/identifypanic.go
Identify a GOLANG Panic Function and Line in Recovery
// You can edit this code!
// Click here and start typing.
package main
import "fmt"
import "runtime"
import "strings"
func identifyPanic() string {
var name, file string
@luckymrwang
luckymrwang / util.php
Created October 20, 2016 12:43 — forked from aeurielesn/util.php
Decode Unicode strings in PHP
<?php
#source: http://stackoverflow.com/questions/2934563/how-to-decode-unicode-escape-sequences-like-u00ed-to-proper-utf-8-encoded-char
function replace_unicode_escape_sequence($match) {
return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
}
function unicode_decode($str) {
return preg_replace_callback('/\\\\u([0-9a-f]{4})/i', 'replace_unicode_escape_sequence', $str);
}