Skip to content

Instantly share code, notes, and snippets.

View jquast's full-sized avatar
🐡
I may be slow to respond.

Jeff Quast jquast

🐡
I may be slow to respond.
View GitHub Profile
from types import ModuleType
import sys
class DoNotExecute(object):
def __init__(self, name):
self.name = name
def __call__(self):
raise RuntimeError, "{self.name}: Machine is busy, do not touch!".format(self=self)
class SelfWrapper(ModuleType):
KeyboardInterrupt
~/Code/telnetlib3 (master u=)$ ./examples/server.py --loglevel=debug
2014-02-02 13:27:11,728 INFO server.py:33 Listening on ('127.0.0.1', 6023)
2014-02-02 13:27:27,261 INFO server.py:156 Connection from 127.0.0.1:55996
2014-02-02 13:27:27,261 DEBUG server.py:643 env_update: {'REMOTE_IP': '127.0.0.1', 'REMOTE_PORT': '55996', 'REMOTE_HOST': '127.0.0.1'}
2014-02-02 13:27:27,262 DEBUG server.py:643 env_update: {'HOSTNAME': 'ee3gooGhloh3Aiw5cah5DieW.local'}
2014-02-02 13:27:27,262 DEBUG telopt.py:1973 pending_option[DO + TTYPE] = True
2014-02-02 13:27:27,262 DEBUG telopt.py:481 send IAC DO TTYPE
2014-02-02 13:27:27,262 DEBUG telsh.py:85 write: b'\r\ntelsh-0.1 % '
2014-02-02 13:27:27,262 DEBUG telopt.py:494 send IAC GA
/etc/x84/default.ini:
[door]
path = /bin:/usr/bin:/usr/local/bin:/usr/games
[dosemu]
enabled = yes
bin = /usr/bin/dosemu
home = /DOS
lord_path = /DOS/X/lord
vagrant@omnios-vagrant:~$ mkvirtualenv -vv -p `which python2.6` pexpect
Already using interpreter /usr/bin/python2.6
Creating pexpect/lib/python2.6
Symlinking Python bootstrap modules
Symlinking pexpect/lib/python2.6/lib-dynload
Symlinking pexpect/lib/python2.6/config
Symlinking pexpect/lib/python2.6/os.py
Ignoring built-in bootstrap module: posix
Symlinking pexpect/lib/python2.6/posixpath.py
Cannot import bootstrap module: nt
#!/usr/bin/env python
import itertools, sys, time, os
import cPickle as pickle
if not os.path.exists('./dict.pkl'):
dictionary = dict([(tuple(w.rstrip().lower()),0) for w in
open('/usr/share/dict/words','r').readlines() \
+ open('/usr/share/dict/web2','r').readlines()])
pickle.dump(dictionary, open('./dict.pkl','wb'), -1)
else:
dictionary = pickle.load(open('./dict.pkl','rb'))
@jquast
jquast / osx_pty.txt
Created March 17, 2014 05:32
osx pty
Python 2.7.6 (default, Jan 21 2014, 22:43:59)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pty, os, termios
>>> master, slave = pty.openpty()
>>> master, slave
(3, 4)
>>> termios.tcgetattr(master)
[11010, 3, 19200, 1483, 9600, 9600, ['\x04', '\xff', '\xff', '\x7f', '\x17', '\x15', '\x12', '\xff', '\x03', '\x1c', '\x1a', '\x19', '\x11', '\x13', '\x16', '\x0f', '\x01', '\x00', '\x14', '\xff']]
>>> termios.tcgetattr(slave)
>>> import pty, os, termios
>>> master, slave = pty.openpty()
>>> master, slave
(3, 5)
>>> termios.tcgetattr(master)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
termios.error: (22, 'Invalid argument')
>>> termios.tcgetattr(slave)
[9474, 6149, 189, 35387, 0, 13, ['\x03', '\x1c', '\x7f', '\x15', '\x04', '\x00', '\x00', '\x00', '\x11', '\x13', '\x1a', '\x19', '\x12', '\x0f', '\x17', '\x16', '\x00', '\x00', '\x00']]
(view as text)
tools/testall.py
in dir /tmp/pexpect-build (timeout 1200 secs)
watching logfiles {}
argv: ['tools/testall.py']
environment:
HOME=/export/home/vagrant
LANG=en_US.UTF-8
LOGNAME=vagrant
MAIL=/var/mail/vagrant
""""""""" ANYTHING!
" https://github.com/tpope/vim-pathogen
execute pathogen#infect()
syntax on
" increase scanlines for syntax highlighting
syntax sync minlines=300
set history=700
set pastetoggle=<F2>
import pprint
import Levenshtein # https://github.com/ztane/python-Levenshtein
targets = ['Redhat Enterprise Linux',
'Debian Lenny',
'CentOS corperate linux',
'Ubuntu Mugatu 14.2',
'The Startrek Enterprise',
'AT&T System V', ]