Manningtree has been around almost as long as c r o s s o a k. It's been through two iterations and is now onto its third. The first was as a blogger site (you can see the remnants as pages exported from blogger like this one). Then it moved …
A friend had a theory that photography, and therefore by extension c r o s s o a k is a window into my mental well being. So I did some digging which I'm capturing here (and which is in all probability a much bigger insight into my head...). If …
More jottings on MPD (previously on m a n n i n g t r e e)
A nice commandline tool (based on a Python wrapper for the OneDrive REST API) for working with OneDrive.
0. Setup a Python Virtual Environment
1. On Windows, install
pywin32 . From the venv use
easy_install http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/pywin32-219.win32-py2.7.exe/download (with …
A nice little Python Script to send documents to Amazon Kindle via a command line.
(It works too :-)
A quick starter on Python Virtual Environment
mkdir workingdir cd workingdir virtualenv venv
On Unix/Mac OS X use:
On Windows use:
To move the environment somewhere else:
- In existing (active) environment; grab a list of dependencies with
A fragment to let Unix boxes (and Mac OS X) know that this is a python script:
Add at the start of the script.
Make sure the script is executable with:
chmod +x scriptname.py
A fragment to execute a process on Windows:
from subprocess import Popen proc = Popen("vi \"" + filename + "\"", shell=True ) print(proc)
vi (whatever that might be on a Windows box). Note that while Python is pretty good from a crossplatform perspective, it's not the best when it …
A fragment for writing to a file in Python:
f = open(filename,'w') f.write('Hey, I'm saying Hello file! \n') f.close()
Note that this will overwrite an existing file. Use
open(filename,'a') to open in append mode. The Python documentation has details.
A fragment for formatting dates and time in Python:
import datetime date = datetime.datetime.now() sDate = date.strftime("%Y%m%d") sDateTime = date.strftime("%Y%m%d %H:%M:%S")
See see https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior for formatting for details of string formatting for dates …