Created
January 19, 2018 06:19
-
-
Save malkitsingh/7f17f0a544d7348c2df42aa2a53ccc8a to your computer and use it in GitHub Desktop.
some of node code snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// to upload file to s3 bucket. | |
var AWS = require('aws-sdk'); | |
AWS.config = new AWS.Config(); | |
AWS.config.accessKeyId = "XXX"; | |
AWS.config.secretAccessKey = "XXXXX"; | |
AWS.config.region = "ap-south-1"; | |
var s3 = new AWS.S3(); | |
// inside method where u want to upload | |
var myBucket = 'picubed/college-logos'; // bucket name or full path where you want to upload | |
var myKey = 'stage.png'; // file name with extension | |
params = { | |
Bucket: myBucket, | |
Key: myKey, | |
Body: data, | |
ContentType: 'image/png', | |
ACL:'public-read' | |
}; | |
s3.upload(params, function (err, data) { | |
console.log('came in to put s3 bucket'); | |
if (err) { | |
console.log(err) | |
} else { | |
console.log(data); | |
console.log("Successfully uploaded data to myBucket/myKey"); | |
} | |
res.json({ | |
'is it happening': 'yes it is' | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Install chrome on ubuntu
Before installing the Google Chrome Browser, you need to find out whether your Ubuntu system is 32-bit or 64-bit. Once you determine your system type, use the following command to add key.
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
The sample output should be like this –
ok
To set the repository, use the following command –
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
To install Chrome Browser, use the following commands –
To open chrome from terminal, use the following command –
google-chrome
To remove google chrome from Ubuntu, use the following commands