Skip to content

Instantly share code, notes, and snippets.

@iotspace
iotspace / aws.py
Created July 15, 2024 02:43 — forked from rizerzero/aws.py
check S3 bucket exists with python
from aws import bucket_exists, upload_path
bucket_name = 'cnns-music-vids'
directory_to_upload = 'data/'
output_s3_directory = 'data/'
if bucket_exists(bucket_name):
print('the bucket exists!')
else:
raise ValueError('nah the bucket does not exist')
@iotspace
iotspace / nvmCommands.js
Created July 10, 2024 07:28 — forked from chranderson/nvmCommands.js
Useful NVM commands
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node
@iotspace
iotspace / Install-AWS-SAM.sh
Created July 2, 2024 03:39 — forked from singledigit/Install-AWS-SAM.sh
Install AWS SAM on Linux using the new Linux installer
curl -L https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip -o aws-sam-cli-linux-x86_64.zip
unzip aws-sam-cli-linux-x86_64.zip -d sam-installation
sudo ./sam-installation/install
where sam
sam --version
@iotspace
iotspace / work-with-multiple-github-accounts.md
Created August 25, 2023 11:17 — forked from rahularity/work-with-multiple-github-accounts.md
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@iotspace
iotspace / mysql-docker.sh
Created March 23, 2022 04:38 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@iotspace
iotspace / boto3-resource-profile.py
Created December 22, 2021 03:49 — forked from kheast/boto3-resource-profile.py
How to get boto3.resource to use a profile from credentials file
# To get boto3.resource to use a profile name, one must first
# setup a default session. The credentials provided during the
# session setup will be subsequently used by resource().
#
# See: https://github.com/boto/boto3/issues/21
# https://github.com/boto/boto3/pull/69
boto3.setup_default_session(profile_name=self.dpkg.profile_name)
self.ec2 = boto3.resource('ec2', region_name=self.dpkg.region_name)
filters = [{'Name': 'instance-state-name', 'Values': ['running']}]
for inst in self.ec2.instances.filter(Filters=filters):

Get DynamoDB Local on Docker:

This will get it going:

$ docker run -itd --name dynamodb-local -p 8000:8000 rbekker87/dynamodb-local:latest

For Data Persistence:

@iotspace
iotspace / tar_examples.md
Created September 24, 2021 14:04 — forked from fakemelvynkim/tar_examples.md
tar examples

Tar Command Examples

options

-c  create
-x  extract
-v  verbose mode
-f  filename
-t  view content of archive file.
-j  bzip2

-z gzip

@iotspace
iotspace / combineS3Files.py
Created May 7, 2021 04:01 — forked from jasonrdsouza/combineS3Files.py
Python script to efficiently concatenate S3 files
'''
This script performs efficient concatenation of files stored in S3. Given a
folder, output location, and optional suffix, all files with the given suffix
will be concatenated into one file stored in the output location.
Concatenation is performed within S3 when possible, falling back to local
operations when necessary.
Run `python combineS3Files.py -h` for more info.
'''
@iotspace
iotspace / log.py
Created January 17, 2021 14:58 — forked from batzner/log.py
Python logging helper module
"""Helper module for logging.
Example Usage:
from log import get_logger, get_out_dir_of_logger
LOG = get_logger(__name__)
LOG.info('Logging to %s' % get_out_dir_of_logger(LOG))
"""