Skip to content

Instantly share code, notes, and snippets.

Avatar

Oscar Zhou oscarzhou

View GitHub Profile
@Integralist
Integralist / Long and Short Flag.go
Last active Jun 2, 2021
[Golang Long and Short Flags] #go #golang #flags
View Long and Short Flag.go
var myFlagType string
func init() {
const (
flagValue = "default value is foo"
flagUsage = "this is my flag explanation"
)
flag.StringVar(&myFlagType, "foo", flagValue, flagUsage)
flag.StringVar(&myFlagType, "f", flagValue, flagUsage+" (shorthand)")
flag.Parse()
@masklinn
masklinn / cheatsheet.md
Last active Jan 10, 2022
launchctl/launchd cheat sheet
View cheatsheet.md

I've never had great understanding of launchctl but the deprecation of the old commands with launchctl 2 (10.10) has been terrible as all resources only cover the old commands, and documentation for Apple utilities is generally disgracefully bad, with launchctl not dissembling.

Mad props to https://babodee.wordpress.com/2016/04/09/launchctl-2-0-syntax/ which contains most details

domains

Internally, launchd has several domains, but launchctl 1 would only ask for service names,

@asukakenji
asukakenji / 0-go-os-arch.md
Last active Jan 14, 2022
Go (Golang) GOOS and GOARCH
View 0-go-os-arch.md

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@mxlje
mxlje / recursive.go
Created Jun 29, 2017
Golang html/template recursive rendering partial
View recursive.go
type Thing struct {
Text string
Things []Thing
}
func RootHandler(rw http.ResponseWriter, req *http.Request) {
tmpl, err := template.New("root").Parse(`
<html>
{{ define "message" }}
<li>{{ .Text }}
@sdorra
sdorra / keys.go
Created Apr 17, 2016
Golang RSA Key Generation
View keys.go
/*
* Genarate rsa keys.
*/
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
View golang-create-read-write-delete-file.go
package main
import (
"fmt"
"io"
"os"
)
var path = "/Users/novalagung/Documents/temp/test.txt"
@davfre
davfre / git_cheat-sheet.md
Last active Jan 16, 2022
git commandline cheat-sheet
View git_cheat-sheet.md
@rxaviers
rxaviers / gist:7360908
Last active Jan 17, 2022
Complete list of github markdown emoji markup
View gist:7360908

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: