Archive of posts tagged python
emacs tip of the week #2: elpy
I used to have a very complex .emacs config for python development, then I discovered elpy. It bundles together various python lisp modules cohesively, supports virtual environments, loading “project” files (via elpy-find-file), refactoring, running tests and so on. I’m not even tempted to use PyCharm much any more.
VirusAction script for clamsmtp
I’ve recently configured my MTA to drop emails with embedded MS Office Macros (a very popular way of distributing malware). You can get the odd valid macro-enabled Office doc, so I’ve written a script to alert me when emails are dropped, it’s available on GitHub Configure in /etc/clamsmtpd.conf as below: VirusAction: /usr/local/bin/clamsmtp-action.py -t postmaster@yourdomain.com (other …
Commandline IMAP Mail check & Screen
I wanted a commandline IMAP mailbox checker so I wrote one: imapchkr Normal output for this is as below: ➜ ~ [jamespo: 0/190] [gmail: 0/80] But I decided I wanted to embed it in my GNU screen hardstatus so expanded it to offer a short output option (imapchkr -s). See bottom left corner for output. …
Check domain expiry in nagios
With the plugin I am currently using failing on one of my domains, I decided to write another short plugin in python, using the pywhois library. Unfortunately this failed to parse the Godaddy whois output, so there is a workaround for this included in the plugin. Download the plugin from github.
Tabs, Whitespaces, and Highlighting in Emacs – for the Python Programmer
If you’re a python programmer, you probably know all about the troubles mixing tabs and spaces can cause. I have searched far and wide, and have collected some really useful configurations for setting up the perfect Emacs configuration for Python. What it does: Insert spaces instead of tabs when indenting Sets indent to 4 spaces …
Continue reading ‘Tabs, Whitespaces, and Highlighting in Emacs – for the Python Programmer’ »
Emacs, Python and smart-tabbing
If you are using emacs to edit Python with auto-complete enabled, you really should install smart-tab to intelligently toggle between indentation and completion.
cannot import name MAXREPEAT with jedi / emacs?
This could be due to upgrading from python 2.7.3 -> 2.7.4 (eg ubuntu upgrade). Try reinstalling jedi.
mypy – A New Python Variant with Dynamic and Static Typing
Very interesting python development… drop in static typing. The mypy programming language is an experimental Python variant that aims to combine the benefits of dynamic or “duck” typing and static typing. Our goal is to have the expressive power and convenience of Python combined with compile-time type checking. The long-term goal is to also support …
Continue reading ‘mypy – A New Python Variant with Dynamic and Static Typing’ »
Tutorial: Gathering data with the Scrapy framework
Tutorial: Gathering data with the Scrapy framework. I found this much easier to follow than the official docs and more relevant to my use case. Unfortunately the site he uses as an example no longer exists, but that didn’t affect me.