Skip to content

jaysonsantos/cli-utils-rs

Repository files navigation

cli-utils

I will store some utilities that I used on day to day and I chose rust to be able to use the same utilities in unix and windows systems.

Installing the commands

To install you will need cargo installed. To install all binaries run:

cargo install \
    --git https://github.com/jaysonsantos/cli-utils-rs

To install a specific binary:

cargo install \
    --git https://github.com/jaysonsantos/cli-utils-rs \
    --bin aws-ssm-env-importer

Available commands

delete-line

delete-line simply delete a line in a file.

delete-line 0.1.0

USAGE:
    delete-line <file> <line_number>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

ARGS:
    <file>           
    <line_number>    Line number (1) or range (1-10)

delete-local-branches

delete-local-branches delete all local branches except current active branch in order to declutter

aws-flow-logs

aws-flow-logs parse aws flow logs in a bucket.

error: The following required arguments were not provided:
    <region>
    <bucket>
    <prefix>
    <filter_query>

USAGE:
    aws-flow-logs <region> <bucket> <prefix> <filter_query>

Examples

aws-flow-logs eu-central-1 bucket prefix/2019/04/24 'src.port in {80 443} && dstport == 55540 && dstip in {10.0.0.0/8} && action == "REJECT"'
Matched with FlowLogLine {
    version: "2",
    account_id: "x",
    interface_id: "eni-x",
    srcaddr: V4(
        127.0.0.1,
    ),
    dstaddr: V4(
        10.0.145.125,
    ),
    srcport: 443,
    dstport: 55540,
    protocol: "6",
    packets: "1",
    bytes: 40,
    start: 1556114469,
    end: 1556114525,
    action: "REJECT",
    log_status: "OK",
}

aws-ssm-env-importer

Import .env files into ssm using a template for the key.

USAGE:
    aws-ssm-env-importer [FLAGS] --app-name <app_name> --env-file <env_file> --environment <environment> --region <region> --template <template>

FLAGS:
    -d, --dry-run
    -h, --help         Prints help information
    -o, --overwrite
    -u, --uppercase
    -V, --version      Prints version information

OPTIONS:
    -a, --app-name <app_name>
    -f, --env-file <env_file>
    -e, --environment <environment>
    -r, --region <region>
    -t, --template <template>          Template to generate the key on SSM side, example
                                       "/{environment}/{app_name}/{key}"

Example

aws-ssm-env-importer \
    --env-file .env \
    --environment environment \
    --app-name test-app \
    --template "/{environment}/{app_name}/{key}" \
    --region eu-central-1 \
    --dry-run

aws-ssm-env-exporter

Export ssm keys to .env files.

USAGE:
    aws-ssm-env-exporter [FLAGS] [OPTIONS] --env-file <env-file> --path <path> --replace <replace> --search <search>

FLAGS:
    -h, --help         Prints help information
    -l, --lowercase    
    -u, --uppercase    
    -V, --version      Prints version information

OPTIONS:
    -f, --env-file <env-file>    
    -p, --path <path>            
    -r, --region <region>        
    -t, --replace <replace>      
    -e, --search <search>        

Example

aws-ssm-env-exporter \
    --env-file output.env \
    --path /my/app \
    --search '.+/(.[^/]*)$' \
    --uppercase \
    --replace $1

fix-ksql-deleted-topics

When running ksql, if you delete the topics for a stream instead of stopping the queries and then deleting the stream this can lead to really long load times on ksql. To fix the problem you first need to see the variable KSQL_KSQL_STREAMS_PRODUCER_MAX_BLOCK_MS with a lower value like 1000 and restart ksql.

Example

fix-ksql-deleted-topics http://ksql-host:port/ksql

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •