How to zip multiple files into one zip file.
Using zip.
zip test.zip *.txt |
Using tar.
tar cvzf test.tar.gz *.txt |
Untar in current directory or specify another directory.
tar xvzf test.tar.gz . tar xvzf test.tar.gz -C /path/to/dir |
cloud engineer
How to zip multiple files into one zip file.
Using zip.
zip test.zip *.txt |
zip test.zip *.txt
Using tar.
tar cvzf test.tar.gz *.txt |
tar cvzf test.tar.gz *.txt
Untar in current directory or specify another directory.
tar xvzf test.tar.gz . tar xvzf test.tar.gz -C /path/to/dir |
tar xvzf test.tar.gz . tar xvzf test.tar.gz -C /path/to/dir
How to clone repositories with multiple Github accounts.
git clone git@github.com-yourgitaccount:yourgitaccount/myrepo.git |
git clone git@github.com-yourgitaccount:yourgitaccount/myrepo.git
Here’s how to sync S3 buckets between 2 different AWS accounts. Assuming buckets are already created.
Account A bucket permissions. Account and user are from Account B.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "DelegateS3Access", "Effect": "Allow", "Principal": {"AWS": "arn:aws:iam::222222222222:user/Jane"}, "Action": ["s3:ListBucket","s3:GetObject"], "Resource": [ "arn:aws:s3:::awsexamplesourcebucket/*", "arn:aws:s3:::awsexamplesourcebucket" ] } ] } |
{ "Version": "2012-10-17", "Statement": [ { "Sid": "DelegateS3Access", "Effect": "Allow", "Principal": {"AWS": "arn:aws:iam::222222222222:user/Jane"}, "Action": ["s3:ListBucket","s3:GetObject"], "Resource": [ "arn:aws:s3:::awsexamplesourcebucket/*", "arn:aws:s3:::awsexamplesourcebucket" ] } ] }
Create IAM user (Jane) in Account B
aws iam create-user --user-name Jane |
aws iam create-user --user-name Jane
Give IAM user (Jane) access to both buckets.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:GetObject" ], "Resource": [ "arn:aws:s3:::awsexamplesourcebucket", "arn:aws:s3:::awsexamplesourcebucket/*" ] }, { "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:PutObject", "s3:PutObjectAcl" ], "Resource": [ "arn:aws:s3:::awsexampledestinationbucket", "arn:aws:s3:::awsexampledestinationbucket/*" ] } ] } |
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:GetObject" ], "Resource": [ "arn:aws:s3:::awsexamplesourcebucket", "arn:aws:s3:::awsexamplesourcebucket/*" ] }, { "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:PutObject", "s3:PutObjectAcl" ], "Resource": [ "arn:aws:s3:::awsexampledestinationbucket", "arn:aws:s3:::awsexampledestinationbucket/*" ] } ] }
Sync the buckets
aws s3 sync s3://awsexamplesourcebucket s3://awsexampledestinationbucket |
aws s3 sync s3://awsexamplesourcebucket s3://awsexampledestinationbucket
Here’s how to copy multiple files recursively using AWS CLI. The S3 cp command by default only copies a single file. To copy multiple files, you have to use the –recursive option along with –exclude and –include. In this example, we will exclude every file, but include only files with a json extension.
aws s3 cp /tmp/folder s3://bucket/folder \ --recursive --exclude "*" --include "*.json" |
aws s3 cp /tmp/folder s3://bucket/folder \ --recursive --exclude "*" --include "*.json"
The result:
upload: ./abc.json to s3://bucket/folder/abc.json upload: ./xyz.json to s3://bucket/folder/xyz.json |
upload: ./abc.json to s3://bucket/folder/abc.json upload: ./xyz.json to s3://bucket/folder/xyz.json
Here’s how to start multiple instances using Bash and Google SDK.
#!/bin/bash while IFS=', ' read -r a b c; do instance="${a//[[:blank:]]/}" project="${b//[[:blank:]]/}" zone="${c//[[:blank:]]/}" echo "Starting $instance ...." gcloud compute instances start $instance \ --zone $zone --project $project --async done < instance-list.txt |
#!/bin/bash while IFS=', ' read -r a b c; do instance="${a//[[:blank:]]/}" project="${b//[[:blank:]]/}" zone="${c//[[:blank:]]/}" echo "Starting $instance ...." gcloud compute instances start $instance \ --zone $zone --project $project --async done < instance-list.txt
Instances are read from an external file. The file format is displayed below.
server1,project1,us-central1-a server2,project2,us-central1-b server3,project3,us-central1-c |
server1,project1,us-central1-a server2,project2,us-central1-b server3,project3,us-central1-c
To stop multiple instances, replace “start” with “stop.”
If you have a long list of words laid out on a page (see list below), it might be better to place them in a multi-column page format. CSS3 makes this entirely possible without using tables or multiple divs. All we need is a single div for the entire list. In this example, we will work with a list of animals. We will use a div class called “animals.”
To use multi-columns, we simply style the div with:
.animals {-moz-column-count:3; -webkit-column-count:3; column-count:3;} |
.animals {-moz-column-count:3; -webkit-column-count:3; column-count:3;}
Multi-column divs is supported on Firefox, Safari, Chrome and IE browsers.
Just change the numbers to make multiple columns.