Handy Python Utilities

Storm SSH – command line tool to manage your ssh connections

Cheat – create and view interactive cheatsheets on the command-line

 

Advertisements

Scheduling Python Scripts in Obsidian Java Scheduler

While looking into Java Job Scheduler Obsidian, I had the little problem below.
The default option for Python “com.carfey.ops.job.script.PythonJob” works well but requires you to enter the content of your script directly into the scheduler (see http://obsidianscheduler.com/wiki/Scripting_Jobs for a quick overview), potentially leading to a duplication of functionality and complicating the maintenance of said scripts.
Using fileFTP.py as an example script, I tried (on a Windows machine) to use the generic “com.carfey.ops.job.script.ScriptFileJob” to call the python script but to no avail. I got it to work calling a .exe file but the different command line combinations I tried such as “python fileFTP.py”, “python C:/Scripts/python/fileFTP.py”, “C:/Python27/python.exe C:/Scripts/python/fileFTP.py”, “cmd /c start python C:/Scripts/python/fileFTP.py” and more along those lines just didn’t work, keep returning an error that “fileFTP.py cannot be found”.
In the end, in order to keep my python scripts out of the scheduler, I wrote a python job (using the “com.carfey.ops.job.script.PythonJob” option) to call my python script.
Python job as entered in the Obsidian scheduler (the 3 arguments and their values are defined within the scheduler as part of the job options)

import sys
sys.path.append( "C:/Scripts/python/" )
import fileFTP
fileFTP.main(arg1, arg2, arg3)

The fileFTP.py script is structured as below to allow it to run from both the command line and from Obsidian:

import sys
def main(arg1, arg2, arg3):
       #Do FTP stuff
if __name__ == "__main__":
       main(sys.argv[1], sys.argv[2], sys.argv[3])

Python Resources Part 1

The default Django tutorial – Excellent and a great introduction!
https://docs.djangoproject.com/en/1.5/intro/tutorial01/

Some other tutorials to check out
http://www.ianlewis.org/en/administer-wordpress-django-admin
http://www.netmagazine.com/tutorials/get-started-django
http://www.webreference.com/programming/python_django_blogs/index.html
-> http://net.tutsplus.com/tutorials/python-tutorials/building-ribbit-with-django/

Python Apps
{USELESS – OUT OF DATE}https://github.com/nathanborror/django-basic-apps/
http://pinaxproject.com/
http://djangosnippets.org/
https://bitbucket.org/codekoala/django-articles/overview
https://github.com/schbank/Thaddeus

Ref
http://www.ibm.com/developerworks/opensource/library/os-django/index.html
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Python_django.html
http://www.jeffknupp.com/blog/2012/02/09/starting-a-django-project-the-right-way/
http://www.aptivate.org/en/blog/2013/01/22/making-it-obvious-which-copy-of-a-django-site-you-are-using/

Installation
http://docs.python-guide.org/en/latest/starting/install/win/
http://tumblr.intranation.com/post/766290325/python-virtualenv-quickstart-django
http://bitnami.com/stack/django/installer (note – pick version 1.5)

Tips and Tricks
http://ericholscher.com/blog/2008/oct/5/django-tips/
http://stackoverflow.com/questions/15128135/django-setting-debug-false-causes-500-error
http://www.brankovukelic.com/2013/04/three-awesome-django-admin-enhancements.html

Other Interesting
http://blog.smalleycreative.com/tutorials/setup-a-django-vm-with-vagrant-virtualbox-and-chef/

CSS/JS
http://twitter.github.io/bootstrap/index.html