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
counter = 0 | |
for dirpath, dirs, files in os.walk('tweets'): | |
for filename in fnmatch.filter(files, '*.txt'): | |
with codecs.open(os.path.join(dirpath, filename),'r',encoding="utf-8")as f: | |
for tweet in f: | |
try : | |
tweet_id = tweet.split("\t")[0] | |
tweet = tweet.split("\t")[1] | |
counter += 1 | |
# حذف منشن یا ااسمی افراد |
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
class TweetListener(StreamListener): | |
counter = 0 | |
def on_data(self, data): | |
try: | |
self.counter +=1 | |
json_data = json.loads(data) | |
Tweet_File_Name = 'tweets/'+datetime.now().strftime("%Y-%m-%d")+".txt" | |
with codecs.open(Tweet_File_Name, 'a',encoding="utf-8") as f: | |
if 'extended_tweet' in json_data: | |
if 'full_text' in json_data['extended_tweet']: |
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
# -*- coding: utf-8 -*-import twitter_config | |
from tweepy import OAuthHandler,Stream | |
from tweepy.streaming import StreamListener | |
import json, twitter_config | |
consumer_key = twitter_config.consumer_key | |
consumer_secret = twitter_config.consumer_secret | |
access_token = twitter_config.access_token | |
access_secret = twitter_config.access_secret |
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
worker_processes 2; | |
error_log /var/log/nginx/error.log; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
use epoll; | |
} |
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
x=2; | |
y=3.5 ; | |
z=4 | |
if x<y and z<=y : | |
print("not run") | |
elif x<y and z>y : | |
print(" Ok") | |
else: | |
print("not run this command") |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os.path | |
import tornado.httpserver | |
import tornado.ioloop | |
import tornado.options | |
import tornado.web | |
from pycket.session import SessionManager |
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
__author__ = 'Amir H. Nejati' | |
class SCAbstract(type): | |
################## Shared Connections ################## | |
__RepublishanDB = None | |
__BackendDB = None | |
__ElasticSearchConnection = None | |
__redisInstance = None | |
__redisInstanceRead = None |
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
class Application(tornado.web.Application): | |
def __init__(self): | |
handlers = [ | |
(r"/", IndexHandler), | |
(r"/upload", UploadHandler) | |
] | |
tornado.web.Application.__init__(self, handlers) | |
class IndexHandler(tornado.web.RequestHandler): | |
def get(self): |
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
#install and configure BIND9 DNS Server | |
#edit sudo nano /etc/bind/zones/foodlist.ir.db | |
# Add | |
@ IN MX 10 mx.zohomail.com. | |
@ IN MX 20 mx2.zohomail.com. | |
# sudo service bind9 restart |
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
#Reset All things | |
rabbitmqctl stop_app | |
rabbitmqctl reset | |
rabbitmqctl start_app | |
#List Queues | |
rabbitmqctl list_queues name messages messages_ready messages_unacknowledged |
NewerOlder