golangci-lint

# vim 에서 golang generic(1.18)를 사용하는데 lint 에러가 많이 발생한다.
# vim > vim-go > golint 를 사용하고 있고 golint 바이너리는 업데이트 해도 다음과 같은 메시지가 발생한다.
golint ./...
main.go:12:8: expected ';', found '|' (and 4 more errors)

# vim > ale > gofmt 도 다음과 같은 에러 메시지를 발생한다.
gofmt .
main.go:12:8: expected ';', found '|'
main.go:12:10: illegal character U+007E '~'
main.go:16:2: expected '}', found 'return'
main.go:20:2: expected declaration, found result

https://github.com/golang/lint 가보니 2021년에 deprecated 돼 관리가 안되고 있었다.
# gofmt 바이너리는 2018년에 생성된것을 사용하고 있었다.
type gofmt
gofmt is /Users/ysoftman/workspace/gopath/bin/gofmt --> 2018년도
gofmt is /opt/homebrew/bin/gofmt --> ../Cellar/go/1.22.1/bin/gofmt

# golint 는 삭제하고
rm -f $(which golint)

# 2018년도 gofmt 삭제
rm -f /Users/ysoftman/workspace/gopath/bin/gofmt

# 대안으로 https://github.com/golangci/golangci-lint 를 사용하면 된다.
golangci-lint run ./...

# vim-go 설정을 변경
let g:go_metalinter_enabled = ['vet', 'golangci-lint', 'errcheck']

# ale go linter 도 변경
let g:ale_linters = {
\ 'python': ['flake8', 'pylint'],
\ 'javascript': ['eslint'],
\ 'go': ['golangci-lint', 'gofmt']
\}


use rqlite

# rqlite(분산 sqlite database)
https://rqlite.io/docs/cli/

# k8s 로 운영중인 경우 local로 port-forwarding
kubectl port-forward service/rqlite 4001:4001 -n rqlite

# 접속
rqlite -H localhost -p 4001

# usage hints
.help

# 분산 노드 확인
.nodes

# 테이블 리스트 
.tables

# 테이블 조회
# 쿼리는 일반적인 sql 사용하면 된다.
select * from 테이블;

# sql 문으로 dump
.dump ysoftman.dump

# db 백업(sqlite format 3)
.backup ysoftman.db

# exit
.exit or .quit

# mysql 쿼리문에서 사용하려면 
# 필드명을 " 대신 `로 감싸야 한다.
# primary 에 있는 AUTOINCREMENT 는 제거하고 fileld 선언시 auto_increment 로 선언해야 한다.
# cat ysoftman.dump | sed -e "s/\"/\`/g" -e "s/AUTOINCREMENT//g" | pbcopy
# 이렇게 일일히 변경하는것 보다 툴을 사용하면 편하다.
brew tap techouse/sqlite3-to-mysql
brew install sqlite3-to-mysql
sqlite3mysql --help

# sqlite3 db 파일을 mysql 특정 db 에 import
sqlite3mysql -f ysoftman.db -h localhost -P 3306 -u root -d ysoftmantest --mysql-password aaa111

ffmpeg cli

# ffmpeg 로 오디오, 비디오 파일을 컨버팅 해보자.
# 설치
brew install ffmpeg

# jpg, mp4 파일을 90도 회전
# transpose=0 반시계방향 90도 회전후 상하반전(미러 효과,글자 있다면 거꾸로 된다.)
# transpose=1 시계방향 90도
# transpose=2 반시계방향 90도
# transpose=3 시계방향 90도 회전후 상하반전(미러 효과,글자 있다면 거꾸로 된다.)
ffmpeg -i old.mp4 -vf "transpose=1" new.mp4
ffmpeg -i xelloss.jpg -vf "transpose=1" xelloss_new.jpg

# 크기 조정
ffmpeg -i old.mp4 -vf scale=320:240 new_320x240.mp4
ffmpeg -i xelloss.jpg -vf scale=320:240 xelloss_new_320x240.png