7582
說明:
|
← 2018-02-11 21:34:51 修訂第 48 版 ⇥
6990
|
這個顏色代表刪除的 | 這個顏色代表增加的 |
行號 1: | 行號 1: |
## page was renamed from Python/編輯器 給剛入門寫程式的新手:挑一個裝得起來的【微 IDE】吧!功能太少或太多都是學習的絆腳石。 == 跨平台 IDE/Editors 參考 == === 從編輯器可以長到 IDE === * '''Emacs''', '''Vim''': ''"You knew it when you knew it"'' 上手門檻偏高,練到最後上手的話可以用到老的編輯器。 * [[https://atom.io/|Atom]] (by Github): ''"A hackable text editor for the 21st Century"'' * [[http://www.sublimetext.com/|Sublime Text]]: ''"a sophisticated text editor for code, markup and prose"'' === 微型 IDE === * [[http://thonny.cs.ut.ee|Thonny, Python IDE for beginners]]: a new Python IDE meant for teaching/learning programming. 主打用來教或學程式。推薦給沒有程式經驗的新手。 * [[http://www.pyzo.org|Pyzo]]: the Interactive Editor for Python. * 有人說安裝 10 分鐘後就可以開始專注於 coding 的 Python IDE。(舊版名為 IEP) * [[http://www.geany.org/|Geany]]: ''"provide a small and fast IDE"'' ([[http://wiki.geany.org/howtos/osx/running|to run on Mac]]) * [[http://blog.longwin.com.tw/2009/05/linux-develop-editor-geany-2009/|Linux 程式開發用編輯器 - Geany - Tsung's Blog]](官方有提供 Windows binary 安裝檔) * [[http://www.lighttable.com/|Light Table]]: ''"new interactive IDE that ... provides the real time feedback"'' 主打互動、立即得到程式回饋的 IDE。 === 中大型 IDE === * [[http://www.jetbrains.com/pycharm/|PyCharm]]: ''"complete set of tools for productive development with Python programming language"'' * [[http://www.pydev.org/|PyDev]]: Python IDE for '''Eclipse''', which may be used in Python, Jython and IronPython development. It comes with many goodies. * [[http://wingware.com/|Wing IDE]]: ''"IDE designed specifically for the Python programming language"'' * [[https://eric-ide.python-projects.org/|The Eric Python IDE]]: ''"...integrating the highly flexible Scintilla editor control. It is designed to be usable as everdays' quick and dirty editor as well as being usable as a professional project management tool integrating many advanced features Python offers the professional coder."'' * [[https://pythonhosted.org/spyder/|Spyder IDE]]: Scientific PYthon Development EnviRonment * [[http://ninja-ide.org/|NINJA IDE]]: ''"Ninja-IDE Is Not Just Another IDE"'' * [[http://www.activestate.com/komodo-edit|Komodo Edit]]: ''"lean editor with a sleek interface"'' == 各平台的編輯器 == Windows: * [[http://ez2learn.com/index.php/python-tutorials/python-basic-tutorials/158-python|IDLE]], [[http://notepad-plus-plus.org/|Notepad++]] * [[https://pytools.codeplex.com/|Python Tools for Visual Studio]] Mac: * [[http://www.barebones.com/products/textwrangler/|TextWrangler]], [[http://macromates.com/|Textmate (商業軟體)]] * [[http://sourceforge.net/projects/smultron/|Smultron 3.5.1 on SourceForce.com (自由軟體版)]], [[http://www.peterborgapps.com/smultron/|Smultron 官網&最新(付費)版本]] Linux: [[http://projects.gnome.org/gedit|gedit]], kate == 各別IDE/編輯器簡介 == === Wing IDE === 下載:http://wingide.com/wingide/trial?submit.x=44&submit.y=13 * Professional * Commercial USD 245 * Non-Commercial(students/teachers...) USD 95 * Personal USD 45 * Trial 版 10 天試用 === PyCharm === * 下載:http://www.jetbrains.com/pycharm/download/index.html * 版本與價格一覽:http://www.jetbrains.com/pycharm/buy/index.jsp * Trial 版 30 天試用 == 其它 == * [[http://docs.enthought.com/canopy/|Canopy]]: an advanced text editor, integrated IPython console, graphical package manager and online documentation to EPD. == 看起來沒有在維護了 == * [[http://editra.org/|Editra]]: ''"focuses on creating an easy to use interface and features that aid in code development"'' * [[http://sofree.cc/editra/|Editra 一款由Python開發的免費程式碼編輯器 - 香腸炒魷魚]] * 相比如 NINJA 帶著許多 IDE 的特色,Editra 的功能確實較偏於基本的 Editor。 == 列表 == 整理自新手詢問記錄: === On Facebook === * 2015-09-23 https://www.facebook.com/groups/pythontw/permalink/10154385834048438/ * 2015-09-20 https://www.facebook.com/groups/pythontw/permalink/10154375923063438/ * 2014-07-05 https://www.facebook.com/groups/pythontw/permalink/10153065481423438/ * 2013-08-01 https://www.facebook.com/groups/pythontw/doc/10152150387788438/ === 其它參考 === * [[http://www.tutorialgear.com/5-best-python-code-editors-ides-2017/|5 Best Python Code Editors (IDEs) 2017 - tutorialgear.com]] ||<tablewidth="100%" tablestyle="text-align:"> ||<style="text-align:center">Windows ||<style="text-align:center">Linux ||<style="text-align:center">MacOS || ||[[Sublime Text|Sublime Text 2]] ||<style="text-align:center">○ ||<style="text-align:center">○ ||<style="text-align:center">○ || ||Wing IDE ||<style="text-align:center">○ ||<style="text-align:center">○ ||<style="text-align:center">○ || ||PyCharm ||<style="text-align:center">○ ||<style="text-align:center">○ ||<style="text-align:center">○ || ||PythonWin ||<style="text-align:center">○ ||<style="text-align:center"> ||<style="text-align:center"> || ||PyScripter ||<style="text-align:center">○ ||<style="text-align:center"> ||<style="text-align:center"> || ||Komodo Edit ||<style="text-align:center">○ ||<style="text-align:center">○ ||<style="text-align:center">○ || ||SpyderLib ||<style="text-align:center">○ ||<style="text-align:center">○ ||<style="text-align:center">○ || ||Python Tools for Visual Studio ||<style="text-align:center">○ ||<style="text-align:center"> ||<style="text-align:center"> || ||Ninja IDE ||<style="text-align:center">○ ||<style="text-align:center">○ ||<style="text-align:center">○ || ||Vim ||<style="text-align:center">○ ||<style="text-align:center">○ ||<style="text-align:center">○ || ||Emacs + Elpy ||<style="text-align:center">○ ||<style="text-align:center">○ ||<style="text-align:center">○ || ||Gedit ||<style="text-align:center">○ ||<style="text-align:center">○ ||<style="text-align:center">○ || ||Notepad++ ||<style="text-align:center">○ ||<style="text-align:center"> ||<style="text-align:center"> || ||Scite ||<style="text-align:center">○ ||<style="text-align:center">○ ||<style="text-align:center"> || ||Eclipse + PyDev ||<style="text-align:center">○ ||<style="text-align:center">○ ||<style="text-align:center">○ || ||The Eric Python IDE ||<style="text-align:center">○ ||<style="text-align:center">○ ||<style="text-align:center">○ || ||Netbean + NBPython ||<style="text-align:center">○ ||<style="text-align:center">○ ||<style="text-align:center">○ || ||Geany ||<style="text-align:center">○ ||<style="text-align:center">○ ||<style="text-align:center"> || ||Kate ||<style="text-align:center"> ||<style="text-align:center"> ||<style="text-align:center"> || ||TextMate ||<style="text-align:center"> ||<style="text-align:center"> ||<style="text-align:center"> || ||TextWrangler ||<style="text-align:center"> ||<style="text-align:center"> ||<style="text-align:center"> || ||IDLE ||<style="text-align:center"> ||<style="text-align:center"> ||<style="text-align:center"> || 更多: * [[http://job.achi.idv.tw/2008/11/26/integrateddevelopmentenvironments/|Python整合發展環境- 工作達人(Job Da Ren)]] * [[http://wiki.python.org/moin/PythonEditors|Python Editors]] |
#!/usr/bin/python2.7 import sys import socket import threading import json from collections import OrderedDict import binascii import datetime import time def server_loop(local_host, local_port, remote_host, remote_port): # create the server object server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # lets see if we can stand up the server try: print "Daemon is launched, do not close this windows" server.bind((local_host, local_port)) except: print "[!!] Failed to listen on %s:%d" % (local_host, local_port) print "[!!] Check for other listening sockets or correct permissions" sys.exit(0) # listen with 5 backlogged--queued--connections server.listen(5) while True: client_socket, addr = server.accept() # print out the local connection information print"[+] Received incomming connections from %s:%d" % (addr[0], addr[1]) # start a new thread to talk to the remote host proxy_thread = threading.Thread(target=proxy_handler, args=(client_socket, remote_host, remote_port)) proxy_thread.daemon = False proxy_thread.start() def receive_from(connection): buffer = "" # We set a 2 second time out depending on your # target this may need to be adjusted connection.settimeout(0) try: # keep reading into the buffer until there's no more data # or we time out while True: data = connection.recv(4096) if not data: break buffer += data except: pass return buffer # modify any requests destined for the remote host def request_handler(socket_buffer): #Here is the good part #If it is an Auth packet if ('submitLogin' in socket_buffer) or ('eth_login' in socket_buffer): json_data = json.loads(socket_buffer, object_pairs_hook=OrderedDict) print('[+] Auth in progress with address: ' + json_data['params'][0]) #If the auth contain an other address than our if wallet not in json_data['params'][0]: print('[*] DevFee Detected - Replacing Address - ' + str(datetime.datetime.now())) print('[*] OLD: ' + json_data['params'][0]) #We replace the address json_data['params'][0] = wallet + worker_name print('[*] NEW: ' + json_data['params'][0]) socket_buffer = json.dumps(json_data) + '\n' #Packet is forged, ready to send. return socket_buffer # modify any responses destined for the local host def response_handler(buffer): return buffer def proxy_handler(client_socket, remote_host, remote_port): # We prepare the connection remote_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # We will try to connect to the remote pool for attempt_pool in range(3): try: remote_socket.connect((remote_host, remote_port)) except: print "[!] Impossible to connect to the pool. Try again in few seconds " time.sleep(2) else: # Connection OK break else: print "[!] Impossible initiate connection to the pool. Claymore should reconnect. (Check your internet connection) "+ str(datetime.datetime.now()) #Closing connection client_socket.shutdown(socket.SHUT_RDWR) client_socket.close() #Exiting Thread sys.exit() # now let's loop and reading from local, send to remote, send to local # rinse wash repeat while True: # read from local host local_buffer = receive_from(client_socket) if len(local_buffer): # send it to our request handler local_buffer = request_handler(local_buffer) #print local_buffer # Try to send off the data to the remote pool try: remote_socket.send(local_buffer) except: print "[!] Sending packets to pool failed." time.sleep(0.02) print "[!] Connection with pool lost. Claymore should reconnect. (May be temporary) "+ str(datetime.datetime.now()) #Closing connection client_socket.shutdown(socket.SHUT_RDWR) client_socket.close() #Exiting loop break # Adding delay to avoid too much CPU Usage time.sleep(0.001) # receive back the response remote_buffer = receive_from(remote_socket) if len(remote_buffer): # send to our response handler remote_buffer = response_handler(remote_buffer) #print local_buffer # Try to send the response to the local socket try: client_socket.send(remote_buffer) except: print('[-] Auth Disconnected - Ending Devfee or stopping mining - ' + str(datetime.datetime.now())) client_socket.close() break # Adding delay to avoid too much CPU Usage time.sleep(0.001) time.sleep(0.001) #Clean exit if we break the loop sys.exit() def main(): # cursory check of command line args if len(sys.argv[1:]) != 5: print "Usage: ./proxy.py [localhost] [localport] [remotehost] [remoteport] [ETH Wallet]" print "Example: ./proxy.py 127.0.0.1 9000 eth.realpool.org 9000 0x..." sys.exit(0) # set up listening parameters local_host = sys.argv[1] local_port = int(sys.argv[2]) # set up remote targets remote_host = sys.argv[3] remote_port = int(sys.argv[4]) # Set the wallet global wallet wallet = sys.argv[5] global worker_name worker_name = 'rekt' #Uncomment if you meet issue with pool or worker name - This will disable the worker name #worker_name = '' pool_slash = ['nanopool.org','dwarfpool.com'] pool_dot = ['ethpool.org','ethermine.org','alpereum.ch'] if worker_name: if any(s in remote_host for s in pool_slash): worker_name = '/' + worker_name elif any(d in remote_host for d in pool_dot): worker_name = '.' + worker_name else: #No worker name for compatbility reason print "Unknown pool - Worker name is empty" worker_name = '' print "Wallet set: " + wallet + worker_name # now spin up our listening socket server_loop(local_host, local_port, remote_host, remote_port) if __name__ == "__main__": main() |
import sys import socket import threading import json from collections import OrderedDict import binascii import datetime import time
def server_loop(local_host, local_port, remote_host, remote_port):
- # create the server object server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # lets see if we can stand up the server try:
- print "Daemon is launched, do not close this windows" server.bind((local_host, local_port))
- print "[!!] Failed to listen on %s:%d" % (local_host, local_port) print "[!!] Check for other listening sockets or correct permissions" sys.exit(0)
- client_socket, addr = server.accept() # print out the local connection information print"[+] Received incomming connections from %s:%d" % (addr[0], addr[1]) # start a new thread to talk to the remote host proxy_thread = threading.Thread(target=proxy_handler,
- args=(client_socket, remote_host, remote_port))
def receive_from(connection):
- buffer = "" # We set a 2 second time out depending on your # target this may need to be adjusted connection.settimeout(0) try:
- # keep reading into the buffer until there's no more data # or we time out while True:
- data = connection.recv(4096) if not data:
- break
- data = connection.recv(4096) if not data:
- pass
- # keep reading into the buffer until there's no more data # or we time out while True:
# modify any requests destined for the remote host def request_handler(socket_buffer):
- #Here is the good part #If it is an Auth packet if ('submitLogin' in socket_buffer) or ('eth_login' in socket_buffer):
json_data = json.loads(socket_buffer, object_pairs_hook=OrderedDict) print('[+] Auth in progress with address: ' + json_data['params'][0]) #If the auth contain an other address than our if wallet not in json_data['params'][0]:
print('[*] DevFee Detected - Replacing Address - ' + str(datetime.datetime.now())) print('[*] OLD: ' + json_data['params'][0]) #We replace the address json_data['params'][0] = wallet + worker_name print('[*] NEW: ' + json_data['params'][0])
# modify any responses destined for the local host def response_handler(buffer):
- return buffer
def proxy_handler(client_socket, remote_host, remote_port):
- # We prepare the connection remote_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # We will try to connect to the remote pool for attempt_pool in range(3):
- try:
- remote_socket.connect((remote_host, remote_port))
- print "[!] Impossible to connect to the pool. Try again in few seconds " time.sleep(2)
- # Connection OK break
- print "[!] Impossible initiate connection to the pool. Claymore should reconnect. (Check your internet connection) "+ str(datetime.datetime.now()) #Closing connection client_socket.shutdown(socket.SHUT_RDWR) client_socket.close() #Exiting Thread sys.exit()
- # read from local host local_buffer = receive_from(client_socket) if len(local_buffer):
- # send it to our request handler local_buffer = request_handler(local_buffer) #print local_buffer # Try to send off the data to the remote pool try:
- remote_socket.send(local_buffer)
- print "[!] Sending packets to pool failed." time.sleep(0.02) print "[!] Connection with pool lost. Claymore should reconnect. (May be temporary) "+ str(datetime.datetime.now()) #Closing connection client_socket.shutdown(socket.SHUT_RDWR) client_socket.close() #Exiting loop break
- # send to our response handler remote_buffer = response_handler(remote_buffer) #print local_buffer # Try to send the response to the local socket try:
- client_socket.send(remote_buffer)
- print('[-] Auth Disconnected - Ending Devfee or stopping mining - ' + str(datetime.datetime.now())) client_socket.close() break
- # send it to our request handler local_buffer = request_handler(local_buffer) #print local_buffer # Try to send off the data to the remote pool try:
- try:
def main():
- # cursory check of command line args if len(sys.argv[1:]) != 5:
- print "Usage: ./proxy.py [localhost] [localport] [remotehost] [remoteport] [ETH Wallet]" print "Example: ./proxy.py 127.0.0.1 9000 eth.realpool.org 9000 0x..." sys.exit(0)
#worker_name = pool_slash = ['nanopool.org','dwarfpool.com'] pool_dot = ['ethpool.org','ethermine.org','alpereum.ch'] if worker_name:
- if any(s in remote_host for s in pool_slash):
- worker_name = '/' + worker_name
- worker_name = '.' + worker_name
- #No worker name for compatbility reason print "Unknown pool - Worker name is empty"
worker_name =
if name == "main":
- main()