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 socket | |
def sockrecv(sock): | |
d = '' | |
while not d or d[-1] != '\n': | |
d += sock.recv(8192) | |
return d | |
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
# Enable tab completion | |
import rlcompleter | |
import pdb | |
pdb.Pdb.complete = rlcompleter.Completer(locals()).complete | |
# Sometimes when you do something funky, you may lose your terminal echo. This | |
# should restore it when spanwning new pdb. | |
import termios, sys | |
termios_fd = sys.stdin.fileno() | |
termios_echo = termios.tcgetattr(termios_fd) |