Skip to content

Instantly share code, notes, and snippets.

View NaniteFactory's full-sized avatar
😊
Hi

NaniteFactory

😊
Hi
View GitHub Profile
@NaniteFactory
NaniteFactory / fullscreenshot.go
Created May 17, 2020 07:13
chromedp full screen shot
func FullScreenshot(quality int64, result *[]byte) chromedp.Action {
return chromedp.ActionFunc(func(ctx context.Context) error {
// get layout metrics
_, _, contentSize, err := page.GetLayoutMetrics().Do(ctx)
if err != nil {
return err
}
width, height := int64(math.Ceil(contentSize.Width)), int64(math.Ceil(contentSize.Height))
@NaniteFactory
NaniteFactory / shard.go
Created June 8, 2020 03:37
Discordgo sharding
package shard
import (
"errors"
"fmt"
"strconv"
"sync"
"github.com/bwmarrin/discordgo"
)
@NaniteFactory
NaniteFactory / fileserver.go
Last active September 4, 2020 11:20
fileserver written in go
package main
import (
"flag"
"log"
"net/http"
)
var (
listen = flag.String("listen", ":8080", "listen address")
@NaniteFactory
NaniteFactory / processclear.go
Created September 9, 2020 11:21
kill all processes in windows
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"os/exec"
"strconv"
"strings"

pprof 사용법

1. pprof의 구분

  1. go tool pprof 프로그램:
    • pprof 데이터를 분석하여 보여 주는 pprof 바이너리다.
  2. runtime/pprof 패키지:
    • Go 프로그램으로부터 pprof 데이터를 생성하여 내보내는 일을 하는 패키지다.
  3. net/http/pprof 패키지:
    • runtime/pprof 패키지가 하고 있는 것을 (ServeHTTP로) 웹으로 내보내거나 프로그램의 pprof 데이터를 분석하여 웹 인터페이스로 보여 주는 일을 하는 패키지다.

무료 MongoDB 서버 만들기

방법은 2가지가 있다.

  1. MongoDB Atlas 클라우드 서비스 이용
    • MongoDB Atlas: https://cloud.mongodb.com/
    • 거의 SaaS임. 인프라를 전혀 신경 쓰지 않고 편하게 쓸 수 있다. 회원 가입하고 클러스터를 생성하면 모든 과정이 웹 GUI로 안내된다.
    • 512GB까지 무료 이용 가능하고 유료 최소 크기인 2GB로 확장하기 위해서 매달 미화 9불 결제 필요하다. [출처]
  2. IaaS 컴퓨팅 클라우드
    • [OCI]: 개인정보를 잔뜩 갈취하고 회원가입이 안 됐다.