Skip to content

Instantly share code, notes, and snippets.

View Zhang-Siyang's full-sized avatar

张思扬 Zhang-Siyang

View GitHub Profile
@Zhang-Siyang
Zhang-Siyang / _.scpt
Last active February 26, 2024 02:58
macOS 最大化所有窗口
tell application "System Events"
set visibleProcesses to application processes whose visible is true
repeat with aProcess in visibleProcesses
set visibleWindows to windows of aProcess
repeat with aWindow in visibleWindows
if exists attribute "AXMinimized" of aWindow then
if value of attribute "AXMinimized" of aWindow is true then
set value of attribute "AXMinimized" of aWindow to false
end if
end if
package main
import (
"fmt"
"reflect"
"unsafe"
)
func main() {
s := make([]int, 3, 5)
package main
import (
"fmt"
"reflect"
"unsafe"
)
func main() {
s := []int{0, 0, 0, 0, 0}
package main
// go test -test.bench '.*'
// goos: darwin
// goarch: arm64
// BenchmarkRandRead4KB-8 356580 3335 ns/op
// BenchmarkCryptoRead4KB-8 158610 7540 ns/op
import (
db.Exec(`INSERT INTO t(data) VALUES(?)`, `binary`)
SELECT userid,pointid FROM point WHERE pointid>${上一批结果中最大的pointid} AND now()>= expired ORDER BY pointid ASC LIMIT 100
sql = 'SELECT * FROM f65 WHERE 1=1'
param = list()
if code != '':
sql = sql + ' AND code LIKE ?'
list.append(code)
if engine != '':
sql = sql + ' AND engine LIKE ?'
list.append(engine)
package main
import (
"context"
"fmt"
"os"
"os/signal"
"syscall"
"time"
)
while true ; do nc -l -p 1500 -c 'echo -e "HTTP/1.1 200 OK\n\n $(date)"'; done
# Ref: constantin-berhard @ https://stackoverflow.com/a/19139134
type DAO struct{}
func (DAO) QueryAlice() {}
func (*DAO) QueryBob() {}
func demo() {
DAO{}.QueryAlice()
(&DAO{}).QueryBob()
}