-
My Favorite WordPress Code Highlighter Plugin
Posted on July 8th, 2010 No comments
Print
If you’re wondering what I used for the code highlighter in my previous post, it’s the SyntaxHighlighter Evolved plugin. It’s just like the Google Syntax Highlighter plugin but much easier to use. I’ve tried a bunch of other ones such as the WP Advanced Code Editor, Developer Formatter, and WP-Codebox and this one is the best in my opinion.
To use it you just put your code between these tags: “[language] …code goes here… [/language]” where “language” is the programming language (i.e. python, java, sql, etc.).
Here are some examples of what the code would look like:
Python
import shutil class Copy: ''' Copy files. ''' def __init__(self): ''' Nothing to see here. ''' def copyFile(self, src, dst): shutil.copy2(src, dst) print "I don't know why I'm printing this."SQL
SELECT * FROM cool_websites WHERE domain = 'calazan.com' AND ranking IS NOT NULL
Java
public class HelloVisitors { public static void main(String[] args) { // Just saying hello System.out.println("Hello visitors!"); } } -
Python’s ‘zipfile’ Module
Posted on July 8th, 2010 No comments
Print
I was writing some scripts today and part of it is to compress some files. I normally make an external application call to 7-Zip command line when I do this, but then I decided to just do a quick Google search to see if Python has one built in.It turned out there’s this zipfile module that’s part of the standard library that can compress and decompress files for you (only the standard ZIP compression method is supported).
Here are a couple examples:
Zipping a File
import zipfile sourceFile = r"C:\ziptest\testfile.txt" outputFile = r"C:\ziptest\testfile.zip" try: zipper = zipfile.ZipFile(outputFile, "w", zipfile.ZIP_DEFLATED) zipper.write(sourceFile) except zipfile.BadZipfile as zipfileException: print zipfileException finally: zipper.close()Unzipping a File
import zipfile sourceFile = r"C:\ziptest\testfile.zip" outputFolder = r"C:\ziptest\unzipped" try: unzipper = zipfile.ZipFile(sourceFile) unzipper.extractall(outputFolder) except zipfile.BadZipfile as zipfileException: print zipfileException finally: unzipper.close() -
Core FTP Mini SFTP Server: A Free SFTP (Secure FTP/SSH FTP) Server
Posted on July 7th, 2010 No comments
Print
Here’s a nice free little Secure FTP server from Core FTP called Mini SFTP Server. I use it from time to time at work when people from other departments need to send me files and company policy requires them to use a secure (encrypted) medium.
It’s not a fully featured SFTP server but it’s very easy to use and doesn’t require installation. Simply double click the executable, set the username and password, set the upload path, click start and your computer will start accepting connections on port 22!
Official Download Site: http://www.coreftp.com/server/
Download From This Site: Core FTP Mini SFTP Server
Free Open Source FTP Client with SFTP Support: FileZilla



Recent Comments