This file contains hidden or 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
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): |
This file contains hidden or 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
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. |
This file contains hidden or 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 inspect | |
def f2(): | |
curframe = inspect.currentframe() | |
calframe = inspect.getouterframes(curframe, 2) | |
print 'caller name:', calframe[1][3] | |
if __name__ == '__main__': | |
f2() | |
This file contains hidden or 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
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 |
This file contains hidden or 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
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() |
This file contains hidden or 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
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 |
This file contains hidden or 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
=========================== | |
#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 |
This file contains hidden or 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
# 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='' |
This file contains hidden or 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
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): |
This file contains hidden or 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
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): |
OlderNewer