| Algorithm | Memory | Accuracy | Notes |
|---|---|---|---|
| HyperLogLog | Small | ~1% | Industry standard |
| CPC | Smaller | Apache DataSketches; more complex | |
| UltraLogLog | Very compact | Similar | Modern variant; even more complex |
| Algorithm | Memory | Accuracy | Notes |
|---|---|---|---|
| Count-Min Sketch | Small | ~1% | Simple, widely supported |
| Misra-Gries | Small | Exact top-K | Deterministic but less mergeable |
| Count Sketch | Small | Better for sparse data | Handles negative updates |
| SpaceSaving | Small | Accurate | Used in streaming systems |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| options_query: fn query, _assigns -> | |
| select_merge( | |
| query, | |
| [media], | |
| %{label: fragment("concat(?, ', ', ?)", media.caption, media.original_file)} | |
| ) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule Answer do | |
| use Ecto.Schema | |
| schema "answer" do | |
| field :word, :string | |
| field :length, :integer, virtual: true | |
| end | |
| end | |
| Repo.insert(%Answer{word: "SWANS"}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl -X 'GET' "$XENI_API_HOST/api/accommodation_searches/accommodation?search_id=962c9315-0e35-45e3-b158-be10c860912d&property_id=40553&raw=true" \ | |
| -H "accept: application/json" \ | |
| -H "authorization: bearer: $XENI_TOKEN" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl -X 'POST' \ | |
| "$XENI_API_HOST/api/accommodation_searches/search" \ | |
| -H "accept: application/json" \ | |
| -H "Content-Type: application/json" \ | |
| -H "authorization: bearer: $XENI_TOKEN" \ | |
| -d '{ | |
| "check_in": "2023-08-27", | |
| "check_out": "2023-08-30", | |
| "destination_id": "bbc35c49-d2a7-431a-ac40-a4944c3a00e7", | |
| "occupancies": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export XENI_API_HOST="https://xenitravelapi-beta01.gigalixirapp.com" | |
| export XENI_USER_EMAIL="[email protected]" | |
| export XENI_USER_PASSWORD="some password" | |
| export XENI_TOKEN=$(curl -X 'POST' $XENI_API_HOST/api/accounts/get_token \ | |
| -H 'accept: application/json' \ | |
| -H 'content-type: application/json' \ | |
| -d '{"user":{"email": "'"$XENI_USER_EMAIL"'", "password": "'"$XENI_USER_PASSWORD"'"}}' \ | |
| | sed "s/{.*\"token\":\"\([^\"]*\).*}/\1/g") | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl -X 'POST' "$XENI_API_HOST/api/accounts/get_token" \ | |
| -H "accept: application/json" \ | |
| -H "content-type: application/json" \ | |
| -d '{"user":{"email": "'"$XENI_USER_EMAIL"'", "password": "'"$XENI_USER_PASSWORD"'"}}' | |
| {"token":"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJ4ZW5pX3RyYXZlbF9hcGkiLCJleHAiOjE2OTI0MTA1ND9A"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # an alternative to "python -m json.tool" is "json_pp -json_opt pretty,canonical" | |
| curl -X 'GET' \ | |
| "$XENI_API_HOST/api/locations/search?starts_with=New%20York" \ | |
| -H "accept: application/json" \ | |
| -H "authorization: bearer: $XENI_TOKEN" \ | |
| | python -m json.tool | |
| { | |
| "data": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "category": "Hotel", | |
| "chainName": "HYATT", | |
| "checkinInfo": { | |
| "minAge": "0" | |
| }, | |
| "checkoutInfo": {}, | |
| "contact": { |