Commit bab66a9d5943249be570de078c7c2eaef711056e

Authored by Ian Foster
Exists in master

Merge branch 'master' of github.com:lanrat/dotfiles

Showing 2 changed files Inline Diff

conky/conkyrc View file @ bab66a9
# Conky configuration 1 1 # Conky configuration
2 2
#make ram not show cache 3 3 #make ram not show cache
no_buffers yes 4 4 no_buffers yes
5 5
# Set to yes if you want Conky to be forked in the background 6 6 # Set to yes if you want Conky to be forked in the background
background no 7 7 background no
8 8
# Font size? 9 9 # Font size?
font Sans:size=8 10 10 font Sans:size=8
11 11
# Use Xft? 12 12 # Use Xft?
use_xft yes 13 13 use_xft yes
14 14
# Text alpha when using Xft 15 15 # Text alpha when using Xft
xftalpha 0.9 16 16 xftalpha 0.9
17 17
# Update interval in seconds 18 18 # Update interval in seconds
update_interval 1 19 19 update_interval 1
update_interval_on_battery 5 20 20 update_interval_on_battery 5
21 21
# This is the number of times Conky will update before quitting. 22 22 # This is the number of times Conky will update before quitting.
# Set to zero to run forever. 23 23 # Set to zero to run forever.
total_run_times 0 24 24 total_run_times 0
25 25
# Text alignment, other possible values are commented 26 26 # Text alignment, other possible values are commented
#alignment top_left 27 27 #alignment top_left
#alignment top_right 28 28 #alignment top_right
#alignment bottom_left 29 29 #alignment bottom_left
alignment bottom_right 30 30 alignment bottom_right
#alignment none 31 31 #alignment none
32 32
#max window width 33 33 #max window width
maximum_width 200 34 34 maximum_width 200
35 35
# Create own window instead of using desktop (required in nautilus) 36 36 # Create own window instead of using desktop (required in nautilus)
own_window yes 37 37 own_window yes
38 38
#specify a window class name 39 39 #specify a window class name
own_window_class Conky 40 40 own_window_class Conky
41 41
# If own_window is yes, you may use type normal, desktop or override 42 42 # If own_window is yes, you may use type normal, desktop or override
own_window_type desktop 43 43 own_window_type desktop
44 44
# Use pseudo transparency with own_window? 45 45 # Use pseudo transparency with own_window?
own_window_transparent yes 46 46 own_window_transparent yes
47 47
# If own_window_transparent is set to no, you can set the background colour here 48 48 # If own_window_transparent is set to no, you can set the background colour here
own_window_colour black 49 49 own_window_colour black
50 50
# If own_window is yes, these w# Text alignment, other possible values are commented 51 51 # If own_window is yes, these w# Text alignment, other possible values are commented
#alignment top_left 52 52 #alignment top_left
#alignment top_right 53 53 #alignment top_right
#alignment bottom_left 54 54 #alignment bottom_left
alignment bottom_right 55 55 alignment bottom_right
#alignment none 56 56 #alignment none
57 57
# If own_window is yes, these window manager hints may be used 58 58 # If own_window is yes, these window manager hints may be used
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager 59 59 own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
60 60
# Use double buffering (reduces flicker, may not work for everyone) 61 61 # Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes 62 62 double_buffer yes
63 63
# Minimum size of text area 64 64 # Minimum size of text area
minimum_size 200 5 65 65 minimum_size 200 5
66 66
# Draw shades? 67 67 # Draw shades?
draw_shades yes 68 68 draw_shades yes
69 69
# Draw outlines? 70 70 # Draw outlines?
draw_outline no 71 71 draw_outline no
72 72
# Draw borders around text 73 73 # Draw borders around text
draw_borders no 74 74 draw_borders no
75 75
# Draw borders around graphs 76 76 # Draw borders around graphs
draw_graph_borders yes 77 77 draw_graph_borders yes
78 78
# Default colors and also border colors 79 79 # Default colors and also border colors
default_color grey 80 80 default_color grey
default_shade_color black 81 81 default_shade_color black
default_outline_color black 82 82 default_outline_color black
83 83
# Text alignment, other possible values are commented 84 84 # Text alignment, other possible values are commented
#alignment top_left 85 85 #alignment top_left
alignment top_right 86 86 alignment top_right
#alignment bottom_left 87 87 #alignment bottom_left
#alignment bottom_right 88 88 #alignment bottom_right
#alignment none 89 89 #alignment none
90 90
# Gap between borders of screen and text 91 91 # Gap between borders of screen and text
# same thing as passing -x at command line 92 92 # same thing as passing -x at command line
gap_x 12 93 93 gap_x 12
gap_y 35 94 94 gap_y 35
95 95
# set to yes if you want all text to be in uppercase 96 96 # set to yes if you want all text to be in uppercase
uppercase no 97 97 uppercase no
98 98
# number of cpu samples to averag 99 99 # number of cpu samples to averag
# set to 1 to disable averaging 100 100 # set to 1 to disable averaging
cpu_avg_samples 1 101 101 cpu_avg_samples 1
102 102
# number of net samples to average 103 103 # number of net samples to average
# set to 1 to disable averaging 104 104 # set to 1 to disable averaging
net_avg_samples 1 105 105 net_avg_samples 1
106 106
# Force UTF8? note that UTF8 support required XFT 107 107 # Force UTF8? note that UTF8 support required XFT
override_utf8_locale no 108 108 override_utf8_locale no
109 109
TEXT 110 110 TEXT
${color grey}SYSTEM: $nodename $machine ${hr 1}${color} 111 111 ${color grey}SYSTEM: $nodename $machine ${hr 1}${color}
Uptime: $alignr$uptime_short 112 112 Uptime: $alignr$uptime_short
CPU: ${alignr} ${cpu}% ${freq_g} GHz 113 113 CPU: ${alignr} ${cpu}% ${freq_g} GHz
Processes: ${alignr}$processes ($running_processes running) 114 114 Processes: ${alignr}$processes ($running_processes running)
Load: ${alignr}$loadavg 115 115 Load: ${alignr}$loadavg
116 116
${if_existing /sys/devices/system/cpu/cpu0}CPU1 ${cpubar cpu1 4,60} ${endif}${alignr}${if_existing /sys/devices/system/cpu/cpu1}CPU2 ${cpubar cpu2 4,60} 117 117 ${if_existing /sys/devices/system/cpu/cpu0}CPU1 ${cpubar cpu1 4,60} ${endif}${alignr}${if_existing /sys/devices/system/cpu/cpu1}CPU2 ${cpubar cpu2 4,60}
${endif}${if_existing /sys/devices/system/cpu/cpu2}CPU3 ${cpubar cpu3 4,60} ${endif}${alignr}${if_existing /sys/devices/system/cpu/cpu3}CPU4 ${cpubar cpu4 4,60} 118 118 ${endif}${if_existing /sys/devices/system/cpu/cpu2}CPU3 ${cpubar cpu3 4,60} ${endif}${alignr}${if_existing /sys/devices/system/cpu/cpu3}CPU4 ${cpubar cpu4 4,60}
${endif}${if_existing /sys/devices/system/cpu/cpu4}CPU5 ${cpubar cpu5 4,60} ${endif}${alignr}${if_existing /sys/devices/system/cpu/cpu5}CPU6 ${cpubar cpu6 4,60} 119 119 ${endif}${if_existing /sys/devices/system/cpu/cpu4}CPU5 ${cpubar cpu5 4,60} ${endif}${alignr}${if_existing /sys/devices/system/cpu/cpu5}CPU6 ${cpubar cpu6 4,60}
${endif}${if_existing /sys/devices/system/cpu/cpu6}CPU7 ${cpubar cpu7 4,60} ${endif}${alignr}${if_existing /sys/devices/system/cpu/cpu7}CPU8 ${cpubar cpu8 4,60} 120 120 ${endif}${if_existing /sys/devices/system/cpu/cpu6}CPU7 ${cpubar cpu7 4,60} ${endif}${alignr}${if_existing /sys/devices/system/cpu/cpu7}CPU8 ${cpubar cpu8 4,60}
${endif}${if_existing /sys/devices/system/cpu/cpu8}CPU9 ${cpubar cpu9 4,60} ${endif}${alignr}${if_existing /sys/devices/system/cpu/cpu9}CPU10 ${cpubar cpu10 4,60} 121 121 ${endif}${if_existing /sys/devices/system/cpu/cpu8}CPU9 ${cpubar cpu9 4,60} ${endif}${alignr}${if_existing /sys/devices/system/cpu/cpu9}CPU10 ${cpubar cpu10 4,60}
${endif}${if_existing /sys/devices/system/cpu/cpu10}CPU11 ${cpubar cpu11 4,60} ${endif}${alignr}${if_existing /sys/devices/system/cpu/cpu11}CPU12 ${cpubar cpu12 4,60} 122 122 ${endif}${if_existing /sys/devices/system/cpu/cpu10}CPU11 ${cpubar cpu11 4,60} ${endif}${alignr}${if_existing /sys/devices/system/cpu/cpu11}CPU12 ${cpubar cpu12 4,60}
${endif} 123 123 ${endif}
${cpugraph 20} 124 124 ${cpugraph 20}
125 125
Ram ${alignr}$mem / $memmax ($memperc%) 126 126 Ram ${alignr}$mem / $memmax ($memperc%)
${membar 4} 127 127 ${membar 4}
Swap ${alignr}$swap / $swapmax ($swapperc%) 128 128 Swap ${alignr}$swap / $swapmax ($swapperc%)
${swapbar 4} 129 129 ${swapbar 4}
130 130
Highest CPU $alignr CPU% MEM% 131 131 Highest CPU $alignr CPU% MEM%
${top name 1}$alignr${top cpu 1} ${top mem 1} 132 132 ${top name 1}$alignr${top cpu 1} ${top mem 1}
${top name 2}$alignr${top cpu 2} ${top mem 2} 133 133 ${top name 2}$alignr${top cpu 2} ${top mem 2}
${top name 3}$alignr${top cpu 3} ${top mem 3} 134 134 ${top name 3}$alignr${top cpu 3} ${top mem 3}
135 135
Highest MEM $alignr CPU% MEM% 136 136 Highest MEM $alignr CPU% MEM%
${top_mem name 1}$alignr${top_mem cpu 1} ${top_mem mem 1} 137 137 ${top_mem name 1}$alignr${top_mem cpu 1} ${top_mem mem 1}
scripts/pinhole.py View file @ bab66a9
#!/usr/bin/env python 1 1 #!/usr/bin/env python
""" 2 2 """
usage 'pinhole port host [newport]' 3 3 usage 'pinhole port host [newport]'
4 4
Pinhole forwards the port to the host specified. 5 5 Pinhole forwards the port to the host specified.
The optional newport parameter may be used to 6 6 The optional newport parameter may be used to
redirect to a different port. 7 7 redirect to a different port.
8 8
eg. pinhole 80 webserver 9 9 eg. pinhole 80 webserver
Forward all incoming WWW sessions to webserver. 10 10 Forward all incoming WWW sessions to webserver.
11 11
pinhole 23 localhost 2323 12 12 pinhole 23 localhost 2323
Forward all telnet sessions to port 2323 on localhost. 13 13 Forward all telnet sessions to port 2323 on localhost.
14 14
""" 15 15 """
16 16
import sys 17 17 import sys
from socket import * 18 18 from socket import *
from threading import Thread 19 19 from threading import Thread
import time 20 20 import time
import signal 21 21 import signal
import os 22 22 import os
23 23
running = True 24 24 #enable logging to file
25 #sys.stdout = open( 'pinhole.log', 'w' )
25 26
27
def log( s ): 26 28 def log( s ):
print '%s:%s' % ( time.ctime(), s ) 27 29 print '%s:%s' % ( time.ctime(), s )
sys.stdout.flush() 28 30 sys.stdout.flush()
29 31
32
class PipeThread( Thread ): 30 33 class PipeThread( Thread ):
pipes = [] 31 34 pipes = []
def __init__( self, source, sink ): 32 35 def __init__( self, source, sink ):
Thread.__init__( self ) 33 36 Thread.__init__( self )
self.source = source 34 37 self.source = source
self.sink = sink 35 38 self.sink = sink
36 39
log( 'Creating new pipe thread %s ( %s -> %s )' % \ 37 40 log( 'Creating new pipe thread %s ( %s -> %s )' % \
( self, source.getpeername(), sink.getpeername() )) 38 41 ( self, source.getpeername(), sink.getpeername() ))
PipeThread.pipes.append( self ) 39 42 PipeThread.pipes.append( self )
log( '%s pipes active' % len( PipeThread.pipes )) 40 43 log( '%s pipes active' % len( PipeThread.pipes ))
41 44
def run( self ): 42 45 def run( self ):
while running: 43 46 while True:
try: 44 47 try:
data = self.source.recv( 1024 ) 45 48 data = self.source.recv( 1024 )
if not data: break 46 49 if not data: break
self.sink.send( data ) 47 50 self.sink.send( data )
except: 48 51 except:
break 49 52 break
50 53
log( '%s terminating' % self ) 51 54 log( '%s terminating' % self )
PipeThread.pipes.remove( self ) 52 55 PipeThread.pipes.remove( self )
log( '%s pipes active' % len( PipeThread.pipes )) 53 56 log( '%s pipes active' % len( PipeThread.pipes ))
54 57
58
class Pinhole( Thread ): 55 59 class Pinhole( Thread ):
def __init__( self, port, newhost, newport ): 56 60 def __init__( self, port, newhost, newport ):
Thread.__init__( self ) 57 61 Thread.__init__( self )
log( 'Redirecting: localhost:%s -> %s:%s' % ( port, newhost, newport )) 58 62 log( 'Redirecting: localhost:%s -> %s:%s' % ( port, newhost, newport ))
self.newhost = newhost 59 63 self.newhost = newhost
self.newport = newport 60 64 self.newport = newport
self.sock = socket( AF_INET, SOCK_STREAM ) 61 65 self.sock = socket( AF_INET, SOCK_STREAM )
self.sock.bind(( '', port )) 62 66 self.sock.bind(( '', port ))
self.sock.listen(5) 63 67 self.sock.listen(5)
64 68
def run( self ): 65 69 def run( self ):
while running: 66 70 while True:
newsock, address = self.sock.accept() 67 71 newsock, address = self.sock.accept()
log( 'Creating new session for %s %s ' % address ) 68 72 log( 'Creating new session for %s %s ' % address )
fwd = socket( AF_INET, SOCK_STREAM ) 69 73 fwd = socket( AF_INET, SOCK_STREAM )
fwd.connect(( self.newhost, self.newport )) 70 74 fwd.connect(( self.newhost, self.newport ))
PipeThread( newsock, fwd ).start() 71 75 PipeThread( newsock, fwd ).start()
PipeThread( fwd, newsock ).start() 72 76 PipeThread( fwd, newsock ).start()
73 77
if __name__ == '__main__': 74
75 78
79 if __name__ == '__main__':
print 'Starting Pinhole' 76 80 print 'Starting Pinhole'
77
import sys 78
#sys.stdout = open( 'pinhole.log', 'w' ) 79