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
# -*- coding: utf-8 -*- | |
""" | |
Copyright 2018 Michael Ruggiero - This code is released under the MIT License. | |
Personal Request: If you find this useful, can you reach out to me on GitHub (create an issue, just email me michael AT ruggiero.co) I'd really love to see/hear how it was used. | |
Of course, it's MIT so you don't have to; just leave the copyright in-tact as per the license. | |
LICENSE: | |
Copyright 2018 Michael Ruggiero |
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
#!python3 | |
from ctypes import c_int, c_void_p, POINTER, byref, c_ulong | |
from objc_util import ( | |
load_framework, c, ns, ObjCInstance, nsdata_to_bytes, NSString, NSData, NSNumber, | |
ObjCClass, NSArray, NSDictionary | |
) | |
from enum import Enum, IntFlag | |
from typing import Union | |
import datetime |
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
#!python3 | |
import ui | |
from objc_util import ObjCInstance, ObjCClass, on_main_thread | |
from enum import Enum | |
from functools import partial | |
from collections import defaultdict | |
_LayoutConstraint = ObjCClass('NSLayoutConstraint') |
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
# coding: utf-8 | |
''' | |
NOTE: This requires the latest beta of Pythonista 1.6 (build 160022) | |
Demo of using Pythonista's own internals to implement an editor view with syntax highlighting (basically the exact same view Pythonista uses itself) | |
IMPORTANT: This is just for fun -- I was curious if it would work at all, but I don't recommend that you rely on this for anything important. The way Pythonista's internals work can change at any time, and this code is *very* likely to break in the future. | |
''' | |
import ui |
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
'''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 |
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
# Source: https://gist.github.com/5212628 | |
# | |
# All-purpose gist tool for Pythonista. | |
# | |
# When run directly, this script sets up four other scripts that call various | |
# functions within this file. Each of these sub-scripts are meant for use as | |
# action menu items. They are: | |
# | |
# Set Gist ID.py - Set the gist id that the current file should be | |
# associated with. |
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
package keystuff; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.security.KeyStore; | |
public class KeyUtils { | |
public static FileInputStream getFileInputStreamFromArg(String filePath) throws FileNotFoundException { |
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
#!/usr/bin/env python | |
import json, optparse, sys | |
try: | |
import PIL.Image, PIL.PngImagePlugin | |
except: | |
print >> sys.stderr, "Unable to import Python Imaging Library. Please ensure that it is installed." | |
sys.exit(1) |