Skip to content

Instantly share code, notes, and snippets.

View ream88's full-sized avatar

Mario Uher ream88

View GitHub Profile
@ream88
ream88 / sse.exs
Created October 30, 2023 21:03
A compact Bandit HTTP server capable of replaying SSE events, such as those generated by ChatGPT
Mix.install([
{:bandit, ">= 1.0.0"}
])
defmodule SSE do
use Plug.Builder
require Logger
def init(options), do: options
@ream88
ream88 / chaos_server.exs
Last active February 16, 2023 14:03
Run it via: CHAOS=100 ./chaos_server.exs
#!/usr/bin/env elixir
# This is a small HTTP server that accepts requests and is designed to randomly
# fail, allowing other software to be tested for robustness.
Mix.install([
{:bandit, "~> 0.6.8"},
{:plug, "~> 1.14"}
])
@ream88
ream88 / move_number.exs
Created January 11, 2023 11:47
Move Twilio Phone Numbers between subaccounts
Mix.install([{:req, "~> 0.3.4"}])
defmodule MoveNumber do
@spec move(keyword()) :: nil
def move(opts) do
# Validate the keyword list
opts =
Keyword.validate!(opts, [
:twilio_account_sid,
:twilio_auth_token,
@ream88
ream88 / favro-export.exs
Created October 25, 2022 10:42
A small Elixir script that exports Favro collections and associated cards as JSON files
Mix.install([
{:jason, "~> 1.4"},
{:req, "~> 0.3.1"},
{:zarex, "~> 1.0"}
])
organization_id = "INSERT_ORGANIZATION_ID"
email = "INSERT_EMAIL"
api_token = "INSERT_API_TOKEN"
@ream88
ream88 / url.ex
Last active April 8, 2022 08:56
Convert a Zoom link into a zoomus:// link
#!/usr/bin/env elixir
[url] = System.argv()
%URI{path: "/j/" <> confno} = url = URI.parse(url)
url
|> Map.update!(:query, fn query ->
query
|> URI.decode_query()
|> Map.merge(%{action: "join", confno: confno})
@ream88
ream88 / twilio_json_response_to_xml.ex
Created March 30, 2022 16:24
Convert Twilio JSON responses to XML
#!/usr/bin/env elixir
Mix.install([
:jason,
:xml_builder
])
[input] = System.argv()
defmodule Helper do
@ream88
ream88 / index.html
Created September 23, 2021 07:22
Drop this into any website to play around with #Safari15 themed tabs!
<meta name="theme-color" content="#29B8FF" />
<input type="color" value="#29B8FF" id="colorPicker" />
<script>
const colorPicker = document.getElementById("colorPicker")
colorPicker.addEventListener("change", function() {
document
.querySelector("meta[name=theme-color]")
.setAttribute("content", colorPicker.value)
@ream88
ream88 / simplify_tracker_blocking.js
Created March 4, 2021 16:34
List of email spy pixels blocked by Simplify Gmail as of Feb 28, 2021
const trackers = {
"365offers.trade": "trk.365offers.trade",
"Absolutesoftware-email.com": "click.absolutesoftware-email.com\\/open.aspx",
"ActiveCampaign.com": "lt.php(.*)\\?l=open",
"ActionKit.com": "track.sp.actionkit.com\\/q\\/",
"Acoustic.com": "mkt\\d{4,5}.com/open",
"Adobe.com": [
"demdex.net",
"t.info.adobesystems.com",
"toutapp.com",
@ream88
ream88 / tracker_blocking.rb
Created March 4, 2021 16:34 — forked from dhh/tracker_blocking.rb
Current list of spy pixels named'n'shamed in HEY, as of April 23, 2020
module Entry::TrackerBlocking
extend ActiveSupport::Concern
included do
has_many :blocked_trackers
end
email_service_blockers = {
"ActiveCampaign" => /lt\.php(.*)?l\=open/,
"AWeber" => "openrate.aweber.com",
@ream88
ream88 / ShortUUID.elm
Created October 8, 2020 21:37
ShortUUID decode and encode in Elm
module ShortUUID exposing (decode, encode)
import BigInt exposing (BigInt)
import List.Extra as List
import String.Extra as String
abc : List Char
abc =
[ '1', '2', '3', '4', '5', '6', '7', '8', '9' ]