• Unattended apt security upgrade

    One of the first things for security of servers is to update packages for security patches:

    Tags:

  • rkhunter

    After reading the shocking sshd backdoor story, I decided to install rkhunter for rootkit detection. Here’s the configuration changes I’ve made. In /etc/rkhunter.conf.local: And in /etc/rkhunter.conf, I have commented out MAIL_CMD and MAIL-ON-WARNING. (You need to make sure that your email works on the servers, before this.) Finally, make the rkhunter update properly by modifying…

    Tags:

  • Flask의 request

    Flask의 request는 PEP 567의 Context Variables을 Werkzeug의 LocalProxy로 구현한 객체입니다. Context Variables은 thread local을 개선합니다. This concept is similar to thread-local storage (TLS), but, unlike TLS, it also allows correctly keeping track of values per asynchronous task, e.g. asyncio.Task. https://peps.python.org/pep-0567/ LocalProxy는 매번 컨텍스트를 ContextVar.get() 을 사용할 필요 없이 마치 로컬 객체처럼 다루게 해줍니다. 아래 코드의 _request와…

    Tags:

  • How to limit or cap google cloud budget

    The documents are there, but a bit hard to comprehend and follow. So I’m writing the steps here. Firstly, create a budget. I am receiving email alerts already when the 50%, 70%, etc. of budget is hit. It can be set up following this. Now you need to shutdown your service if the budget reaches…

    Tags:

  • Foundation of vector retrieval

    Gemeni 가 1M 토큰 컨텍스트를 들고 나왔지만 잘 정리된 논문 같아서 읽어보았습니다. Pinecone의 research scientist 가 작성한 논문 Foundations of Vector Retrieval 입니다. 아래는 공부하면서 정리한 노트입니다. 35/203 Inner product은 데이터 전처리를 해주면 cosine similarity, Euclidean distance 와 같아져 그 둘의 일반화이다. 단 거리로서의 기준인 non negativity, coincidence (자기 자신이 자기 자신과 유사도가 가장 높은…

  • How to install mongodb on crostini (or, debian bookwarm)

    If you come across libssl1.1 issue, there’s an option of installing the library via ubuntu repository OR installing the mongodb itself from ubuntu repository. I personally prefer the latter since I don’t like having a single apt setting just for a single lib. Just follow https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/. If you don’t know if you’re on bookwarm, this…

    Tags:

  • 메트릭에 근간한 개발

    구글이 공유한 머신 러닝의 첫번째 규칙은 “Don’t be afraid to launch a product without machine learning.” 이다. 이를통해 가장 먼저 메트릭을 정의하고, 동작하는 파이프라인을 만들고, 실패하고, 펑가하고, 개선할 수 있기 때문이다. Stripe의 머신 러닝 엔지니어인 Emmanuel Ameisen 역시 “ML is an iterative process where the fastest way to make progress is to see how a…

  • How to reliably use llm to get json outputs

    When using LLM, esp., for getting json output, there are many things that go wrong. I’ll explain some of them in this post. Prompt First is to ask LLM to generate json as output. I use the following: Every LLM generates all the different errors. Tweak the above as necesary. Parsing Even with a strong…

    Tags:

  • .[x]profile, .[x]rc files

    I always forget what those .bash_profile, .bashrc, .zprofile, .zshrc do, so I’m summarizing them here: What does this mean? It’s natural for some code appear in both .profile and .rc, e.g., pyenv recommends it if certain non interactive login shell script relies on the pyenv.

    Tags:

  • How to fix impersonation error in using vertexai

    Somehow the authentication part isn’t easy to find in a single place, so I’m adding it. For local dev, run: That’ll make your code to use your own google account. After that, restart your dev environment to use it. If your code is running in Google Compute Engine (GCE) or Cloud Run, you need to…

    Tags: