Skip to content

Instantly share code, notes, and snippets.

@toranb
toranb / speech_to_text.exs
Created April 23, 2023 16:53
single liveview file showing speech to text with bumblebee and whisper
Application.put_env(:sample, PhoenixDemo.Endpoint,
http: [ip: {127, 0, 0, 1}, port: 8080],
server: true,
live_view: [signing_salt: "bumblebee"],
secret_key_base: String.duplicate("b", 64),
pubsub_server: PhoenixDemo.PubSub
)
Mix.install([
{:plug_cowboy, "~> 2.6"},
@andreaseriksson
andreaseriksson / convert_to_verified_routes.ex
Last active March 25, 2025 14:01
This is a mix task for converting old Phoenix routes to new verified routes
defmodule Mix.Tasks.ConvertToVerifiedRoutes do
@shortdoc "Fix routes"
use Mix.Task
@regex ~r/(Routes\.)(.*)_(path|url)\(.*?\)/
@web_module MyAppWeb
def run(_) do
Path.wildcard("lib/**/*.*ex")
@ftes
ftes / dijkstra.livemd
Created December 12, 2022 19:42
Elixir Dijkstra's Shortest Path Algorithm

dijkstra

Mix.install(
  [
    {:kino, "~> 0.7.0"},
    {:vega_lite, "~> 0.1.6"},
    {:kino_vega_lite, "~> 0.1.7"}
@PJUllrich
PJUllrich / big-o.md
Last active December 14, 2025 22:47
Big-O Time Complexities for Elixir Data Structures

Big-O Time Complexities for Elixir data structures

Map [1]

Operation Time Complexity
Access O(log n)
Search O(log n)
Insertion O(n) for <= 32 elements, O(log n) for > 32 elements [2]
Deletion O(n) for <= 32 elements, O(log n) for > 32 elements
@avoidik
avoidik / README.md
Last active December 24, 2022 12:53
Wireguard P2P

Point A - Server

Steps

sudo apt-get update
sudo apt-get install wireguard
sudo su -
cd /etc/wireguard
umask 077; wg genkey | tee privatekey | wg pubkey > publickey
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
...
##
# Until this commit is merged and released by rack
#
gem 'rack', git: 'https://github.com/rack/rack.git', ref: 'c859bbf7b53cb59df1837612a8c330dfb4147392'
...
@Loriowar
Loriowar / [email protected]
Last active May 14, 2023 13:02
Systemd unit for multiprocess sidekiq. Based on example unit from official sidekiq page on GitHub.
# https://github.com/mperham/sidekiq/blob/master/examples/systemd/sidekiq.service
#
# systemd unit file for CentOS 7, Ubuntu 15.04
#
# Customize this file based on your bundler location, app directory, etc.
# Put this in /usr/lib/systemd/system (CentOS) or /lib/systemd/system (Ubuntu).
# Run:
# - systemctl enable sidekiq
# - systemctl {start,stop,restart} sidekiq
#
* API FOR GET REQUESTS
// most simple and returns iata code
https://airport-autosuggest.flightright.net/v1/airports/COM?name=london
// connected to kiwi.com, but you can still use it for autocompletes and has a lot of information
https://api.skypicker.com/locations/?term=london
* BELOW API IS FOR POST REQUESTS
// related to openflights data or a simple text autocomplete
class Home::IndexPage < MainLayout
def content
Kilt.embed "my_page.slang", io_name: @view
end
end