Skip to content

Instantly share code, notes, and snippets.

shakyaabiral /
Created January 29, 2020 23:22
Run Ecs Task get log and exit code
TASK_INFO=$(aws ecs run-task \
--region ap-southeast-2 \
--cluster "$CLUSTER" \
--task-definition "$TASKDEF" \
--overrides '{"containerOverrides": [{"name": "'"$CONTAINERNAME"'", "command": ["sh", "-c", "'"$COMMAND"'"]}]}')
TASK_ARN=$(echo "$TASK_INFO" | jq --raw-output ".tasks[0].taskArn")
shakyaabiral /
Created September 13, 2018 04:40
Python Download file from ftp
from ftplib import FTP
import os
with FTP('FTP_HOSTNAME') as ftp:
ftp.login('FTP_USERNAME', 'FTP_PASS')
ftp.cwd('[DIRECTORYNAME_IN_FTP_SERVER]') # navigate to desired directory in ftp server
filenames = ftp.nlst() # gives you a list of of files in the current directory
localfilepath = os.path.join('path','to','local','filename') # filename with complete path to where you would like to download the file
with open(localfilepath, 'wb') as local_file:
ftp.retrbinary('RETR [SOURCE_FILE_NAME]', local_file.write) # replace [SOURCE_FILE_NAME] with name of the file in ftp server that you want to download
shakyaabiral / bumpversion.php
Last active August 17, 2020 02:18
Bumpversion for php application
View bumpversion.php
* Creates a VERSION file if not exists in current directory.
* Version should be in the format. {Major.Minor.Patch}
* Patch has a suffix -dev for non release version
* Usage:
* php bumpversion.php [options]
* options:
* --version [part] (required)
shakyaabiral /
Last active April 6, 2021 14:53
Python Script to dump or load data using redis
Install the following requirements into your virtual environemnt
`pip install click redis`
To load data into redis
python load [filepath]
To dump data into redis
python dump [filepath] --search '*txt'