'Programming > rust' 카테고리의 다른 글
| rust visibility and privacy (0) | 2023.05.25 |
|---|---|
| rust 소유권 (0) | 2023.05.25 |
| c에서 rust 호출하기 (0) | 2023.05.11 |
| rust 실행파일 (0) | 2023.05.11 |
| rust if문 (0) | 2023.05.11 |
| rust visibility and privacy (0) | 2023.05.25 |
|---|---|
| rust 소유권 (0) | 2023.05.25 |
| c에서 rust 호출하기 (0) | 2023.05.11 |
| rust 실행파일 (0) | 2023.05.11 |
| rust if문 (0) | 2023.05.11 |
유튜브에서 노마드 코더의 추천영상에 webGPU라는게 떠서 찾아보니
겁나 따끈한(고작 8일 지난..) 표준이다.
| WebGPU W3C Working Draft, 10 May 2023 |
[링크 : https://www.w3.org/TR/webgpu/]
[링크 : https://codelabs.developers.google.com/your-first-webgpu-app?hl=ko#0]
크롬94 베타 부터 webgpu 지원이 시작되었다는데(일단 글은 2021.09.11)
[링크 : https://www.clien.net/service/board/park/16489505]
webGL을 물리치고 대세가 될지 아니면 병행하게 될지 미래가 궁금해진다.
윈10 + 크롬 버전 113.0.5672.93(공식 빌드) (64비트)

ubuntu 18.04 + 버전 113.0.5672.126(공식 빌드) (64비트)

[링크 : https://webgpu.github.io/webgpu-samples/samples/shadowMapping]
+
리눅스에서는 webGPU가 disable인데.. 이걸 어떻게 켤 수 있으려나?
chrome://gpu/![]() |
[링크 : https://discourse.threejs.org/t/webgpu-example-not-working-in-ubuntu-20-04/40484]
| javascript 배열을파일로 저장하기 (0) | 2023.08.02 |
|---|---|
| Canvas2D: Multiple readback operations using getImageData (0) | 2023.07.24 |
| chart.js log 스케일 (0) | 2023.03.31 |
| chatGPT님 가라사대 Server-Sent Events (SSE) (0) | 2023.03.15 |
| JWT 로그인 예제 (0) | 2022.08.24 |
기사들이 폭주중
| 윤 대통령의 '바보같은 짓'... 벌써 외국서 신호가 오네요 |
[링크 : https://v.daum.net/v/20230517045400939]
| ‘RE100’ 맞대응으로 원전 등 ‘CF100’ 내세운 정부, 안방용 우려도 |
[링크 : https://v.daum.net/v/20230517143507778]
| 전 정부 탓, 다음 정부에 떠넘기기... 어처구니없는 기후위기 해법 |
[링크 : https://v.daum.net/v/20230516045110685]
+
그나저나 댓글에 보이는 외교선물로 개목걸이라...
외교선물은 아무렇게 고르는게 아니라 의미가 있는걸 텐데...
| 블링컨 국무장관은 윤 대통령 부부에게 퀸(보헤미안 랩소디)과 돈 맥클린(아메리칸 파이)의 레코드판으로 워싱턴과 서울의 전경을 형상화한 액자와 함께, 윤 대통령 부부의 반려견인 써니·새롬이·토리·나래·마리의 영문 이름이 새겨진 산책 줄을 선물했다. |
| 도둑놈 심뽀? (0) | 2023.06.15 |
|---|---|
| 미사일 발사관련 새벽 재난문자 (0) | 2023.05.31 |
| 전기, 가스 요금 인상 (0) | 2023.05.15 |
| 망했어요 (0) | 2023.04.26 |
| 윤대통령 "100년전 일로 무조건 무릎꿇어라 하는건 못받아들여" (0) | 2023.04.24 |
| # cat /sys/class/net/eth0/operstate up # macb e000b000.ethernet eth0: Link is Down # cat operstate down # macb e000b000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off # cat operstate up |
| .bashrc 설정 history (0) | 2023.08.08 |
|---|---|
| lvmcache bcache (0) | 2023.07.27 |
| 리눅스 커맨드 라인에서 몇줄씩 건너뛰고 출력하기 (0) | 2023.03.30 |
| bash completion (0) | 2023.03.27 |
| 리눅스 키보드로 강제 종료하기 (0) | 2023.03.10 |
채널의 경우 1개로 해두면 하나가 들어갈 때 까지 해당 위치에서 블로킹 된다.
아래 예제는 받는 부분을 삭제했는데 그렇기에 채널을 통해 전송은 되지만 수신하지 않아 비워지지 않기 때문에
one을 출력하지 못하고 멈춰있는 것을 확인할 수 있다.
| package main import ( f "fmt" "time" ) func main() { f.Println("select") c1 := make(chan string) c2 := make(chan string) go func() { time.Sleep(time.Second * 1) f.Println("---") c1 <- "one" f.Println("one") c1 <- "two" f.Println("two") c1 <- "three" f.Println("three") c1 <- "four" f.Println("four") }() go func() { time.Sleep(time.Second * 2) c2 <- "fifth" }() for i := 0; i < 10000000000; i++ { time.Sleep(time.Second) } } |
$ go run go.go select --- ^Csignal: interrupt |
다만, make를 통해 채널 버퍼를 n개로 만들어 두면, 넣을 수 있는 동안은 넣고 블로킹 되지 않고 넘어갈 수 있다.
| package main import ( f "fmt" "time" ) func main() { f.Println("select") c1 := make(chan string, 4) c2 := make(chan string) go func() { time.Sleep(time.Second * 1) f.Println("---") c1 <- "one" f.Println("one") c1 <- "two" f.Println("two") c1 <- "three" f.Println("three") c1 <- "four" f.Println("four") }() go func() { time.Sleep(time.Second * 2) c2 <- "fifth" }() for i := 0; i < 10000000000; i++ { time.Sleep(time.Second) } } |
$ go run go.go select --- one two three four ^Csignal: interrupt |
| golang echo server middleware (0) | 2023.05.24 |
|---|---|
| golang 동시성 (0) | 2023.05.24 |
| golang switch, select (0) | 2023.05.16 |
| golang uds (0) | 2023.05.16 |
| golang mutex (sync) (0) | 2023.05.16 |
커널에서 xilinx uartlite 쓰도록 해주고
device tree에서 axi 주소 추가해주고
vivado block design에서 axi와 PS로 uartlite 블록을 연결해주면 되는건가?
[링크 : https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842249/Uartlite+Driver]
| zynq fsbl (0) | 2023.07.07 |
|---|---|
| zynq w/o ps (0) | 2023.06.30 |
| xilinx vivado uart ip (0) | 2023.05.12 |
| xilinx bram uram (0) | 2023.05.12 |
| xilinx - partial bitstream (0) | 2023.04.24 |
golang switch는 신형 언어에 확장되서 그런가 꽤나 만능이다.
특이하게 조건식도 가능하고, 케이스 리스트도 된다.(c#에서 얼핏 봤던 느낌..)
| package main import ( "fmt" "time" ) func main() { t := time.Now() switch { case t.Hour() < 12: fmt.Println("Good morning!") case t.Hour() < 17: fmt.Println("Good afternoon.") default: fmt.Println("Good evening.") } } |
[링크 :https://go.dev/tour/flowcontrol/11]
| func WhiteSpace(c rune) bool { switch c { case ' ', '\t', '\n', '\f', '\r': return true } return false } |
[링크 : https://hamait.tistory.com/1017]
아무튼 select는 channel 처리에 좀더 특화된 구문으로 생긴것 자체는 switch - case와 동일하게 작성된다.
다만, 동시에 여러개가 들어왔을 경우 랜덤하게 실행된다고 한다.
(생각이 꼬였는지 동시에 들어오면 가장 위에꺼 부터 실행되어야 하는거 아냐? 싶은데 동시성이니까 랜덤하게 처리되는건가..)
| The select statement lets a goroutine wait on multiple communication operations. A select blocks until one of its cases can run, then it executes that case. It chooses one at random if multiple are ready. |
| package main import "fmt" func fibonacci(c, quit chan int) { x, y := 0, 1 for { select { case c <- x: x, y = y, x+y case <-quit: fmt.Println("quit") return } } } func main() { c := make(chan int) quit := make(chan int) go func() { for i := 0; i < 10; i++ { fmt.Println(<-c) } quit <- 0 }() fibonacci(c, quit) } |
[링크 : https://go.dev/tour/concurrency/5]
[링크 : https://edu.goorm.io/learn/lecture/2010/한-눈에-끝내는-고랭-기초/lesson/382961/채널-select문]
| golang 동시성 (0) | 2023.05.24 |
|---|---|
| golang 고루틴과 채널 (0) | 2023.05.16 |
| golang uds (0) | 2023.05.16 |
| golang mutex (sync) (0) | 2023.05.16 |
| go 포맷터 (0) | 2023.05.11 |
쓸만하려나?
| server | client |
| package main import ( "fmt" "log" "os" "path/filepath" "time" "github.com/google/uuid" "github.com/johnsiilver/golib/ipc/uds" ) func main() { socketAddr := filepath.Join(os.TempDir(), uuid.New().String()) cred, _, err := uds.Current() if err != nil { panic(err) } // This will set the socket file to have a uid and gid of whatever the // current user is. 0770 will be set for the file permissions (though on some // systems the sticky bit gets set, resulting in 1770. serv, err := uds.NewServer(socketAddr, cred.UID.Int(), cred.GID.Int(), 0770) if err != nil { panic(err) } fmt.Println("Listening on socket: ", socketAddr) // This listens for a client connecting and returns the connection object. for conn := range serv.Conn() { conn := conn // We spinoff handling of this connection to its own goroutine and // go back to listening for another connection. go func() { // We are checking the client's user ID to make sure its the same // user ID or we reject it. Cred objects give you the user's // uid/gid/pid for filtering. if conn.Cred.UID.Int() != cred.UID.Int() { log.Printf("unauthorized user uid %d attempted a connection", conn.Cred.UID.Int()) conn.Close() return } // Write to the stream every 10 seconds until the connection closes. for { if _, err := conn.Write([]byte(fmt.Sprintf("%s\n", time.Now().UTC()))); err != nil { conn.Close() } time.Sleep(10 * time.Second) } }() } } |
package main import ( "flag" "fmt" "io" "os" "github.com/johnsiilver/golib/ipc/uds" ) var ( addr = flag.String("addr", "", "The path to the unix socket to dial") ) func main() { flag.Parse() if *addr == "" { fmt.Println("did not pass --addr") os.Exit(1) } cred, _, err := uds.Current() if err != nil { panic(err) } // Connects to the server at socketAddr that must have the file uid/gid of // our current user and one of the os.FileMode specified. client, err := uds.NewClient(*addr, cred.UID.Int(), cred.GID.Int(), []os.FileMode{0770, 1770}) if err != nil { fmt.Println(err) os.Exit(1) } // client implements io.ReadWriteCloser and this will print to the screen // whatever the server sends until the connection is closed. io.Copy(os.Stdout, client) } |
[링크 : https://github.com/johnsiilver/golib/blob/v1.1.2/ipc/uds/example/server/server.go]
[링크 : https://github.com/johnsiilver/golib/blob/v1.1.2/ipc/uds/example/client/client.go]
[링크 : https://pkg.go.dev/github.com/johnsiilver/golib/ipc/uds]
| golang 고루틴과 채널 (0) | 2023.05.16 |
|---|---|
| golang switch, select (0) | 2023.05.16 |
| golang mutex (sync) (0) | 2023.05.16 |
| go 포맷터 (0) | 2023.05.11 |
| golang echo directory listing (0) | 2023.05.08 |
| package main import ( "fmt" "sync" "time" ) // SafeCounter is safe to use concurrently. type SafeCounter struct { mu sync.Mutex v map[string]int } // Inc increments the counter for the given key. func (c *SafeCounter) Inc(key string) { c.mu.Lock() // Lock so only one goroutine at a time can access the map c.v. c.v[key]++ c.mu.Unlock() } // Value returns the current value of the counter for the given key. func (c *SafeCounter) Value(key string) int { c.mu.Lock() // Lock so only one goroutine at a time can access the map c.v. defer c.mu.Unlock() return c.v[key] } func main() { c := SafeCounter{v: make(map[string]int)} for i := 0; i < 1000; i++ { go c.Inc("somekey") } time.Sleep(time.Second) fmt.Println(c.Value("somekey")) } |
[링크 : https://go.dev/tour/concurrency/9]
| func (*Mutex) Lock ¶ func (m *Mutex) Lock() Lock locks m. If the lock is already in use, the calling goroutine blocks until the mutex is available. func (*Mutex) TryLock ¶ added in go1.18 func (m *Mutex) TryLock() bool TryLock tries to lock m and reports whether it succeeded. Note that while correct uses of TryLock do exist, they are rare, and use of TryLock is often a sign of a deeper problem in a particular use of mutexes. func (*Mutex) Unlock ¶ func (m *Mutex) Unlock() Unlock unlocks m. It is a run-time error if m is not locked on entry to Unlock. A locked Mutex is not associated with a particular goroutine. It is allowed for one goroutine to lock a Mutex and then arrange for another goroutine to unlock it. |
[링크 : https://pkg.go.dev/sync#Mutex.Lock]
[링크 : https://mingrammer.com/gobyexample/mutexes/]
[링크 : https://www.joinc.co.kr/w/GoLang/example/mutexex]
[링크 : https://pyrasis.com/book/GoForTheReallyImpatient/Unit35]
| golang switch, select (0) | 2023.05.16 |
|---|---|
| golang uds (0) | 2023.05.16 |
| go 포맷터 (0) | 2023.05.11 |
| golang echo directory listing (0) | 2023.05.08 |
| golang websocket binary (0) | 2023.03.28 |
사이테스 관련 자료가 별로 없다. 아무튼 힌트가 될 만한 건.. 사이테스 간소화라는 것..
| 현제 그린칙코뉴어는 사이테스.간소화로 양도양수 폐사신고 이두가진 제외됬지만. 인공증식서류 는 받으셔야 합니다.ㅎ 2021.06.03. |
[링크 : https://kin.naver.com/qna/detail.nhn?d1id=8&dirId=80507&docId=391393477...&spq=0]
찾아봐도 별로 안나오는데.. 2020.05.31 이전에 간소화 해서 등록하라고 했었는 것 정도만 공문으로 발견
| 제18차 CITES 신규 등재종 '협약 전 획득 증명 간소화' 추진 등록자명 : 김정우 조회수 : 3,764 등록일자 : 2020.04.01 담당부서 : 자연환경과 나. 서류 간소화 운영기간 : '20.5.31.까지 |
환경부 가서 검색해보자
| 부속서 Ⅱ와 Ⅲ에는 멸종위기종 외에도 앵무새류, 육지거북류 등 일명 '예비' 멸종위기종이 포함된다. 이들은 엄격한 거래 규제가 없으면 멸종위기에 처할 수 있기 때문에 사전 신고 후 상업, 학술, 연구 목적으로 거래할 수 있으며, 부속서 Ⅲ의 경우 규제가 조금 더 느슨한 편이다. 각 부속서에 속하는 생물 목록은 CITES 공식 홈페이지나 환경부 웹사이트에서 '국제적 멸종위기종'을 검색해 확인할 수 있다. |
[링크 : https://www.newspenguin.com/news/articleView.html?idxno=12901]
조류 부속서 2에 의해서 앵무가 4가지 보이긴 한데.. 누가 누구지?
| 양도·양수, 폐사·질병신고 제외대상 국제적 멸종위기종 [시행 2021. 12. 6.] [환경부고시 제2021-261호, 2021. 12. 6., 일부개정] ![]() |
[링크 : https://www.law.go.kr/DRF/lawService.do?OC=me_pr&target=admrul&ID=2100000206707&type=HTML&mobileYn=]
+
그린칙 코뉴어로 알려진 .. 라고 나오고 학명이 pyrrhura molinae 인 듯.
즉, 위에 기재된 초록뺨비늘앵무고, 신고 제외대상이다. (2021.12.06) 라고 보면 될 듯.
| The green-cheeked parakeet (Pyrrhura molinae), known as the green-cheeked conure in aviculture, is a species of bird in subfamily Arinae of the family Psittacidae, the African and New World parrots.[3] It is found in Argentina, Bolivia, Brazil, and Paraguay. |
[링크 : https://en.wikipedia.org/wiki/Green-cheeked_parakeet]
+ end
부속서 2에 속한다고 했으니, 앵무목 전종이라고 봐야하려나?
| 국제적 멸종위기종 목록 [시행 2023. 2. 23.] [환경부고시 제2023-45호, 2023. 2. 23., 일부개정] ![]() ![]() ![]() |
[링크 : https://www.law.go.kr/행정규칙/국제적멸종위기종목록/(2023-45,20230223)]
| 수입 또는 반입이 가능한 국제적멸종위기종(조류, 포유류) [시행 2017. 1. 2.] [환경부고시 제2016-252호, 2017. 1. 2., 일부개정] |
[링크 : https://www.law.go.kr/행정규칙/수입또는반입이가능한국제적멸종위기종(조류,포유류)/(2016-252,20170102)]
| 수입 또는 반입이 가능한 국제적멸종위기종(조류, 포유류) [시행 2017. 1. 2.] [환경부고시 제2016-252호, 2017. 1. 2., 일부개정] 제2조(수입 또는 반입이 가능한 국제적멸종위기종) 수입 또는 반입이 가능한 국제적멸종위기종(조류, 포유류)은 앵무목(PSITTACIFORMES) 전 종, 문조(Lonchura oryzivora) 및 검은턱금정조(Poephila cincta cincta)이다. |
[링크 : https://www.law.go.kr/행정규칙/수입또는반입이가능한국제적멸종위기종(조류,포유류)/(2016-252,20170102)]
| 썬 코뉴어 앵무 (Sun Conure) 황금빛 태양을 닮았다고 해서 '썬코뉴어 앵무', '태양앵무' 라고 불립니다! 학명은 Aratinga solstitialis 입니다 ! (아라팅아,,솔스디셜리스...영어는 언제나 어렵습니다..^^) 썬코뉴어는 코뉴어 앵무(Pyrrhure molinae) 랑 다른 학명을 사용하고있습니다. Aratinga 종의 코뉴어들은 젠다이 코뉴어, 난데이 코뉴어, 블루 크라운 코뉴어, 레드막코뉴어 등이 속해 있습니다. |
[링크 : https://m.blog.naver.com/gozip14/221814526892]