Skip to content

Instantly share code, notes, and snippets.

View mattfoster's full-sized avatar

Matt Foster mattfoster

View GitHub Profile
import paramiko
cmd = "sudo /etc/init.d/mediatomb restart"
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('microwave', username='matt')
stdin, stdout, stderr = ssh.exec_command(cmd)
print stdout.readlines()
ssh.close()
# Seen at: http://github.com/strcat/dotfiles/ and in grml.
# Robust replacement for global aliases, and you can edit them too.
# requires extended globbing.
typeset -A abbrevs
abbrevs=('...' '../..'
'....' '../../..'
'BG' '& exit'
'C' '| wc -l'
'G' '|& grep --color=auto'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>commands</key>
<array>
<dict>
<key>argument</key>
<dict>
<key>beforeRunningCommand</key>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>commands</key>
<array>
<dict>
<key>argument</key>
<dict>
<key>beforeRunningCommand</key>
#!/usr/bin/env python
# Add comments to the end of lines
# Set `save` to `nothing`
# Set `input` to `selected text` or `line`
# Set `output` to `replace selected text`
import sys, os
comment_char = os.environ.get('TM_COMMENT_START', '#')
from IPython.ColorANSI import TermColors
colors = TermColors()
print 'IPython Colors:'
for color in dir(colors):
if not color.startswith('_'):
print getattr(colors, color), color
print colors.Blue, 'blue', colors.Red, 'green'
t = -pi:0.1:pi;
plot(t, sin(t)./t, t, cos(t), 'linewidth', 2)
plot(-pi:0.1:pi, sin(-pi:0.1:pi)./-pi:0.1:pi, -pi:0.1:pi, cos(-pi:0.1:pi), 'linewidth', 2)
#!/usr/bin/env python
from enthought.traits.api import *
from enthought.traits.ui.api import *
from enthought.chaco.api import *
from enthought.enable.component_editor import ComponentEditor
from enthought.chaco.chaco_plot_editor import ChacoPlotItem
from numpy import arange
from numpy import sin, cos, pi
#!/usr/bin/env python
from enthought.traits.api \
import HasTraits, Array, Range, Float, Enum, on_trait_change, Property
from enthought.traits.ui.api import View, Item
from enthought.chaco.chaco_plot_editor import ChacoPlotItem
from numpy import arange
from numpy import sin,pi
class Data(HasTraits):