목록IT 인터넷 (525)
반업주부의 일상 배움사
1. S3 업로드 2022.05.18 - [IT 인터넷/Golang] - [Golang] 파일 업로드 > S3
1. 패키지 다운로드 $ go get github.com/aws/aws-sdk-go-v2/aws $ go get github.com/aws/aws-sdk-go-v2/config 2. 주요 코드 // 업로드된 파일 정보 imageFile, imageFileHeader, _ := c.Request.FormFile("imageFile") // 바이트 버퍼로 변환 buf := make([]byte, imageFileHeader.Size) imageFile.Read(buf) // AWS 세션 생성 session, err := session.NewSession(&aws.Config{ Region: aws.String("ap-northeast-2"), Credentials: credentials.NewStaticCr..
1. .env MYSQL_HOST = "" MYSQL_USER = "" MYSQL_PASSWORD = "" MYSQL_DBNAME = "" MYSQL_PROTOCOL = "tcp" MYSQL_PORT = 3306 2. go.mod module myproject/main go 1.16 require ( github.com/gin-contrib/cors v1.3.1 // indirect github.com/gin-gonic/gin v1.7.7 // indirect github.com/go-playground/validator/v10 v10.11.0 // indirect github.com/go-sql-driver/mysql v1.6.0 // indirect github.com/golang/protobuf v..
1. 설치 $ go get -u github.com/gin-gonic/gin 2. main.go package main import "github.com/gin-gonic/gin" func main() { r := gin.Default() r.GET("/echo", func(c *gin.Context) { msg := c.DefaultQuery("msg", "Banjubu") c.JSON(200, gin.H{ "message": msg, }) }) r.Run(":8080") } 3. 실행 $ go run main.go 4. 확인 http://localhost:8080/echo {"message":"Banjubu"} http://localhost:8080/echo?msg=Golang {"message":"..
한 줄 받는 샘플. 2022.05.15 - [IT 인터넷/Golang] - [Golang] echo 샘플 [Golang] echo 샘플 문자열을 입력하면 그대로 출력하는 예제에요. stdin.ReadString 은 주어진 delimeter 까지의 문자열을 돌려줘요. package main import ( "bufio" "fmt" "os" ) func main() { stdin := bufio.NewReader(os.Stdin).. banjubu.tistory.com 여러 줄을 받아볼께요. 엔터만 치면 빠져나가요. package main import ( "bufio" "fmt" "os" ) func main() { sc := bufio.NewScanner(os.Stdin) for sc.Scan() { tx..
문자열을 입력하면 그대로 출력하는 예제에요. stdin.ReadString 은 주어진 delimeter 까지의 문자열을 돌려줘요. package main import ( "bufio" "fmt" "os" ) func main() { stdin := bufio.NewReader(os.Stdin) s, _ := stdin.ReadString('\n') fmt.Println(s) } 결과. $ go run main.go Banjubu Banjubu 만약 s, _ := stdin.ReadString('=') 이렇게 했다면. $ go run main.go Banjubu=Banjubu Banjubu= 여러 줄 받는 샘플. 2022.05.15 - [IT 인터넷/Golang] - [Golang] echo 샘플2 [Go..

[ Local: Nodejs - express ]1. index.jsconst express = require("express");const app = express();app.get("/", (req, res) => { res.send("This is my express app");});app.get("/me", (req, res) => { res.send("Hi I am Laith");});app.listen(3000, () => { console.log("listening");}); 2. package.json{ "name": "project", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "te..
이미지 생성 등은 이전 글에서 참고할 수 있어요. 2022.04.30 - [IT 인터넷/일반] - [NFT] 이미지 생성부터 오픈씨까지 (Mumbai/Polygon) [NFT] 이미지 생성부터 오픈씨까지 (Mumbai/Polygon) 간단하게 아래 프로젝트에 들어있는 이미지를 이용할께요. https://github.com/HashLips/hashlips_art_engine GitHub - HashLips/hashlips_art_engine: HashLips Art Engine is a tool used to create multiple di.. banjubu.tistory.com 새 폴더를 만들고 터미널을 연 다음 아래 코드를 실행해요. $ npm init -y $ npm install -g truffl..

간단하게 아래 프로젝트에 들어있는 이미지를 이용할께요. https://github.com/HashLips/hashlips_art_engine GitHub - HashLips/hashlips_art_engine: HashLips Art Engine is a tool used to create multiple different instances of artworks bas HashLips Art Engine is a tool used to create multiple different instances of artworks based on provided layers. - GitHub - HashLips/hashlips_art_engine: HashLips Art Engine is a tool used to..

list.txt 김씨 이씨 박씨 강씨 최씨 송씨 홍씨 main.go package main import ( "bufio" "fmt" "math/rand" "os" "time" ) func main() { file, _ := os.Open("list.txt") defer file.Close() result := make([]string, 0) scanner := bufio.NewScanner(file) for scanner.Scan() { result = append(result, scanner.Text()) } rand.Seed(time.Now().UnixNano()) for i := 0; i < 3; i++ { rnd := rand.Intn(len(result)) fmt.Println(result[rn..