Write a program that connects to a Postgres database and stores contact information in a table.
Sample input:
$ go run .
First name: John
Last name: Smith| #!/bin/sh | |
| # /usr/lib/systemd/system-sleep/iwlwifi.sh | |
| # https://forums.linuxmint.com/viewtopic.php?t=413512 | |
| case $1/$2 in | |
| pre/*) | |
| modprobe -r iwlmld iwlmvm iwlwifi 2>/dev/null || true | |
| ;; |
| #!/usr/bin/env -S bash -e | |
| if [[ "$1" = "" ]]; then | |
| echo "Usage: ./calculate_time.sh FILE.csv" | |
| exit 1 | |
| fi | |
| FILE="$(realpath $1)" | |
| if [[ ! -f "$FILE" ]]; then |
| defmodule MyAppWeb.Api.Middleware.FormatPage do | |
| @behaviour Absinthe.Middleware | |
| def call(%{value: %Scrivener.Page{} = page} = res, _) do | |
| %{ | |
| entries: data, | |
| page_number: page_number, | |
| page_size: page_size, | |
| total_pages: total_pages, | |
| total_entries: total_entries |
| #!/bin/bash -e | |
| SAMPLES_PATH="$(pwd)/samples.csv" | |
| uname="$(uname)" | |
| # When on Windows, you need to pass the path as c:/path/to/file | |
| # rather than /c/path/to/file (as expected by PostgreSQL). | |
| if [[ "$uname" != "Linux" && "$uname" != "Darwin" ]]; then | |
| # remove the leading slash and replace the second slash with :/ |
| escape = fn str -> | |
| str | |
| |> Base.encode16() | |
| |> String.replace_prefix("", "&#x") | |
| |> String.replace_suffix("", ";") | |
| end | |
| String.replace(string, ~r/\W/, escape) |
| #!/bin/bash | |
| if [ "$1" = "" ]; then | |
| echo "No input file!" | |
| exit 1 | |
| fi | |
| cat $1 | \ | |
| jq -S 'del(.compatibilities, .registeredAt, .registeredBy, .requiresAttributes, .revision, .status, .taskDefinitionArn)' | \ | |
| sponge $1 |
| #!/bin/sh | |
| # Implies that AWS_PROFILE and AWS_REGION are set | |
| aws ecr list-images --repository-name $1 \ | |
| | jq -r '.imageIds[].imageTag' \ | |
| | xargs printf -- 'imageTag=%s\n' \ | |
| | xargs aws ecr batch-delete-image --repository-name $1 --image-ids |
| defmodule UnterEats.Paginatable do | |
| @callback base_query() :: Ecto.Queryable.t() | |
| @callback filter_by_params({atom(), term()}, Ecto.Queryable.t()) :: Ecto.Queryable.t() | |
| @optional_callbacks filter_by_params: 2 | |
| alias UnterEats.Repo | |
| def filter_and_paginate_resource(module, params) when is_atom(module) do | |
| query = module.base_query() |