This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# TODO: support specifying categories on the command-line with tab-complete. | |
# TODO: support specifying extension as a command-line argument | |
# TODO: support specifying notes_dir as an option | |
# TODO: published_key, modified_key and timestr as command-line options | |
# TODO: specify editor on the command-line, or fall back on $EDITOR. | |
# TODO: support specifying a template to be used to create the file. | |
import os,sys,datetime,string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package scratch; | |
import java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; | |
/** | |
* A simple demonstration of Swing's CardLayout. | |
* | |
* @author seanh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package storymaps; | |
import java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; | |
/** | |
* A JTextField that automatically selects all text when focused IF the text | |
* it currently contains is the initial text that it was constructed with. | |
* The text field also deselects the text when it loses focus. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; | |
class MyClass { | |
public static void main(String[] args) { | |
JFrame frame = new JFrame(); | |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
Container contentPane = frame.getContentPane(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package scratch; | |
import java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; | |
/** | |
* | |
* @author seanh | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
gnome-dictionary --look-up `dmenu -nb '#a5b474' -sb '#444444' -nf '#eeeeee' -sf '#a5b474' -fn '-*-*-*-*-*-*-20-*-*-*-*-*-*-*'` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
gedit `ls | dmenu -nb '#a5b474' -sb '#444444' -nf '#eeeeee' -sf '#a5b474' -fn '-*-*-*-*-*-*-20-*-*-*-*-*-*-*'` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The built-in function `open` opens a file and returns a file object. | |
# Read mode opens a file for reading only. | |
try: | |
f = open("file.txt", "r") | |
try: | |
# Read the entire contents of a file at once. | |
string = f.read() | |
# OR iterate over the file line-by-line: | |
for line in f: | |
# Do something with line. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A plugin for handling slug URLs. A slug is a nice, short URL for reaching a | |
particular post. | |
If a URL ending in /slug/hello-world is requested this plugin will search the | |
datadir for a post that has the metadata line: | |
#slug hello-world | |
If such a post is found the page for that post will be shown in the browser. So |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" Recursively walk the current working directory looking for broken | |
symlinks. If any broken symlinks are found print out a report and exit | |
with status 1. If none are found print out OK and exit with status 0. | |
""" | |
import sys,os | |
print "Checking for broken symlinks...", | |
links = [] |