defmodule Uploader do | |
@moduledoc """ | |
Source: https://samrat.me/til-file-uploads-using-the-req-elixir-library | |
v0.4.5 of Req don't support file upload. Might as well use multipart | |
""" | |
def transcribe_audio(file_path, token) do | |
model = "whisper-1" | |
filename = Path.basename(file_path) | |
{:ok, file_contents} = File.read(file_path) |
$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769
Note the running on port
for epmd
itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:
$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
#!/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. | |
################# |
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.
These three scripts can provide you a cursor style CMD+K Like experience in any terminal.
- 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. - This will stream both the inputs and outputs of your terminal session into a file defined at
$SHELL_LOG_FILE
- The
ai-bash-command
will take a user prompt, add the shell as context, and call OpenAI (with theai
command) to get the bash command that satisfies the prompt. - It will type the results back into your terminal using
wtype
for wayland users.
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
@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. |
see:
- https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts
- https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/
Below are quoted from this discussion:
Alerts are an extension of Markdown used to emphasize critical information. On GitHub, they are displayed ith distinctive colors and icons to indicate the importance of the content.
An example of all five types:
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 |