Skip to content

Instantly share code, notes, and snippets.

View sunfmin's full-sized avatar

Felix Sun sunfmin

View GitHub Profile
@sunfmin
sunfmin / QOR5.md
Last active October 4, 2021 14:54
  • It all starts with https://github.com/theplant/htmlgo

    • Typesafe, Compiled
    • Extract a go func become a component natually
    • Refactor very easy
    • Looks very html
  • It's crazy that we have all these backend template languages around: go template, mustache, jinja2, Laravel Blade...

    • Normally interpreted, Not type safe, error only appear on runtime
    • File based, your program/parser have to know the path of these template files, enormous amout of bugs created because of this.
  • Yet another language to learn, you forgot how to use it after a few months

@sunfmin
sunfmin / README.md
Created June 28, 2021 07:41
在Go里调用chiapos的静态库
mkdir build
cd build
cmake ../
cmake --build . --config=Release

在build/Release生成了 chiapos.libgochiapos.lib等文件

main.go

VAULT_ADDR=https://vault.theplant.dev vault login -method=oidc role=staff
VAULT_ADDR=https://vault.theplant.dev vault write -field=signed_key ssh-client-signer/sign/dev public_key=@$HOME/.ssh/id_rsa.pub > ~/.ssh/id_rsa-cert.pub -<< EOH
{
"valid_principals": "ubuntu,dev"
}
EOH
ssh-keygen -Lf ~/.ssh/id_rsa-cert.pub
@sunfmin
sunfmin / keybase.md
Created June 17, 2019 03:55
keybase.md

Keybase proof

I hereby claim:

  • I am sunfmin on github.
  • I am sunfmin (https://keybase.io/sunfmin) on keybase.
  • I have a public key ASCPdjjdDjkIUXsPKZA1OOhErY7Qj_EPZQcdPj-flYA9VAo

To claim this, I am signing this object:

"""Autogenerated input type of AcceptTopicSuggestion"""
input AcceptTopicSuggestionInput {
"""The Node ID of the repository."""
repositoryId: ID!
"""The name of the suggested topic."""
name: String!
"""A unique identifier for the client performing the mutation."""
clientMutationId: String
import { test, assertEqual } from "https://deno.land/x/testing/mod.ts";
test(function t1() {
assertEqual("hello", "hello");
});
test(function t2() {
assertEqual("world", "world");
});
**/*.gohtml {
prep: go generate ./aigleapp
}
**/*.go {
prep: go install ./aigleapp
daemon: aigleapp
daemon +sighup: devd -om -n 1000 http://localhost:4000
}
@{
var l *Locale
}
<span>@l.T("for"</span>
{{func (h *HelloData) MyEmail()}}
<em>My Email is: {{h.Email}}</em>
{{end}}
func Hello(w io.Writer, d *HelloData) (err error) {
_, err = io.WriteString(w, "<h1>")
if err != nil {
return
}
_, err = io.WriteString(w, fmt.Sprintf("Hi, %s", d.Name))
if err != nil {
return
}