Skip to content

Instantly share code, notes, and snippets.

Avatar

Gabriel Jacoby-Cooper Gerzer

View GitHub Profile
@Gerzer
Gerzer / FTP sync.py
Last active Jan 18, 2018
Pythonista FTP sync
View FTP sync.py
import ui
import console
import keychain
import ftplib
import os
import re
import time
from datetime import datetime
global cur_dir
cur_dir = os.path.abspath(os.getcwd())
View Import File.py
# coding: utf-8
import appex
import os
import shutil
def main():
if not appex.is_running_extension():
print 'ERROR: This script is meant to be run from the sharing extension.'
else:
View Import URL.py
# coding: utf-8
import appex
import requests
def main():
if not appex.is_running_extension():
print 'Running in Pythonista app, using test data...\n'
url = 'http://example.com'
else:
View Snakeyes.py
import editor
full_text = editor.get_text()
cursor = editor.get_selection()[1]
while True:
try:
if full_text[cursor - 3] + full_text[cursor - 2] + full_text[cursor - 1] == 'def':
editor.replace_text(cursor, cursor, ' func_name():')
editor.set_selection(cursor + 1, cursor + 10)
if full_text[cursor - 3] + full_text[cursor - 2] + full_text[cursor - 1] == 'ifc':
editor.replace_text(cursor, cursor, ' condition:')
You can’t perform that action at this time.