Pyto is a Python 3.8 IDE for iPhone and iPad. Run code directly on your device and offline.
Features:
- Python 3.8 with all standard libraries
- Full Python REPL
- Code user interfaces
- Smart code completion
- Use pip to install pure Python modules from PyPi
- Access scripts from everywhere
- Preview images and plots on console
- Multiple windows for iPadOS 13+
- Run scripts and code from Siri Shortcuts
- Interact with other apps thanks to x-callback urls
Included libraries: Numpy, Matplotlib, Pandas, Pillow, SciPy, SciKit-Learn, SciKit-Image, OpenCV,
Lxml, Biopython, Cryptography, Bcrypt, and more!
Exclusive libraries:
- pyto_ui - Build an user interface
- pyto_core - Extend the editor
- notification_center - Customize Today Widgets
- notifications - Schedule notifications
- remote_notifications - Receive remote notifications
- sharing - Share items and pick files
- pasteboard - Clipboard access
- userkeys - Save values on disk
- sound - Play sounds
- music - Access the Apple Music library
- photos - Accessing photos and the camera
- location - Access user's location
- multipeer - Peer to peer wireless connection
- xcallback - Interact with other apps
- apps - Open third party apps
Building
$ ./setup.sh and build the Pyto target from Pyto.xcworkspace
This project has a git submodule, make sure to clone with --recurse-submodules or run git submodule update --init after cloning.
You'll need these things to build the project:
Python 3
Ninja
Meson (pip install meson)
Clang and LLD (on mac, brew install llvm, on linux, sudo apt install clang lld or sudo pacman -S clang lld or whatever)
sqlite3 (this is so common it may already be installed on linux and is definitely already installed on mac. if not, do something like sudo apt install libsqlite3-dev)
Build for iOS
Open the project in Xcode, open iSH.xcconfig, and change ROOT_BUNDLE_IDENTIFIER to something unique. Then click Run. There are scripts that should do everything else automatically. If you run into any problems, open an issue and I'll try to help.
Build command line tool for testing
To set up your environment, cd to the project and run meson build to create a build directory in build. Then cd to the build directory and run ninja.
To set up a self-contained Alpine linux filesystem, download the Alpine minirootfs tarball for i386 from the Alpine website and run the tools/fakefsify.py script. Specify the minirootfs tarball as the first argument and the name of the output directory as the second argument. Then you can run things inside the Alpine filesystem with ./ish -f alpine /bin/login -f root, assuming the output directory is called alpine.
You can replace ish with tools/ptraceomatic to run the program in a real process and single step and compare the registers at each step. I use it for debugging. Requires 64-bit Linux 4.11 or later.
Logging
iSH has several logging channels which can be enabled at build time. By default, all of them are disabled. To enable them:
In Xcode: Set the ISH_LOG setting in iSH.xcconfig to a space-separated list of log channels.
With Meson (command line tool for testing): Run meson configure -Dlog=".
Available channels:
strace: The most useful channel, logs the parameters and return value of almost every system call.
instr: Logs every instruction executed by the emulator. This slows things down a lot.
verbose: Debug logs that don't fit into another category.
Grep for DEFAULT_CHANNEL to see if more log channels have been added since this list was updated.
A note on the JIT
Possibly the most interesting thing I wrote as part of iSH is the JIT. It's not actually a JIT since it doesn't target machine code. Instead it generates an array of pointers to functions called gadgets, and each gadget ends with a tailcall to the next function; like the threaded code technique used by some Forth interpreters. The result is a speedup of roughly 3-5x compared to pure emulation.
Unfortunately, I made the decision to write nearly all of the gadgets in assembly language. This was probably a good decision with regards to performance (though I'll never know for sure), but a horrible decision with regards to readability, maintainability, and my sanity. The amount of bullshit I've had to put up with from the compiler/assembler/linker is insane. It's like there's a demon in there that makes sure my code is sufficiently deformed, and if not, makes up stupid reasons why it shouldn't compile. In order to stay sane while writing this code, I've had to ignore best practices in code structure and naming. You'll find macros and variables with such descriptive names as ss and s and a. Assembler macros nested beyond belief. And to top it off, there are almost no comments.
So a warning: Long-term exposure to this code may cause loss of sanity, nightmares about GAS macros and linker errors, or any number of other debilitating side effects. This code is known to the State of California to cause cancer, birth defects, and reproductive harm.
We recommend following the Getting Started with Jetson Nano Developer Kit guide before moving on to the JetBot project. This will make sure you are familiar with the Jetson Nano and standard operation.
Follow these steps and you should be up and running with JetBot in no time!
A lightweight tool for you to generate handwriting-like text for printing.
Handwriter-python3 Features
Generate practically real handwriting-liked texts to .webp directly from text file for printing
Simulating handwriting is compatible with Chinese and almost all languages with Unicode encoded
Custom handwriting font supported and the whole of each word should be randomly disturbed including its stroke rotation angle
Three degrees of freedom transform supported. Horizontal position, vertical position and font size are randomly disturbed
Easy to use and cross-platform and custom json configuration supported
Handwriter-python3 Test Environment
macOS 10.15 with Python 3.7.4
Windows 10 20H1 Professional with Python 3.7.4 (x64)
Ubuntu 19.10 with Python 3.6.9 (64bit)
Handwriter-python3 Usage
Firstly, you have to downloadhandwriter.py or copy its source code to you IDE. If you want to use custom configuration or font presets, just clone Handwriter directly:
Thirdly, enter Handwriter path and run handwriter.py by python3 handwriter.py, follow the tips displayed in the console. It generates output file .webp using default configuration.
Last but not least, to avoid some rare errors, making sure your text file's name is *.txt and both name and text are encoded with UTF-8. For custom fonts please use TrueTypeFont file which extension is .ttf, and I recommend to use handwriting-liked fonts by default. Remmber outfilepath is a directory path but not a file path, the outfilename is automatically generated by uuid.
For further customization, please edit the Handwriter-python3 configuration file named handwriter.json manually, the default example is here:
All the *_path should be specialized. Then run handwriter.py with argument configuration file path by python3 handwriter.py .
The basic type settings parameters definition are here. For strengthen text sharpness and clarity, using large paper size(background_width, background_hight) and big font_size is always recommended. Please notice the parameter line_spacing should always larger than font_size. If you considering the word spacing is too big, set it to a negative number.
- ______________________________________________________
^ | Paper ^ |
| | word_spacing | top_margin |
b | left_margin |< --- >| v |
a | < --- > |-----------------------------| - |
c | - ------------ ------------ ^ |
k | ^ | ******** | | ******** | | line_ |
g | font_ | | ** | | ** ** | | |
r | size | | ** | | ** ** | | spacing |
o | v | ** | | ******** | v |
u | - ------------ ------------ - |
n | |-----------------------------|< -------- >|
d | ------------ right_margin |
| | | ******** | |
h | | *** ** | |
i | | ** | |
g | | ** char | |
h | ------------ |
t | ^ |
| | | bottom_margin |
v | v |
- |____________________________________________________|
|<------- -------="" background_width="">|
------->
Normally parameter font_color is set to black and background_color is set to white, using RGBA color profile and feel free to set color by specializing the color name . Also the background_color could be a picture file path, in this case background_colorstands for a background picture file path, try this if you want to use a custom background image.
The parameter *_sigma means random disturbing range and is always determined by the handwriting-liked font you have used, always change it to which perfectly matches your custom font manually. For example "font_size_sigma":2 means randomly disturbing character's size in range font_size ± 2. Similarly "perturb_theta_sigma":0.05 means randomly disturbing character stroke rotation radius in range horizontal ± 0.05. To avoid some special character like ,。》?;:’”】}、!%),.>?;:]}!%)′″℃℉ appear at the line indent, which is not following generally writing conventions which looks strange, specialize parameter end_chars is required.
Handwriter-cpp Features
Generate handwriting-liked text for printing from text file
Simulating Multiple ng handwriting is compatible with Chinese and almost all languages with Unicode encoded
Multiple custom handwriting font supported and each character's font is randomly generated
Each character size is randomly disturbed and margin in vertical position is randomly generated
Written in C++ which provides epic performance and Export as HTML by default with standard HTML API
Handwriter-cpp Test Environment
macOS 10.15 with XCode 11.2 and Safari
Windows 10 20H1 Professional with Visual Studio Community 2019 and Chrome Version 78
Handwriter-cpp Usage
Firstly, you have to downloadhandwriter.cpp or copy its source code to you IDE. If you want to use the default font presets, just clone Handwriter directly:
Secondly, please run handwriter.cpp with arguments configured, and arguments should follow the template example below:
handwriter.cpp ...
Each argument is split by space and follow the example sequence, text file in could not be empty and should contain the file name with file extension.html, fonts path number is limited by int size. Be careful the handwriter requires at least 1 font path.
For example we can use 4 custom fonts to simulating handwriting from /usr/local/example.txt:
It simply convert example.txt to example.html with handwriting-liked font style, so it's convenient to use different types fonts which only determined by your browser. Also the path format is flexible, local path or URL are both ok. Otherwise, I recommend to use handwriting-liked fonts by default. For further customization like HTML Title, Font Size and Margin Space, edit the #define in handwriter.cpp:
Lastly double click to open the generated HTML in your browser and print it with your printer, fake handwriting got!
What's more
Currently handwriter-cpp is only a very simple idea and in a very low level of completion, it actually with a very clumsy algorithm. For whom like your teacher may see through your trick easily.
For more really handwriting generation, more degrees of freedom transform is required, such as horizontal position, vertical position and font size. And the whole of each word should be randomly disturbed including its stroke rotation angle. Also random but not temporarily random, algorithm for pen pressure, nit move speed and so on is required. And it better to use mechanical arm to simulating handwriting instead of printer.
I wrote this program just for fun and learn characters encode principle deeper by practicing. Obviously to make this perfect, using C++ and HTML is not a good idea, please try Handwriter-python3 instead.