Skip to content

Instantly share code, notes, and snippets.

View jaeyson's full-sized avatar
🎯
Focusing

Jaeyson Anthony Y. ⚗️ jaeyson

🎯
Focusing
View GitHub Profile
defmodule Task do
defp await_one(tasks, timeout \\ 5_000) when is_list(tasks) do
awaiting =
Map.new(tasks, fn %Task{ref: ref, owner: owner} = task ->
if owner != self() do
raise ArgumentError, invalid_owner_error(task)
end
{ref, true}
end)
action :analyze_sentiment, :atom do
constraints one_of: [:positive, :negative]
description """
Analyzes the sentiment of a given piece of text to determine if it is overall positive or negative.
"""
argument :text, :string do
allow_nil? false
description "The text for analysis"
@jaeyson
jaeyson / common-lisp-VS-clojure.md
Created June 4, 2025 15:55 — forked from vindarel/common-lisp-VS-clojure.md
Notes on Common Lisp VS Clojure

Testimonies

CL's compiler

The thing in CL I miss most doing Clojure as my day job? CL's compiler. I like having a compiler tell me at compile time about the mistakes I've made. Bogus arguments. Unreachable code because of unhandled exceptions, and so on. CL saves me round after round of bugs that in clojure aren't found until you run the code. If you test well, it's found when testing, if you don't it's found in production. "Clojure compiler" almost demands air quotes.

CL's optional but oh-so-useful model of type declarations is also infinitely more useful (to me) than Clojure's use of "spec", and instrumentation that happens only at test time because of the cost. Depending on the OPTIMIZE declarations, other type defs are a floor wax and dessert topping. Want checks for argument types? Lower optimizations. Want most efficient machine code? High optimizations.

/u/Decweb, March 2023 https://www.reddit.com/r/lisp/comments/11ttnxk/the_rise_fall_of_lisp_too_good_for_the_rest_of/jczpysp/

@jaeyson
jaeyson / 00.imgproxy_vs_alternatives.md
Created May 27, 2025 03:12 — forked from DarthSim/00.imgproxy_vs_alternatives.md
imgproxy vs alternatives benchmark

imgproxy vs alternatives benchmark

Setup

  • c5.xlarge AWS instance: 4 CPUs, 8 GB RAM
  • Ubuntu 18.04
  • Go 1.12
  • Python 2.7
  • Vips 8.7.4
@jaeyson
jaeyson / elixir-coding-guidelines.mdc
Created May 26, 2025 01:27 — forked from thmsmlr/elixir-coding-guidelines.mdc
My cursorrules for elixir coding styles
When writing Elixir code, perfer the following style guidlines:
1. Elixir developers tend to create many small functions in their modules. I DO NOT LIKE THIS. Instead create functions that fully capture a conceptual task, even if it makes that function longer. A good rule of thumb is, if a private function is only called once within a module, it should've been inlined.
For example:
DON'T DO THIS:
```elixir
@jaeyson
jaeyson / core_components.ex
Created April 12, 2025 11:07 — forked from greven/core_components.ex
Phoenix CSS Icons
@doc """
Renders an icon.
Supports three icon libraries:
- [Heroicons](https://heroicons.com) - prefixed with "hero-"
- [Lucide](https://lucide.dev) - prefixed with "lucide-"
- [Simple Icons](https://simpleicons.org) - prefixed with "si-"
You can customize the size and colors of the icons by setting
width, height, and background color classes.
@jaeyson
jaeyson / cloud-files.md
Created April 8, 2025 12:15 — forked from atomkirk/cloud-files.md
Storing files on S3 with Elixir

I have this abstraction in my application code called a "CloudFile". This is where I store in the database information about files on S3 and it gives me a resource for other resources to own. For example, a user would have an avatar_cloud_file_id. On the front-end, I would load this relationship and display the avatar with user.avatar_cloud_file.download_url

defmodule RL.CloudFile do
  use Ecto.Schema
  import Ecto.Changeset

  @timestamps_opts type: :utc_datetime_usec
@jaeyson
jaeyson / README.md
Created February 7, 2025 10:37 — forked from thmsmlr/README.md
cmd+k for any terminal

These three scripts can provide you a cursor style CMD+K Like experience in any terminal.

How it works

  1. Set logged-shell to be your default shell for your terminal emulator. shell = /path/to/logged-shell in ~/.config/kitty/kitty.conf for kitty users.
  2. This will stream both the inputs and outputs of your terminal session into a file defined at $SHELL_LOG_FILE
  3. The ai-bash-command will take a user prompt, add the shell as context, and call OpenAI (with the ai command) to get the bash command that satisfies the prompt.
  4. It will type the results back into your terminal using wtype for wayland users.
@jaeyson
jaeyson / 1-setup.md
Created February 3, 2025 02:06 — forked from troyfontaine/1-setup.md
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

@jaeyson
jaeyson / firewall.sh
Created October 30, 2024 13:18 — forked from andrasbacsai/firewall.sh
Update a Hetzner Firewall rule with your IP address
#!/bin/bash
# Script to update a firewall rule in a Hetzner Firewall with your current IP address.
# Good if you would like to restrict SSH access only for your current IP address (secure).
#################
# WARNING: This script will overwrite all rules in the firewall rules, so make sure you
# added all the required rules.
# I use a separate firewall rule just for SSH access.
#################