분류
-
Python: 사진 to pdf 파일 변환컴퓨터/파이썬 2021. 10. 23. 23:56
사진 파일들을 pdf에 담을 간단한 작업이 자주 필요했다. 아래를 실행하면 원하는 사진들이 "~~. pdf"로 저장된다. 사용법 pdf.py에 코드를 저장하고 argument를 전달한다. -f (필수) 뒤 사진들 | -p (옵션) 저장할 경로 | -n (옵션) 원하는 pdf 이름 # 사용법 python pdf.py -f 1.jpg E:\2.jpg python pdf.py -f 1.jpg E:\2.jpg -p "E:\" pdf.py from argparse import ArgumentParser from PIL import Image import os import random # 기본 저장되는 경로 PATH = "C:\\Users\\user\\Desktop\\" if __name__ == "__main__..
-
Python: 간단한 streamlit 앱 만들면서 배운 점컴퓨터/파이썬 2021. 9. 19. 14:34
streamlit 만든 것 데이터 앱을 쉽고 예쁘게 만들 수 있는 streamlit, mongoDB 필터링 기능도 익힐 겸 아래의 값들에 따라 필터링을 해서 테이블을 업데이트한다. (자동으로 공지들을 db에 저장하고 있다.) 구조 처음에 st.slider, st.multiselect 와 같은 위젯들 on_change에 callback 함수를 추가해서 그 함수에서 값들을 받고, 필터를 만들고, global 테이블을 업데이트했다. st.title("title") my_table = st.empty() def update_notice(): global my_table global categories my_table.empty() filter = {} try: # whenever I change category..
-
Floating Parsing: Eisel-Lemire algorithm컴퓨터/Rust 2021. 9. 14. 18:13
Eisel-Lemire algorithm lemire: Fast function to parse strings into double (binary64) floating-point values, enforces the RF Fast function to parse strings into double (binary64) floating-point values, enforces the RFC 7159 (JSON standard) grammar: 4x faster than strtod - GitHub - lemire/fast_double_parser: Fast function... github.com Introduction Eisel lemire 알고리즘은 나온지 얼마되지 않은 플롯 파싱 알고리즘이다. 플롯 파..
-
Rust: chrono, timezone 예제컴퓨터/Rust 2021. 9. 8. 19:55
chrono GitHub - chronotope/chrono: Date and time library for Rust Date and time library for Rust. Contribute to chronotope/chrono development by creating an account on GitHub. github.com 예제 이 crate는 rust에서 date를 쉽게 이용할 수 있게 도와준다. timezone을 쓰기 위해서 파이썬에서처럼 별도의 라이브러리가 필요하다. chrono_tz GitHub - chronotope/chrono-tz: TimeZone implementations for rust-chrono from the IANA database TimeZone implementati..
-
Rust: Cross compile to linux on windows컴퓨터/Rust 2021. 8. 30. 13:00
Rust Rust Programming Language A language empowering everyone to build reliable and efficient software. www.rust-lang.org Rust 크로스 컴파일 윈도우 10에서 AWS EC2에서 사용할 바이너리를 빌드할 것이다. (x86_64-unknown-linux) 1. 타겟 추가 rustup target add x86_64-unknown-linux 2. WSL 2 실행 bash 3. cargo config 프로젝트에서 bash를 해서 build 하면 권한 문제가 발생할 수 있다. 프로젝트 최상위에 .cargo 폴더를 만들고 config 파일을 만들어서 아래처럼 수정한다. (.cargo/config) (env를 .bash..
-
Rust: actix + MongoDB컴퓨터/Rust 2021. 8. 28. 09:59
actix std::io::Result { // MongoDB Client let client_options = ClientOptions::parse(project::MONGO_URL).await.unwrap(); let client = web::Data::new(Mutex::new(Client::with_options(client_options).unwrap())); // start http server HttpServer::new(move || { App::new() .app_data(client.clone()) // store db pool in app state .wrap(middleware::Logger::default()) .service(project::hello::hello) }) .bin..
-
Zorin OS 16 사진컴퓨터 2021. 8. 24. 20:22
linux distribution 특정 개발 작업을 하기 위해 윈도우10과 함께 듀얼 부팅을 하기 위해 설치해보았다. 스팀도 built-in에 속도도 나쁘지 않으며, Win+Mac 스타일에 리눅스를 사용하는 기분이다. 좀 더 편의성을 원하면 하모니카 KR 운영체제도 괜찮을 것 같다. Zorin The creators of Zorin OS, the alternative to Windows and macOS designed to make your computer faster, more powerful, secure, and privacy-respecting. zorin.com 리눅스 커뮤니티 하모니카(HamoniKR) hamonikr.org
-
FastAPI + discord.py snippet컴퓨터/파이썬 2021. 8. 24. 09:31
FastAPI 서버와 discord.py 서버를 같이 실행시키고 싶었다. unvicorn.run 한 후에 startUp 함수에서 bot.start를 하는 방법도 있었는데 자꾸 봇이 offline으로 가게 되었다. Python import discord from discord.ext import commands from fastapi import FastAPI from uvicorn import Config, Server TOKEN = "토큰" intents = discord.Intents.all() bot = commands.Bot(command_prefix="#", intents=intents) @bot.event async def on_message(message): if message.content..