Skip to content

Instantly share code, notes, and snippets.

Abhishek Soni abhisheksoni27

Block or report user

Report or block abhisheksoni27

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@abhisheksoni27
abhisheksoni27 / aws-sns-example.js
Created Aug 3, 2019 — forked from tmarshall/aws-sns-example.js
aws-sdk sns example, in Node.js
View aws-sns-example.js
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: '{AWS_KEY}',
secretAccessKey: '{AWS_SECRET}',
region: '{SNS_REGION}'
});
var sns = new AWS.SNS();
View SOTorrent.sql
SELECT
p.Id,
c.Text
FROM
[sotorrent-org:2018_09_23.Posts] p
INNER JOIN
[sotorrent-org:2018_09_23.Comments] c
ON
p.Id = c.PostId
WHERE
View CNN-Colab.py
import tensorflow as tf
from tensorflow import keras
from tensorflow.python.keras.applications.inception_resnet_v2 import preprocess_input
from tensorflow.python.keras.models import load_model
from tensorflow.python.keras.applications.inception_resnet_v2 import InceptionResNetV2
from tensorflow.python.keras.applications.mobilenet import preprocess_input
from tensorflow.python.keras.applications.mobilenet import MobileNet
from tensorflow.python.keras.preprocessing.image import ImageDataGenerator
import numpy as np
import cv2
View CNN-Colab-Error.log
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-183-74b2cf4f5e86> in <module>()
----> 1 model = load_model('muteTV.h5')
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/saving.py in load_model(filepath, custom_objects, compile)
227 raise ValueError('No model found in config file.')
228 model_config = json.loads(model_config.decode('utf-8'))
--> 229 model = model_from_config(model_config, custom_objects=custom_objects)
230
View clean_text - 2.py
"""
Removes the matches and
replace them with an empty string
"""
chatText = regexMedia.sub("", chatText)
chatText = regexDate.sub("", chatText)
lines = []
for line in chatText.splitlines():
View clean_text - 1.py
import re
mediaPattern = r"(\<Media omitted\>)" # Because it serves no purpose
regexMedia = re.compile(mediaPattern, flags=re.M)
dateAndTimepattern = r"(\d+\/\d+\/\d+)(,)(\s)(\d+:\d+)(\s)(\w+)(\s)(-)(\s\w+)*(:)"
regexDate = re.compile(dateAndTimepattern, flags=re.M)
View emotions.py
import sys
import re
import matplotlib.pyplot as plt
import nltk
from utilities import cleanText
from nltk.sentiment.vader import SentimentIntensityAnalyzer
sentiment_analyzer = SentimentIntensityAnalyzer() # Our Great Sentiment Analyzer
def analyze(name):
View analyse_chat.py
import sys
from collections import Counter
import re
import matplotlib.pyplot as plt
import numpy as np
from utilities import cleanText
def analyze(name):
linesText = cleanText(name + ".txt")
View clean_text.py
import re
mediaPattern = r"(\<Media omitted\>)" # Because it serves no purpose
regexMedia = re.compile(mediaPattern, flags=re.M)
dateAndTimepattern = r"(\d+\/\d+\/\d+)(,)(\s)(\d+:\d+)(\s)(\w+)(\s)(-)(\s\w+)*(:)"
regexDate = re.compile(dateAndTimepattern, flags=re.M)
def cleanText(filename):
chat = open(filename)
View test_chat.txt
10/09/16, 6:10 PM - Person 1: Person 2?
10/09/16, 7:10 PM - Person 2: Yes?
10/09/16, 8:10 PM - Person 1: How are you?
10/09/16, 9:10 PM - Person 2: Idk. You?
10/09/16, 10:10 PM - Person 1: I just got a new phone
10/09/16, 11:10 PM - Person 2: Which one?
10/09/16, 12:10 AM - Person 1: I showed you?
10/09/16, 1:10 AM - Person 2: Cool
10/09/16, 2:10 AM - Person 1: Tes
10/09/16, 3:10 AM - Person 1: Yes
You can’t perform that action at this time.