Skip to content

Instantly share code, notes, and snippets.

View PandaWhoCodes's full-sized avatar

Thomas Ashish Cherian PandaWhoCodes

View GitHub Profile
@PandaWhoCodes
PandaWhoCodes / emailWeekly.js
Created December 10, 2016 09:27
Sending weekly emails using nodemailer
'use strict';
var nodemailer = require('nodemailer');
var schedule = require('node-schedule');
//configure nodemailer
// visit: https://nodemailer.com/
// For other types of transports (Amazon SES, Sendgrid,mailchimp...) see https://nodemailer.com/2-0-0-beta/setup-transporter/
// visit the following to get a more rudimentary usage of nodemailer
// https://gist.github.com/reach2ashish/4bce68c3e5950916320b5bbcca0cf6b8
var mailTransport = nodemailer.createTransport('smtps://<user>%40gmail.com:<password>@smtp.gmail.com');
@PandaWhoCodes
PandaWhoCodes / gmail.js
Last active December 10, 2016 09:28
Send mail using Gmail in node.js using nodemailer
'use strict';
var nodemailer = require('nodemailer');
//configure nodemailer
// visit: https://nodemailer.com/
// For other types of transports (Amazon SES, Sendgrid,mailchimp...) see https://nodemailer.com/2-0-0-beta/setup-transporter/
var mailTransport = nodemailer.createTransport('smtps://<user>%40gmail.com:<password>@smtp.gmail.com');
function senEmail(email) {
var mailOptions = {
from: '"Ashish Cherian" <noreply@yourdomain.com>',
@PandaWhoCodes
PandaWhoCodes / getRSS.py
Created December 11, 2016 10:46
Getting the RSS feed link from a simple google search
import requests
from bs4 import BeautifulSoup
def get_rss_feed(website_url):
if website_url is None:
print("URL should not be null")
else:
source_code = requests.get(website_url)
plain_text = source_code.text
soup = BeautifulSoup(plain_text)
@PandaWhoCodes
PandaWhoCodes / angusAgeRecog.py
Created December 11, 2016 11:03
Angus Age Recognition Python
import angus
conn = angus.connect()
service = conn.services.get_service('age_and_gender_estimation', version=1)
job = service.process({'image': "http://i.imgur.com/U0wgzIT.jpg"})
print(job.result)
@PandaWhoCodes
PandaWhoCodes / arduinoDisplay.cpp
Created December 17, 2016 19:11
A better way to display large texts in your arduino uno 16 x 2 display without using the display scroll function
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int okay=0;
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
@PandaWhoCodes
PandaWhoCodes / findSlackBot.py
Created December 21, 2016 04:45
TO find the slack bot ID
import os
from slackclient import SlackClient
BOT_NAME = 'YOUR BOT NAME WHICH YOU GAVE EXAMPLE @SOMETHINGBOT'
slack_client ="YOUR API KEY"
if __name__ == "__main__":
api_call = slack_client.api_call("users.list")
if api_call.get('ok'):
@PandaWhoCodes
PandaWhoCodes / amazon-rekognition.md
Created March 31, 2017 15:24 — forked from alexcasalboni/amazon-rekognition.md
Amazon Rekognition - Python Code Samples

Amazon Rekognition - Python Code Samples

  1. Labels Detection
  2. Faces Detection
  3. Faces Comparison
  4. Faces Indexing
  5. Faces Search
@PandaWhoCodes
PandaWhoCodes / FacebookVerify.py
Created May 21, 2017 10:15
Facebook checks to see if the endpoint provided is valid or not.
@app.route('/', methods=['GET'])
def verify():
# when the endpoint is registered as a webhook, it must echo back
# the 'hub.challenge' value it receives in the query arguments
if request.args.get("hub.mode") == "subscribe" and request.args.get("hub.challenge"):
if not request.args.get("hub.verify_token") == os.environ["VERIFY_TOKEN"]:
return "Verification token mismatch", 403
return request.args["hub.challenge"], 200
return "Hello world", 200
@PandaWhoCodes
PandaWhoCodes / recieve_fb_data.py
Created May 21, 2017 10:19
When your facebook page recieves a message, the following code is used to extract the vital information from the message.
@app.route('/', methods=['POST'])
def webhook():
# endpoint for processing incoming messaging events
data = request.get_json()
log(data) # you may not want to log every incoming message in production, but it's good for testing
if data["object"] == "page":
def send_message(recipient_id, message_text):
#setting the parameters for the request
params = {
"access_token": os.environ["PAGE_ACCESS_TOKEN"]
#another way you can do this is
# "access_token": "YOUR PAGE ACCESS TOKEN"
}
headers = {
"Content-Type": "application/json"
}