View remove_email_signature.py
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
import talon | |
from talon import quotations | |
from talon.signature.bruteforce import extract_signature | |
import html2text | |
raw_text = '<div dir="ltr"><div>\n<span style="color:rgb(0,0,0);font-family:docs-Calibri;font-size:15px;white-space:pre-wrap">I have applied for PF final settlement on Apr 26 but till today i didnt get any update .i am requesting you to please speedup the process and settle amount. i have many commitments and medical emergency so please consider and do the needful earliest possible.</span><br><div><br></div><br><div dir="ltr" class="gmail_signature"><div dir="ltr">\n<div>Best,</div>\n<div><br></div>\n<div>Alfred Francis</div>\n<div>AI Architect, Cogniwide</div>\n<div>+91 701 209 7621</div>\n</div></div>\n</div></div>\n<br>\n\n' | |
text = html2text.html2text(raw_text) | |
text, signature = extract_signature(text) |
View WekaClassifier.java
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
import weka.classifiers.Evaluation; | |
import weka.classifiers.bayes.NaiveBayes; | |
import weka.classifiers.bayes.NaiveBayesMultinomial; | |
import weka.classifiers.meta.FilteredClassifier; | |
import weka.classifiers.Evaluation; | |
import weka.core.Instances; | |
import weka.core.Instance; | |
import weka.core.converters.ConverterUtils.DataSource; | |
import weka.core.Attribute; |
View celery_status_service.py
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
@app.route('/status/<task_id>') | |
def taskstatus(project_id,task_id): | |
task = long_process_task.AsyncResult(task_id) | |
if task.state == 'PENDING': | |
# job did not start yet | |
response = { | |
'state': task.state, | |
'current': 0, | |
'total': 1, | |
'status': 'Pending...' |
View progress.component.html
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
<div class="notification-progress" role="alert"> | |
<div class="notification-header"> | |
<span class="close" (click)="removeNotification(notification)">×</span> | |
<h3>{{notification.message}}</h3> | |
</div> | |
<div class="notification-body"> | |
<em class="notification-body-content">{{polling_status.status}}</em><br/> | |
<progress-bar [progress]="polling_status.current" [color-degraded]="{'0': '#ff7777', '35': '#e6ae48', '90': '#00cbcb'}"> | |
</progress-bar> | |
</div> |
View products.json
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
[{ | |
"title": "Brown eggs", | |
"category": "dairy", | |
"price": 28.1, | |
"rating": 4 | |
}, { | |
"title": "Sweet fresh stawberry", | |
"category": "fruit", | |
"price": 29.45, | |
"rating": 4 |
View tweets_to_db.py
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
""" | |
1. Setup a Twitter Developer account and create new App, get its consumer key and consumer secret and replace them below | |
2. Replace TWEETS_DB, QUERY, and LANGUAGE values | |
3. Install required packages: `pip install tweepy schedule` | |
4. Run process using `python tweets_to_db.py` | |
""" | |
import tweepy | |
import sqlite3 | |
import datetime |
View speeh.js
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
if (window.hasOwnProperty('webkitSpeechRecognition')) { | |
$(".mic-chat").css({ opacity: 1 }) | |
var SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition; | |
var recognition = new SpeechRecognition(); | |
recognition.continuous = false; | |
recognition.interimResults = false; | |
recognition.lang = "en-IN"; | |
recognition.start(); |
View base64_encode.py
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
import base64 | |
with open("yourfile.ext", "rb") as image_file: | |
encoded_string = base64.b64encode(image_file.read()) |
View docker-compose.traefik.demo.yml
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
version: '3' | |
services: | |
reverse-proxy: | |
# The official v2 Traefik docker image | |
image: traefik:v2.1 | |
# Enables the web UI and tells Traefik to listen to docker | |
command: | |
- --api.insecure=true | |
- --api.dashboard=true # <== Enabling the dashboard to view services, middlewares, routers, etc... |
View mongo_wordcloud.py
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
db.getCollection('cogniwidebot').aggregate([ | |
{ | |
"$project": { | |
"words": { "$split": ["$query", " "] } | |
} | |
}, | |
{ | |
"$unwind": { | |
"path": "$words" | |
} |
NewerOlder