Skip to content

Instantly share code, notes, and snippets.

View abhigenie92's full-sized avatar
🤫
Hungry

Abhishek Bhatia abhigenie92

🤫
Hungry
View GitHub Profile
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.common.exceptions import StaleElementReferenceException, TimeoutException
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from bs4 import BeautifulSoup
import urllib,requests,unidecode,lxml
class wait_for_more_than_n_elements_to_be_present(object):
@abhigenie92
abhigenie92 / AndroidDebug.txt
Created August 31, 2015 22:22
AndroidDebug
D/CMBaseReceiver( 1678): com.cleanmaster.login.bindphone.mobileinfo.h 0ms
I/Timeline( 1640): Timeline: Activity_launch_request id:org.test.myapp time:2789192
I/ActivityManager( 758): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.test.myapp/org.renpy.android.PythonActivity (has extras)} from uid 10025 on display 0
V/WindowManager( 758): addAppToken: AppWindowToken{2a0ae0d0 token=Token{25714893 ActivityRecord{1c033982 u0 org.test.myapp/org.renpy.android.PythonActivity t8020}}} to stack=1 task=8020 at 0
W/BroadcastQueue( 758): Permission Denial: broadcasting Intent { act=com.android.launcher3.action.LAUNCH flg=0x10 (has extras) } from com.cyanogenmod.trebuchet (pid=1640, uid=10025) requires com.google.android.launcher.permission.RECEIVE_LAUNCH_BROADCASTS due to receiver com.google.android.googlequicksearchbox/com.google.android.search.core.icingsync.ApplicationLaunchReceiver
W/BroadcastQueue( 758): Permission Denial: receiving Intent { act=com.android.
import inspect
def f2():
curframe = inspect.currentframe()
calframe = inspect.getouterframes(curframe, 2)
print 'caller name:', calframe[1][3]
if __name__ == '__main__':
f2()
I want to plot the number of items in each quarter of the year. But the results are incorrect.
'incorrect'- There are more items in the earlier years plotted than later. Though analyzing the dataset it should be opposite.
df.head()
date username
0 2007-08-09 ginaemiko
1 2007-07-30 AtomAnt
2 2008-07-08 RecoveryTweet
3 2008-07-05 RecoveryTweet
4 2008-06-29 lwu
I have a flask server for voip application. I user sends a http request and then I open port for sending data between clients
communicating.
I use twisted to create reactor and transfer the data between clients. The reactor is created in the flask function which responds
to the http reqeust.
@app.route('/start_server',methods=['POST'])
def start_server():
port = reactor.listenTCP(0, Factory())
port.getHost().port
reactor.run()
Application Code(/var/www/klein_app/home.py):
=========
from klein import Klein
app = Klein()
@app.route('/')
def index(request):
return 'foo'
# expose a 'resource' name for use with twistd web
===========================
#stroke_client.py
from twisted.internet import protocol
class StrokeClient(protocol.Protocol):
def connectionMade(self):
print "Connected to remote server"
def dataReceived(self,data):
pass
# stroke_client.py
from twisted.internet.protocol import Protocol, ClientFactory
class StrokeClientFactory(ClientFactory):
def buildProtocol(self, addr):
return StrokeClient(self)
class StrokeClient(Protocol):
def __init__(self, factory):
self. factory = factory
self.recv_data=''
from twisted.internet.protocol import Protocol, Factory
class StrokeEcho(Protocol):
def __init__(self, factory):
self.factory = factory
def connectionMade(self):
print self
self.factory.echoers.append(self)
def dataReceived(self, data):
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
class EchoClientDatagramProtocol(DatagramProtocol):
def startProtocol(self):
self.transport.connect('127.0.0.1', 8000)
self.sendDatagram()
def sendDatagram(self):