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 argparse | |
# this first bit is to enable multiline help text. apparently this is a known problem with argparse. | |
# Solution jacked from http://stackoverflow.com/questions/3853722/python-argparse-how-to-insert-newline-in-the-help-text | |
import textwrap as _textwrap | |
class MultilineFormatter(argparse.HelpFormatter): | |
def _fill_text(self, text, width, indent): | |
text = self._whitespace_matcher.sub(' ', text).strip() | |
paragraphs = text.split('|n ') |
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
# Very simple SSH client for Pythonista | |
import paramiko | |
import console | |
ssh = paramiko.SSHClient() | |
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | |
host = console.input_alert('Connect to') | |
user, passwd = console.login_alert('Login') | |
ssh.connect(host, username=user, password=passwd) | |
print 'Connected to %s. Type `exit` to disconnect.' % host |
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
'''FTP server for Pythonista (iOS) | |
You can use this to exchange files with a Mac/PC or a file management app on the same device (e.g. Transmit). | |
If you use a Mac, you can connect from the Finder, using the "Go -> Connect to Server..." menu item. | |
''' | |
import os | |
from socket import gethostname |