Skip to content

Instantly share code, notes, and snippets.

View avtaniket's full-sized avatar

aniket takarkhede avtaniket

  • India
View GitHub Profile
@avtaniket
avtaniket / Installing Apache Maven.txt
Created May 10, 2016 05:53
Installing Apache Maven
Download bin, extract archive and add bin folder to the PATH
$ wget http://mirror.fibergrid.in/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.zip
$ unzip apache-maven-3.3.9-bin.zip
$ export PATH=$PATH:/opt/apache-maven-3.3.9/bin
$ mvn -v
For more info, visit http://maven.apache.org/install.html
@avtaniket
avtaniket / AWS Swagger importer.txt
Last active May 11, 2016 12:57
AWS Swagger importer
$ git clone https://github.com/awslabs/aws-apigateway-swagger-importer.git
$ cd aws-apigateway-swagger-importer
$ mvn assembly:assembly
Create
$ ./aws-api-import.sh -c <path-to-local-swagger-json>
Update
$ ./aws-api-import.sh -u ze3xxxx9 /myappservices/api/swagger/swagger.yaml
@avtaniket
avtaniket / Swagger - URL & path parameters integration with AWS gateway.txt
Last active May 11, 2016 12:29
Swagger - URL & path parameters integration with AWS gateway
Swagger file need to update for URL & path parameters integration
Here
httpMethod - GET/POST/PUT/DELETE
uri - SWAGGER url
requestParameters - is optional if url contains param like {user_id}
x-amazon-apigateway-integration:
httpMethod: "POST"
uri: "http://54.193.106.251:10010/count/{user_id}"
type: "http"
responses:
@avtaniket
avtaniket / nodemailer_gmail.js
Created August 27, 2016 05:45
Send mail using Nodemailer Gmail SMTP
const gmailSMTP = {
"service": "Gmail",
"username": "usersdn@gmail.com",
"password": "22342@test",
"emailTo": "test.sdn@gmail.com"
};
var nodemailer = require('nodemailer');
var transporter = nodemailer.createTransport({
service: gmailSMTP.service,
@avtaniket
avtaniket / localhost to custom domain in ubuntu.txt
Created August 29, 2016 13:30
localhost to custom domain in ubuntu
Step 1: Add domain entry in hosts file (vim /etc/hosts)
127.0.0.1 dev.mywebsite.com
Step 2: Add redirection policy in IP-Tables
sudo iptables -t nat -A OUTPUT -o lo -p tcp --dport 80 -j REDIRECT --to-port 8888
@avtaniket
avtaniket / integrate-Owl-carousel-with-AngularJs.html
Last active July 25, 2019 02:07
How to integrate Owl carousel with AngularJs
@avtaniket
avtaniket / dynamic-Owl-carousel-with-AngularJs.html
Created September 8, 2016 13:34
How to integrate Owl carousel with AngularJs (Dynamic content)
@avtaniket
avtaniket / dynamic2-Owl-carousel-with-AngularJs.html
Created September 8, 2016 13:38
How to integrate Owl carousel with AngularJs (Dynamic content method 2)
@avtaniket
avtaniket / AWS SES send mail with attachment.js
Created November 24, 2016 05:27
AWS SES send mail with attachment
var nodemailer = require('nodemailer');
var sesTransport = require('nodemailer-ses-transport');
var transport = nodemailer.createTransport(sesTransport({
accessKeyId: "",
secretAccessKey: "",
region : 'us-west-2'
}));
var inputData = {
@avtaniket
avtaniket / Access-Control-Allow-Origin-and-credentials.js
Created December 28, 2016 07:09
A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true
Request error :
XMLHttpRequest cannot load https://subdomain.domain.com/api/campaign/auth/twitter. Response to preflight request doesn't pass access control check: A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin 'https://subdomain2.domain.com' is therefore not allowed access.
Solution :
var whitelist = ['https://subdomain.domain.com', 'https://subdomain2.domain.com'];
// All api requests
app.use(function (req, res, next) {
var origin = req.headers.origin;
if(whitelist.indexOf(origin) > -1){
res.header('Access-Control-Allow-Origin', origin);