Skip to content

Instantly share code, notes, and snippets.

View evangwt's full-sized avatar
🎯
Focusing

evangwt

🎯
Focusing
View GitHub Profile
@evangwt
evangwt / build-mojave-iso-image.sh
Last active January 6, 2022 03:26
Create macOS Mojave ISO Image Shell Script
#!/bin/bash
# Create DMG Disk with Terminal
hdiutil create -o /tmp/mojave -size 7900m -volname mojave -layout SPUD -fs HFS+J
# Mount DMG Disk to your macOS
hdiutil attach /tmp/mojave.dmg -noverify -mountpoint /Volumes/mojave
# Create macOS Mojave Installer
sudo /Applications/Install\ macOS\ Mojave.app/Contents/Resources/createinstallmedia --volume /Volumes/mojave --nointeraction
@evangwt
evangwt / notifyAddrChange.go
Created January 16, 2021 09:39 — forked from KatelynHaworth/notifyAddrChange.go
A simple go program leveraging the Window API to listen for IPv4 network address change events
package main
import (
"log"
"syscall"
"unsafe"
"golang.org/x/sys/windows"
)
@evangwt
evangwt / ddns.go
Created January 12, 2021 02:08 — forked from wendal/ddns.go
golang的dns缓存, 含流量统计
package ddns
import (
"log"
"net"
"sync"
)
var (
dnsLock = &sync.Mutex{}
@evangwt
evangwt / download.js
Created March 18, 2020 06:16
download file by axios with post
function download() {
let token = '';
let data = {id: id};
new Promise((resolve, reject) => {
axios({
url: `/`,
method: 'POST',
headers: {'X-USER-TOKEN': token}, // custom token
data: data, // json object
responseType: 'blob', // important!
@evangwt
evangwt / go_routine_leak.go
Created June 1, 2019 01:29
go routine leak
package main
import (
"fmt"
"log"
"runtime"
"strconv"
"strings"
"sync"
"time"
@evangwt
evangwt / timestamp.go
Last active January 19, 2021 06:22
xorm timestamp
package common
import (
"fmt"
"time"
)
// Timestamp 自定义时间戳类型,支持Mysql的TIMESTAMP,DATETIME,DATE类型
type Timestamp int64
package model
import (
"strings"
uuid "github.com/satori/go.uuid"
)
// BaseUUID auto gen uuid xorm base model
type BaseUUID struct {
@evangwt
evangwt / eval-hello.sh
Created March 31, 2019 14:07 — forked from bpo/eval-hello.sh
Redis Lua examples
redis-cli EVAL "$(cat hello.lua)" 0