<feed xmlns="http://www.w3.org/2005/Atom"> <id>https://andrei.fokau.se/</id><title>Andrei Fokau</title><subtitle>Personal blog/notebook containing tips and code snippets for various applications.</subtitle> <updated>2024-05-28T12:08:45+02:00</updated> <author> <name>Andrei Fokau</name> <uri>https://andrei.fokau.se/</uri> </author><link rel="self" type="application/atom+xml" href="https://andrei.fokau.se/feed.xml"/><link rel="alternate" type="text/html" hreflang="en" href="https://andrei.fokau.se/"/> <generator uri="https://jekyllrb.com/" version="4.3.3">Jekyll</generator> <rights> © 2024 Andrei Fokau </rights> <icon>/assets/img/favicons/favicon.ico</icon> <logo>/assets/img/favicons/favicon-96x96.png</logo> <entry><title>The Tale of Five Monkeys</title><link href="https://andrei.fokau.se/5-monkeys" rel="alternate" type="text/html" title="The Tale of Five Monkeys" /><published>2024-05-13T00:00:00+02:00</published> <updated>2024-05-13T22:27:23+02:00</updated> <id>https://andrei.fokau.se/5-monkeys</id> <content src="https://andrei.fokau.se/5-monkeys" /> <author> <name>Andrei Fokau</name> </author> <summary> The following story, though often presented as an experiment, is apocryphal and serves as a metaphor rather than a real scientific account. It’s used in business and social sciences to illustrate the power of cultural inertia and the difficulty of introducing change into systems resistant to it. Imagine five monkeys placed in a cage. In the middle of the cage there is a ladder, at the to... </summary> </entry> <entry><title>Multi-user Git config</title><link href="https://andrei.fokau.se/multi-user-git" rel="alternate" type="text/html" title="Multi-user Git config" /><published>2024-04-06T00:00:00+02:00</published> <updated>2024-04-07T11:23:19+02:00</updated> <id>https://andrei.fokau.se/multi-user-git</id> <content src="https://andrei.fokau.se/multi-user-git" /> <author> <name>Andrei Fokau</name> </author> <summary> Having multiple accounts on GitHub (e.g. one private and one or more for work) requires setting up either custom hosts or setting per-repo local config. Signed commits would require local config anyway, so we can skip messing with hosts and just make a few shell functions to help us to configure each repo. First of all, we will need some global settings. We can configure them to use our pri... </summary> </entry> <entry><title>DLQ dump with Bun</title><link href="https://andrei.fokau.se/dlq-dump-with-bun" rel="alternate" type="text/html" title="DLQ dump with Bun" /><published>2024-04-05T00:00:00+02:00</published> <updated>2024-04-05T22:08:22+02:00</updated> <id>https://andrei.fokau.se/dlq-dump-with-bun</id> <content src="https://andrei.fokau.se/dlq-dump-with-bun" /> <author> <name>Andrei Fokau</name> </author> <summary> Using sh() helper from the previous post we can make a script for dumping DLQ locally for inspecting failed events. const queue_url = Bun.argv[2]; ( await sh(`aws sqs receive-message`, { 'queue-url': queue_url, 'max-number-of-messages': 10, }).json() ).Messages.forEach(async (msg) =&amp;gt; { await Bun.write(`messages/${msg.MessageId}.json`, JSON.stringify(msg, null, 2)); await s... </summary> </entry> <entry><title>Bun shell for multiline commands</title><link href="https://andrei.fokau.se/bun-shell-multiline" rel="alternate" type="text/html" title="Bun shell for multiline commands" /><published>2024-04-05T00:00:00+02:00</published> <updated>2024-04-05T21:41:43+02:00</updated> <id>https://andrei.fokau.se/bun-shell-multiline</id> <content src="https://andrei.fokau.se/bun-shell-multiline" /> <author> <name>Andrei Fokau</name> </author> <category term="Bun" /> <summary> Bun shell is great for shorter commands, but when they become too long, then it gets a bit tricky. Thankfully, there is {raw: } feature, that can help us to handle numerous arguments and long commands. Let’s make a helper function sh(): import { $ } from "bun"; function sh(...args) { const raw = args.map((a) =&amp;gt; { if (Array.isArray(a)) { return a.map(String).join(' '); } ... </summary> </entry> <entry><title>Using AWS CLI with Bun</title><link href="https://andrei.fokau.se/aws-cli-bun" rel="alternate" type="text/html" title="Using AWS CLI with Bun" /><published>2024-04-04T00:00:00+02:00</published> <updated>2024-04-04T21:55:02+02:00</updated> <id>https://andrei.fokau.se/aws-cli-bun</id> <content src="https://andrei.fokau.se/aws-cli-bun" /> <author> <name>Andrei Fokau</name> </author> <category term="AWS" /> <summary> In order to use both AWS CLI and Bun together, we need to put them on the same image. We can use public.ecr.aws/aws-cli/aws-cli as base and then add the Bun binary. The standard way of installing Bun is: curl -fsSL https://bun.sh/install | bash but for our narrow use-case we can just pick relevant commands from the script: FROM public.ecr.aws/aws-cli/aws-cli RUN yum update -y &amp;amp;&amp;amp; \... </summary> </entry> </feed>
