May 7th, 2008

Eterm com cores aleatorias

Ainda uso o Eterm.
Nao tem suporte a UTF-8, é velho, e tdo mais… mas ainda uso, junto com o e17.
costumo usa-lo com este scriptzinho, feito a muiiiito tempo:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl
foreach $arg (@ARGV){
        $cmd_options="$cmd_options $arg";
}
 
$offset = 60;
$base = 80;
$limit = 400;
 
$red = int($base + rand($limit - $offset));
$green = int($base + rand($limit - $offset));
$blue = int($base + rand($limit - $offset));
 
$options = "--cmod-red $red --cmod-green $green --cmod-blue $blue";
 
exec ("Eterm $options $cmd_options");
#exec ("Eterm $options $cmd_options -T \"`fortune  -n50 -s`\"");

admin stuff
Desktop
programming

Comments (0)

Permalink

cgo.py

Lembram-se do cgo.sh?
Agora existe o cgo.py.
Faz a mesma coisa… só que em python:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python
# Copyright (C) 2008, Felippe Bueno <bueno>
# GNUv2 licence
# Enjoy
import sys,os
 
if len(sys.argv) &lt; 2:
    print "Use:     "+ sys.argv[0] +' server1 server2 server3... serverN'
    print "or:      "+ sys.argv[0] +' server* to use ~/.ssh/known_hosts'
    print "or:      "+ sys.argv[0] +' server 1 20 to use \'server\' as prefix, and increment from 1 to 20 (server1 server2 server3 ... server20)'
    sys.exit(1)   
 
def use_knownhosts(prefix):
    import string
    servers=""
    known_file=file(os.getenv('HOME')+'/.ssh/known_hosts','r')
    for line in known_file.readlines():
        hostname=string.split(line.split()[0], sep=',')[0]
        if prefix in hostname:
            servers=servers+' '+hostname
    args=servers.split()
    args.sort()
    cargs=""
    for s in args:
        cargs=cargs+' '+s
    return cargs
 
def use_prefixsequence(prefix,start,end):
    servers=""
    i=start
    while i &lt;= end:
        servers=servers+' '+prefix+str(i)
        i=int(i)+1
    return servers
 
if '*' in sys.argv[1]:
    import string
    os.system("cssh "+use_knownhosts(string.split(sys.argv[1],sep='*')[0]))
    sys.exit(0)
 
if len(sys.argv) == 2:
    servers=""
    i=1
    while i &lt; len(sys.argv):
        servers=servers+' '+sys.argv[i]
        i=i+1
    os.system("cssh "+servers)
    sys.exit(0)
 
try:
    int(sys.argv[2])
    int(sys.argv[3])
    os.system("cssh "+use_prefixsequence(sys.argv[1],int(sys.argv[2]),int(sys.argv[3])))
except ValueError:
    servers=""
    i=1
    while i &lt; len(sys.argv):
        servers=servers+' '+sys.argv[i]
        i=i+1
    os.system("cssh "+servers)
    sys.exit(0)</bueno>

admin stuff
Desktop
programming
Python

Comments (0)

Permalink