Skip to content

Instantly share code, notes, and snippets.

View jrosco's full-sized avatar
:shipit:
winning

Joel Cumberland jrosco

:shipit:
winning
View GitHub Profile
@jrosco
jrosco / onchange.sh
Last active December 27, 2024 01:52 — forked from senko/onchange.sh
#!/bin/bash
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <[email protected]>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of
@jrosco
jrosco / dbus_notify_popup
Last active August 29, 2015 14:13
DBus Notifcation Popup
#!/usr/bin/env python
import dbus
def notify(summary, body='', app_name='', app_icon='',
timeout=5000, actions=[], hints=[], replaces_id=0):
bus_name = 'org.freedesktop.Notifications'
object_path = '/org/freedesktop/Notifications'
interface_name = bus_name
@jrosco
jrosco / 0_reuse_code.js
Last active August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jrosco
jrosco / gist:c7369a651343ea622e4d
Created January 9, 2015 05:33
Get and Set IconFile via DBUS
#!/usr/bin/env python
import dbus
import os
import pwd
user_id = pwd.getpwuid(os.getuid()).pw_uid
icon_file = '/home/jrosco/.face'
bus = dbus.SystemBus()
@jrosco
jrosco / StatusIcon.py
Last active May 23, 2016 12:57 — forked from pklaus/StatusIcon.py
tray icon application using PyGTK
#!/usr/bin/env python
# found on <http://files.majorsilence.com/rubbish/pygtk-book/pygtk-notebook-html/pygtk-notebook-latest.html#SECTION00430000000000000000>
# simple example of a tray icon application using PyGTK
import gtk
def message(data=None):
"Function to display messages to the user."
#!/bin/bash
# Uses a PID file to add daemon-like behavior to an arbitrary program.
################################################################################
usage() {
echo "Usage: `basename $0` PROGRAM {start|stop|restart|force-stop|force-restart|status} [PIDFILE|PID]" >&2
echo "Where: PROGRAM is an executable file." >&2
echo " PIDFILE is the file that contains (or will contain) the PID." >&2
echo " PID is a process id to use in place of a PIDFILE." >&2
}
#!/usr/bin/env python
#http://www.wxpython.org/docs/api/wx.lib.combotreebox-module.html#ComboTreeBox
from wx.lib.combotreebox import ComboTreeBox
import wx
class MyFrame(wx.Frame):
@jrosco
jrosco / One liners
Last active August 29, 2015 14:06
Oneliners
perl -i -pe 's{^#!/bin/sh}{#!/bin/bash}' /path/to/file
@jrosco
jrosco / wx_multi_tab.py
Created March 20, 2014 03:55
wxpython multi tab example
import wx
""" Copied for m http://wiki.wxpython.org/Simple%20wx.Notebook%20Example """
class PageOne(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
wx.StaticText(self, -1, "This is a PageOne object", (20,20))
__author__ = 'jrosco'
# Import smtplib for the actual sending function
import smtplib
# Import the email modules we'll need
from email.mime.text import MIMEText
textfile = '../files/test'