Skip to content

Instantly share code, notes, and snippets.

import Growl
def growlAlert(self, type, eventclass, device):
"""
<type> = "New Alert" or "Clear"
<eventclass> (i.e. /Status/IpService)
<device> (i.e. server1.domain.com)
"""
name = "ZenWatch"
@ctaloi
ctaloi / gist:4156185
Created November 27, 2012 18:48 — forked from fcrespo82/gist:4137305
Script to sync Pythonista App to Dropbox
import webbrowser, os, pprint
# Include the Dropbox SDK libraries
#from dropbox import client, rest, session
import dropbox
# Configuration
TOKEN_FILENAME = 'PythonistaDropbox.token'
# Get your app key and secret from the Dropbox developer website
APP_KEY = '<your dropbox app_key>'
APP_SECRET = '<your dropbox app_secret>'
@ctaloi
ctaloi / DropboxSync.py
Created November 27, 2012 19:31 — forked from wrenoud/DropboxSync.py
DropboxSync
import os
import sys
import pickle
import console
# I moved 'dropboxlogin' into a sub folder so it doesn't clutter my main folder
sys.path += [os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib')]
import dropboxlogin # this code can be found here https://gist.github.com/4034526
STATE_FILE = '.dropbox_state'
"""
Copyright (c) 2009, Aaron Bycoffe
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
@ctaloi
ctaloi / otrs.sql
Created May 17, 2013 14:10
OTRS Query
/* Today */
select q.name AS queue_name, COUNT(*) AS Tickets
FROM queue AS q, ticket AS t, article AS a, article_type AS a_t, (
SELECT _a.ticket_id, MAX(_a.create_time) AS create_time
FROM ticket AS _t, ticket_state AS _t_s, article AS _a
WHERE _t_s.name IN ('new', 'open', 'Vendor Assigned', 'Research, Escalated')
AND _t.ticket_state_id = _t_s.id
AND _a.ticket_id = _t.id
GROUP BY _a.ticket_id
@ctaloi
ctaloi / arg.py
Created May 21, 2013 14:00
argparse example
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-s', action='store', dest='simple_value',
help='Store a simple value')
parser.add_argument('-c', action='store_const', dest='constant_value',
const='value-to-store',
help='Store a constant value')
@ctaloi
ctaloi / send_mail.py
Created May 21, 2013 14:26
Quick Python to sendmail script
#!/usr/bin/env python
import os
import argparse
def buildEmail():
parser = argparse.ArgumentParser(add_help=True)
parser.add_argument('em_subject', help='Email Subject Line')
parser.add_argument('em_body', help='Body of Email')
parser.add_argument('em_to', help='Email Recipient')
@ctaloi
ctaloi / send_email26.py
Created May 21, 2013 15:20
optparse example for Python 2.6
#!/usr/bin/env python
import os
from optparse import OptionParser
def buildEmail():
usage = "usage: %prog [options] arg"
parser = OptionParser(usage)
parser.add_option('-s', '--subject', action='store', dest='em_subject')
parser.add_option('-b', '--body', action='store', dest='em_body')

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discussions around concrete examples, not handy-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@ctaloi
ctaloi / foo.log
Created June 10, 2013 16:11 — forked from ibeex/foo.log
A warning occurred (42 apples)
An error occurred