This file contains 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 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 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="some@email.com" | |
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 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 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 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": { |
This file contains 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
batch_size = 100 | |
# 8 tasks running at the same time and we don't care about the results order | |
async_options = [max_concurrency: 8, ordered: false] | |
csv_rows | |
|> Stream.chunk(batch_size) | |
|> Task.async_stream(fn batch -> | |
batch | |
|> Enum.map(&CSV.generate_xml/1) |
This file contains 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
# | |
# Define a simple slug type stating the source for the slug and the primary key field name | |
# see documention https://hexdocs.pm/ecto_autoslug_field/readme.html | |
# | |
defmodule CheckpointCharlie.PlayPen.Slug do | |
use EctoAutoslugField.Slug, from: :name, to: :id | |
end |
This file contains 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
import hashlib | |
from functools import wraps | |
from django.core.cache import cache | |
from django.utils.encoding import force_text, force_bytes | |
def cache_memoize( | |
timeout, | |
prefix='', |
This file contains 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
sudo apt-get update -y | |
sudo apt-get upgrade -y | |
wget -qO - http://packages.confluent.io/deb/3.2/archive.key | sudo apt-key add - | |
sudo add-apt-repository "deb [arch=amd64] http://packages.confluent.io/deb/3.2 stable main" | |
sudo apt-get update && sudo apt-get install confluent-platform-oss-2.11 | |
sudo apt-get install librdkafka-dev | |
ldconfig -p | grep librdkafka |
NewerOlder