Skip to content

Instantly share code, notes, and snippets.

View Pratyum's full-sized avatar
🎯
Focusing

Pratyum Jagannath Pratyum

🎯
Focusing
View GitHub Profile
import stweet as st
from instadm import InstaDM
from instapy import InstaPy
import os
import openai
import pandas
import sendgrid
from sendgrid.helpers.mail import *
import datetime
import time
@Pratyum
Pratyum / get_message_stats.py
Created April 13, 2023 04:38
Sendgrid Message stats
def get_message_stats(email_id ,message_id):
# if message id is a string
if isinstance(message_id, str):
SENDGRID_API_KEY = os.environ.get('SENDGRID_API_KEY')
url = f'https://api.sendgrid.com/v3/messages'
headers = {'Authorization': f'Bearer {SENDGRID_API_KEY}'}
# add urls encoded params
params = {"query": f"to_email+LIKE+{email_id}"}
query_string = urlencode(params)
@Pratyum
Pratyum / send_email.py
Last active April 12, 2023 13:18
send_email
def send_email_via_sendgrid(body, to_email, from_email, reply_to_email, subject):
from_mail = Email(from_email, "Nats from Nas.io")
to_mail = To(to_email)
content = Content("text/plain", body)
mail = Mail(from_mail, to_mail, subject, content)
mail.reply_to = ReplyTo(reply_to_email)
mail.tracking_settings = TrackingSettings(
click_tracking=ClickTracking(enable=False),
open_tracking=OpenTracking(enable=True))
@Pratyum
Pratyum / The Technical Interview Cheat Sheet.md
Created November 1, 2016 02:55 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@Pratyum
Pratyum / gist:ace841b48ca2f7c52f83
Created November 7, 2015 15:27
find day of week
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss");
String dateInString = showDate+" "+showTime+":00";
Date date = null;
try {
date = sdf.parse(dateInString);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
int day = date.getDay();
<div id="wufoo-z1rlns4v1oupyc4">
Fill out my <a href="https://ntuoss.wufoo.com/forms/z1rlns4v1oupyc4">online form</a>.
</div>
<div id="wuf-adv" style="font-family:inherit;font-size: small;color:#a7a7a7;text-align:center;display:block;">Online contact and registration forms from <a href="http://www.wufoo.com">Wufoo</a>.</div>
<script type="text/javascript">var z1rlns4v1oupyc4;(function(d, t) {
var s = d.createElement(t), options = {
'userName':'ntuoss',
'formHash':'z1rlns4v1oupyc4',
'autoResize':true,
'height':'575',
<ion-view view-title="Add Hotel" name="login-view">
<ion-content class="padding tripsy-bg">
<ion-list class="list-inset">
<div class="item item-body">
<img class="full-image" src="http://placehold.it/800x300">
</div>
<label class="item item-input">
<div class="input-label">
Location
<ion-view view-title="Add New Employee" name="login-view">
<ion-content class="padding tripsy-bg">
<div class="list list-inset tripsy-bg">
<label class="item item-input item-floating-label no-top-border">
<span class="input-label white-color">Employee Name</span>
<input type="text" placeholder="Name" ng-model="EmpName">
</label>
<label class="item item-input item-floating-label">
<span class="input-label white-color">Employee Code</span>
<input type="text" placeholder="Code" ng-model="Empcode">
<ion-view view-title="To Do">
<ion-content class="tripsy-bg">
<div class="list card">
<div class="item item-avatar">
<img src="img/dining.jpg">
<h2>Conference at Company Headquarters</h2>
<p>August 31, 2015</p>
</div>
<div class="item item-body">