Skip to content

Instantly share code, notes, and snippets.

package main
import (
"context"
"net/http"
"time"
)
func main() {
ctx, cancel := context.WithCancel(context.Background())
package main
import (
"net/http"
"sync"
"time"
)
func main() {
req, err := http.NewRequest("GET", "http://qq.com", nil)
package main
func foo() (err error) {
defer func() {
if e := f.Close(); e != nil && err == nil {
err = e
}
}()
}
@reusee
reusee / a.go
Created February 27, 2020 00:36
hint composite literal
package main
import (
"fmt"
"go/ast"
"go/types"
"golang.org/x/tools/go/ast/astutil"
"golang.org/x/tools/go/packages"
)
@reusee
reusee / a.go
Created February 23, 2020 00:08
foo
package main
import (
"bytes"
"crypto/sha256"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"sync"
@reusee
reusee / a.go
Created February 22, 2020 01:29
foo
package main
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"sync"
)
@reusee
reusee / a.go
Created January 31, 2020 06:27
go rename
package main
import (
"bytes"
"go/format"
"go/types"
"io/ioutil"
"golang.org/x/tools/go/packages"
)
@reusee
reusee / extension.js
Created December 12, 2019 05:59
personal gnome shell extension
'use strict'
const { Meta, Shell, GLib } = imports.gi;
const Main = imports.ui.main;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const Util = imports.misc.util;
class Extension {
@reusee
reusee / a.go
Last active November 2, 2019 17:40
package main
import "fmt"
func cached(
fn func(int) int,
) (
decorated func(int) int,
) {
cache := make(map[int]int)
package main
import (
"crypto/md5"
"encoding/binary"
"runtime"
"sync"
)
func main() {