sakuric 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +13 -0
- data/Gemfile +22 -0
- data/Gemfile.lock +60 -0
- data/HISTORY.yml +13 -0
- data/INSTALL +5 -0
- data/LICENSE +1 -0
- data/Makefile +19 -0
- data/Manifest +405 -0
- data/README.md +72 -0
- data/Rakefile +4 -0
- data/TODO +3 -0
- data/VERSION +1 -0
- data/bashrc +30 -0
- data/bashrc.d/00-functions.include +7 -0
- data/bashrc.d/01-sakura_checks.include +15 -0
- data/bashrc.d/02-uname.include +11 -0
- data/bashrc.d/80-ruby.include +4 -0
- data/bashrc.d/99-dirs.include +11 -0
- data/bashrc.d/aliases.include +20 -0
- data/bashrc.d/common.include +7 -0
- data/bashrc.d/local.d/README +1 -0
- data/bashrc.d/local.d/nothing.include +0 -0
- data/bashrc.d/uname.d/Darwin +6 -0
- data/bashrc.d/uname.d/Linux +0 -0
- data/bashrc.local.sample +11 -0
- data/bin/10 +7 -0
- data/bin/10times +7 -0
- data/bin/1every +22 -0
- data/bin/1everyN +22 -0
- data/bin/1suN +22 -0
- data/bin/2 +5 -0
- data/bin/act +24 -0
- data/bin/amarelo +2 -0
- data/bin/arancio +4 -0
- data/bin/arcobaleno +10 -0
- data/bin/bianco +3 -0
- data/bin/black +2 -0
- data/bin/brew-install +3 -0
- data/bin/cache +50 -0
- data/bin/cache3 +50 -0
- data/bin/cheorae +4 -0
- data/bin/colorastdouterr +37 -0
- data/bin/cp2desktop +3 -0
- data/bin/create-git-repo.sh +24 -0
- data/bin/csoe +37 -0
- data/bin/data +3 -0
- data/bin/derive +90 -0
- data/bin/dimmi +31 -0
- data/bin/dimmiora +4 -0
- data/bin/doppioni +48 -0
- data/bin/du- +9 -0
- data/bin/duplicates +48 -0
- data/bin/echodo +7 -0
- data/bin/ensure_line_present +82 -0
- data/bin/epoch2date +5 -0
- data/bin/fanout +100 -0
- data/bin/find-broken-symlink +26 -0
- data/bin/find-duplicates +48 -0
- data/bin/find-special-chars-within-filenames +12 -0
- data/bin/fix-terminal +5 -0
- data/bin/gce-create-centos-instance +5 -0
- data/bin/gce-create-custom-image +8 -0
- data/bin/gce-curl-get-instances-for-project +7 -0
- data/bin/gce-get-token +3 -0
- data/bin/gce-getproject-metadata +35 -0
- data/bin/gce-public-ip +4 -0
- data/bin/gcutil-fetch +36 -0
- data/bin/giallo +2 -0
- data/bin/git-clone-in-non-empty-dir +21 -0
- data/bin/git-ignore +3 -0
- data/bin/git-repos +98 -0
- data/bin/git-repos.py +99 -0
- data/bin/gitinfo +2 -0
- data/bin/google-spreadsheet-cat +40 -0
- data/bin/google_ips +5 -0
- data/bin/gray +3 -0
- data/bin/green +2 -0
- data/bin/grigio +3 -0
- data/bin/gsutil-debug-bucket +12 -0
- data/bin/gsutil-get-oauth2-token +4 -0
- data/bin/gugol-image +74 -0
- data/bin/hamachi-ubuntu-install +17 -0
- data/bin/head-1^-1 +5 -0
- data/bin/ifdownup +13 -0
- data/bin/immature/ok2 +25 -0
- data/bin/immature/twice-still-broken +9 -0
- data/bin/install-gic-repo +13 -0
- data/bin/install-sakura-on-debian-latest +6 -0
- data/bin/iphoto_big_files.sh +37 -0
- data/bin/itunes +140 -0
- data/bin/jason-xpath.rb +54 -0
- data/bin/jsawk +1128 -0
- data/bin/json-xpath.rb +54 -0
- data/bin/keepup +13 -0
- data/bin/lsof-top10 +3 -0
- data/bin/minicook +218 -0
- data/bin/mv2. +2 -0
- data/bin/mv2desktop +2 -0
- data/bin/mv2dropbox +2 -0
- data/bin/mv2here +2 -0
- data/bin/mvto +39 -0
- data/bin/nero +2 -0
- data/bin/never_as_root +18 -0
- data/bin/not +16 -0
- data/bin/ok +42 -0
- data/bin/orange +4 -0
- data/bin/pink +2 -0
- data/bin/polygen-dell +7 -0
- data/bin/polygen-heanet +6 -0
- data/bin/polygen-labs +4 -0
- data/bin/print_key_val +4 -0
- data/bin/rainbow +10 -0
- data/bin/recipe +19 -0
- data/bin/red +2 -0
- data/bin/remember-command +140 -0
- data/bin/remember-command.rb +140 -0
- data/bin/richelp +99 -0
- data/bin/ricorda-comando +140 -0
- data/bin/rosa +2 -0
- data/bin/rosso +2 -0
- data/bin/run-parts.sh +50 -0
- data/bin/sakura-check-version +48 -0
- data/bin/sakura-init.DRAFT +5 -0
- data/bin/sakura-version +2 -0
- data/bin/sano +5 -0
- data/bin/sbianca +3 -0
- data/bin/sblua +2 -0
- data/bin/setterm-reset +5 -0
- data/bin/sgialla +2 -0
- data/bin/sgrigia +2 -0
- data/bin/split +37 -0
- data/bin/split.rb +37 -0
- data/bin/srosa +1 -0
- data/bin/srossa +2 -0
- data/bin/strip-white-spaces +2 -0
- data/bin/stty-sane +5 -0
- data/bin/sudo^-1 +18 -0
- data/bin/sverda +6 -0
- data/bin/swift-saio-install.sh +336 -0
- data/bin/synergyc +0 -0
- data/bin/synergys +0 -0
- data/bin/syracuse.pl +29 -0
- data/bin/tail-n+2 +5 -0
- data/bin/tellme +31 -0
- data/bin/tellme-time +4 -0
- data/bin/timeout3 +91 -0
- data/bin/top5 +4 -0
- data/bin/trim +4 -0
- data/bin/trova-broken-symlink +26 -0
- data/bin/twice +5 -0
- data/bin/twice.rb +5 -0
- data/bin/ubuntu-install-hamachi64 +17 -0
- data/bin/ultimo +5 -0
- data/bin/upload.py +2380 -0
- data/bin/usleep +0 -0
- data/bin/varia +90 -0
- data/bin/verde +2 -0
- data/bin/vermelho +2 -0
- data/bin/vim-whereveritis +5 -0
- data/bin/viola +1 -0
- data/bin/virsh-list-all-vms.py +21 -0
- data/bin/virtualbox-manage +41 -0
- data/bin/weekend +12 -0
- data/bin/whattimeisit +4 -0
- data/bin/whereis-ip +5 -0
- data/bin/white +3 -0
- data/bin/whitefy +3 -0
- data/bin/yellow +2 -0
- data/bin/yellowfy +2 -0
- data/bin/zombies +25 -0
- data/docz/polygen/dell.grm +100 -0
- data/docz/polygen/frati.grm +85 -0
- data/docz/polygen/heanet.grm +54 -0
- data/docz/richelp/gcompute.yml +52 -0
- data/docz/richelp/gcutil.yml +52 -0
- data/docz/richelp/gmail.yml +2 -0
- data/docz/richelp/ruby.yml +81 -0
- data/docz/richelp/sakura.yml +20 -0
- data/docz/richelp/sql.yml +12 -0
- data/docz/richelp/ubuntu.yml +22 -0
- data/docz/richelp/yaml.yml +39 -0
- data/docz/richelp/yml.yml +39 -0
- data/etc/sakura/devel.yml +36 -0
- data/etc/synergy.conf.example +37 -0
- data/images/color-sample.png +0 -0
- data/images/google.jpg +0 -0
- data/images/icons/toilet.png +0 -0
- data/images/sakura.jpg +0 -0
- data/images/sakura2.jpg +0 -0
- data/init.rb +5 -0
- data/lib/classes/arrays.rb +246 -0
- data/lib/classes/debug_ric.rb +196 -0
- data/lib/classes/fake_data.rb +8 -0
- data/lib/classes/ric_debug.rb +0 -0
- data/lib/classes/ricconf.rb +110 -0
- data/lib/classes/richelp.rb +70 -0
- data/lib/classes/strings.rb +284 -0
- data/lib/facter/google_compute_engine.rb +10 -0
- data/lib/recipes/20120411-puppet-rump-palladius.recipe +2 -0
- data/lib/recipes/20120726-skype.ubuntu.recipe +16 -0
- data/lib/recipes/20130206-puppet3.ubuntu.recipe +32 -0
- data/lib/recipes/20130206-redis.linux.recipe +17 -0
- data/lib/recipes/20130208-vanilla.linux.recipe +37 -0
- data/lib/recipes/Makefile +4 -0
- data/lib/recipes/README.md +29 -0
- data/lib/recipes/scripts/redis.sh +14 -0
- data/lib/ric.rb +156 -0
- data/lib/ric_colors.rb +313 -0
- data/lib/ric_strings.rb +285 -0
- data/lib/sonice-players/itunes_mac.rb +43 -0
- data/lib/sonice-players/itunes_win.rb +47 -0
- data/lib/sonice-players/mpd.rb +45 -0
- data/lib/sonice-players/rhythmbox.rb +38 -0
- data/profile +1 -0
- data/sakuric.gemspec +40 -0
- data/sbin/install-sakura-on-debian +25 -0
- data/sbin/make-install.sh +10 -0
- data/sbin/mate-createsymlink +4 -0
- data/sounds/0.ogg +0 -0
- data/sounds/0.wav +0 -0
- data/sounds/01.ogg +0 -0
- data/sounds/02.ogg +0 -0
- data/sounds/03.ogg +0 -0
- data/sounds/08.ogg +0 -0
- data/sounds/09.ogg +0 -0
- data/sounds/1.ogg +0 -0
- data/sounds/1.wav +0 -0
- data/sounds/10.ogg +0 -0
- data/sounds/100.ogg +0 -0
- data/sounds/11.ogg +0 -0
- data/sounds/12.ogg +0 -0
- data/sounds/13.ogg +0 -0
- data/sounds/14.ogg +0 -0
- data/sounds/15.ogg +0 -0
- data/sounds/16.ogg +0 -0
- data/sounds/17.ogg +0 -0
- data/sounds/18.ogg +0 -0
- data/sounds/19.ogg +0 -0
- data/sounds/2.ogg +0 -0
- data/sounds/2.wav +0 -0
- data/sounds/20.ogg +0 -0
- data/sounds/21.ogg +0 -0
- data/sounds/22.ogg +0 -0
- data/sounds/23.ogg +0 -0
- data/sounds/24.ogg +0 -0
- data/sounds/26.ogg +0 -0
- data/sounds/3.ogg +0 -0
- data/sounds/3.wav +0 -0
- data/sounds/30.ogg +0 -0
- data/sounds/34.ogg +0 -0
- data/sounds/4.ogg +0 -0
- data/sounds/4.wav +0 -0
- data/sounds/40.ogg +0 -0
- data/sounds/42.ogg +0 -0
- data/sounds/45.ogg +0 -0
- data/sounds/47.ogg +0 -0
- data/sounds/5.ogg +0 -0
- data/sounds/5.wav +0 -0
- data/sounds/50.ogg +0 -0
- data/sounds/6.ogg +0 -0
- data/sounds/6.wav +0 -0
- data/sounds/60.ogg +0 -0
- data/sounds/7.ogg +0 -0
- data/sounds/7.wav +0 -0
- data/sounds/70.ogg +0 -0
- data/sounds/8.ogg +0 -0
- data/sounds/8.wav +0 -0
- data/sounds/80.ogg +0 -0
- data/sounds/9.ogg +0 -0
- data/sounds/9.wav +0 -0
- data/sounds/90.ogg +0 -0
- data/sounds/a.ogg +0 -0
- data/sounds/aaahhh.ogg +0 -0
- data/sounds/abologna.ogg +0 -0
- data/sounds/adargenta.ogg +0 -0
- data/sounds/alzatiecammina.ogg +0 -0
- data/sounds/apache.ogg +0 -0
- data/sounds/attenzione.ogg +0 -0
- data/sounds/awesome.m4a +0 -0
- data/sounds/bazinga.mp3 +0 -0
- data/sounds/bazinga.ogg +0 -0
- data/sounds/bela regaz.wav +0 -0
- data/sounds/benvenuti.wav +0 -0
- data/sounds/benvenuti2.wav +0 -0
- data/sounds/bergonz.ogg +0 -0
- data/sounds/boh.ogg +0 -0
- data/sounds/buahah.ogg +0 -0
- data/sounds/buonasera.ogg +0 -0
- data/sounds/buongiorno.ogg +0 -0
- data/sounds/burp.ogg +0 -0
- data/sounds/carlo.ogg +0 -0
- data/sounds/cena.ogg +0 -0
- data/sounds/che figata.m4a +0 -0
- data/sounds/che figlio di puttana.m4a +0 -0
- data/sounds/che.ogg +0 -0
- data/sounds/ciao.ogg +0 -0
- data/sounds/ciao.wav +0 -0
- data/sounds/da.ogg +0 -0
- data/sounds/davide.ogg +0 -0
- data/sounds/demone.ogg +0 -0
- data/sounds/dhcp.ogg +0 -0
- data/sounds/dinuovo.ogg +0 -0
- data/sounds/dns.ogg +0 -0
- data/sounds/dopo.ogg +0 -0
- data/sounds/e'.ogg +0 -0
- data/sounds/eattivo.ogg +0 -0
- data/sounds/ee.ogg +0 -0
- data/sounds/ehi.ogg +0 -0
- data/sounds/eoragiu.ogg +0 -0
- data/sounds/eorasu.ogg +0 -0
- data/sounds/eripartita.ogg +0 -0
- data/sounds/estato.ogg +0 -0
- data/sounds/estatoriavviato.ogg +0 -0
- data/sounds/fratro.ogg +0 -0
- data/sounds/frozenbubble.ogg +0 -0
- data/sounds/funziona.ogg +0 -0
- data/sounds/go raibh mile maith agaibh.m4a +0 -0
- data/sounds/grazie.ogg +0 -0
- data/sounds/h1.ogg +0 -0
- data/sounds/hainuovaposta.ogg +0 -0
- data/sounds/hogiamangiato.ogg +0 -0
- data/sounds/host.ogg +0 -0
- data/sounds/il.ogg +0 -0
- data/sounds/ilcomputer.ogg +0 -0
- data/sounds/ilnumerodaleiselezionatoe.ogg +0 -0
- data/sounds/ilprocesso.ogg +0 -0
- data/sounds/ilprogramma.ogg +0 -0
- data/sounds/ilservizio.ogg +0 -0
- data/sounds/imap.ogg +0 -0
- data/sounds/imieisuperpoterimidiconoche.ogg +0 -0
- data/sounds/infunzione.ogg +0 -0
- data/sounds/inpunto.ogg +0 -0
- data/sounds/ipmon.ogg +0 -0
- data/sounds/laconnessioneadinternet.ogg +0 -0
- data/sounds/lastampante.ogg +0 -0
- data/sounds/lazzaron.ogg +0 -0
- data/sounds/ldap.ogg +0 -0
- data/sounds/linterfaccia.ogg +0 -0
- data/sounds/lucilla.ogg +0 -0
- data/sounds/ma vaffanculo.m4a +0 -0
- data/sounds/majjal.wav +0 -0
- data/sounds/mamma.ogg +0 -0
- data/sounds/mauro.ogg +0 -0
- data/sounds/max.ogg +0 -0
- data/sounds/meerda.wav +0 -0
- data/sounds/meno.ogg +0 -0
- data/sounds/merda clo.wav +0 -0
- data/sounds/mezza.ogg +0 -0
- data/sounds/mila.ogg +0 -0
- data/sounds/mille.ogg +0 -0
- data/sounds/minuti.ogg +0 -0
- data/sounds/named.ogg +0 -0
- data/sounds/no.ogg +0 -0
- data/sounds/nohofame.ogg +0 -0
- data/sounds/nonfunziona.ogg +0 -0
- data/sounds/nonriescoatrovare.ogg +0 -0
- data/sounds/nonsarebbeoradilavorare.ogg +0 -0
- data/sounds/nonstalavorando.ogg +0 -0
- data/sounds/numero.wav +0 -0
- data/sounds/ooohhh.ogg +0 -0
- data/sounds/pinger.ogg +0 -0
- data/sounds/pocofa.ogg +0 -0
- data/sounds/pop3.ogg +0 -0
- data/sounds/porca puttana.m4a +0 -0
- data/sounds/porcapupazza.ogg +0 -0
- data/sounds/ppp.ogg +0 -0
- data/sounds/pranzo.ogg +0 -0
- data/sounds/prego.ogg +0 -0
- data/sounds/prima.ogg +0 -0
- data/sounds/qualcosamidice.ogg +0 -0
- data/sounds/raggiungibile.ogg +0 -0
- data/sounds/riccardo.ogg +0 -0
- data/sounds/salsa ridge.wav +0 -0
- data/sounds/scusa.ogg +0 -0
- data/sounds/seriously man.m4a +0 -0
- data/sounds/si.ogg +0 -0
- data/sounds/sito porno con sonoro.wav +0 -0
- data/sounds/socmel.wav +0 -0
- data/sounds/sono.ogg +0 -0
- data/sounds/sonoacasa.ogg +0 -0
- data/sounds/sonole.ogg +0 -0
- data/sounds/sputo.ogg +0 -0
- data/sounds/ssh.ogg +0 -0
- data/sounds/stagiocando.ogg +0 -0
- data/sounds/statospento.ogg +0 -0
- data/sounds/stopaiodipalle.ogg +0 -0
- data/sounds/thesedicks.wav +0 -0
- data/sounds/tornatosu.ogg +0 -0
- data/sounds/trapoco.ogg +0 -0
- data/sounds/trequarti.ogg +0 -0
- data/sounds/tutti.ogg +0 -0
- data/sounds/una.ogg +0 -0
- data/sounds/unquarto.ogg +0 -0
- data/sounds/virgola.ogg +0 -0
- data/sources/c/usleep.c +50 -0
- data/spec/my_first_spec.rb +6 -0
- data/tasks/sakuric-gem.rake +21 -0
- data/tasks/testing.rake +15 -0
- data/templates/bashrc.inject +10 -0
- data/templates/happy_christmas.ascii_art +5 -0
- data/test/roodi.sh +10 -0
- data/test/test_mini_failing.rb +3 -0
- data/test/test_mini_ok.rb +3 -0
- data/test/test_ruby_syntax.sh +12 -0
- data/third-party/jsawk/README.markdown +437 -0
- data/third-party/jsawk/jsawk +1128 -0
- metadata +835 -0
data/bin/polygen-heanet
ADDED
data/bin/polygen-labs
ADDED
data/bin/print_key_val
ADDED
data/bin/rainbow
ADDED
data/bin/recipe
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# TODO automcompletion
|
4
|
+
# TODO
|
5
|
+
|
6
|
+
recipe="$1"
|
7
|
+
|
8
|
+
usage() {
|
9
|
+
RECIPEDIR=$SAKURALIB/recipes/
|
10
|
+
echo Recipes: `cd $RECIPEDIR && ls *.recipe`
|
11
|
+
}
|
12
|
+
if [ "aa$1" = "aa" ] ; then
|
13
|
+
usage
|
14
|
+
else
|
15
|
+
echo recipe install for $1:
|
16
|
+
echo PreChecks
|
17
|
+
echo Get code from... needs ruby
|
18
|
+
echo PostChecks
|
19
|
+
fi
|
data/bin/red
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
=begin
|
4
|
+
|
5
|
+
############################################################
|
6
|
+
@author: Riccardo Carlesso
|
7
|
+
@email: riccardo.carlesso@gmail.com
|
8
|
+
@maturity: development
|
9
|
+
@language: Ruby
|
10
|
+
@synopsis: dumps command into a history file
|
11
|
+
@tags: development, rcarlesso, test
|
12
|
+
@description:
|
13
|
+
See in $myconf
|
14
|
+
|
15
|
+
Since version 0.9.3 it supports options. Try -e, its super cool
|
16
|
+
############################################################
|
17
|
+
|
18
|
+
=end
|
19
|
+
|
20
|
+
require 'optparse' # http://ruby.about.com/od/advancedruby/a/optionparser.htm
|
21
|
+
require 'socket'
|
22
|
+
require ENV['SAKURALIB'] + '/ric_colors'
|
23
|
+
require ENV['SAKURALIB'] + '/ric_strings'
|
24
|
+
|
25
|
+
# Program constants, automagically picked up by RicLib
|
26
|
+
# More configuration could be written in:
|
27
|
+
# $SVNHOME/etc/ricsvn/<FILENAME>.yml
|
28
|
+
# That would go into the variable '$prog_conf_d'
|
29
|
+
$myconf = {
|
30
|
+
:app_name => 'remember',
|
31
|
+
:remember_dir => '~/remember',
|
32
|
+
:tail_len => 20,
|
33
|
+
:description => 'This script tries to remember what you just did on the CLI
|
34
|
+
for future use. It does it by recording on a directory.
|
35
|
+
Basically its a "persistent" history'
|
36
|
+
}
|
37
|
+
|
38
|
+
$PROG_VER = '0.9.3'
|
39
|
+
$DEBUG = false
|
40
|
+
|
41
|
+
def deb(str)
|
42
|
+
puts "#DEB# #{str}" if $DEBUG #
|
43
|
+
end
|
44
|
+
|
45
|
+
def debug_on(str)
|
46
|
+
$DEBUG = true
|
47
|
+
end
|
48
|
+
|
49
|
+
def usage(comment=nil)
|
50
|
+
puts "#{$0} v.#{$PROG_VER}"
|
51
|
+
puts "Usage: #{File.basename $0} [-dhjtv] [-l LOGFILE] [-g STR] <COMMAND> <TO> <ISSUE>"
|
52
|
+
puts comment if comment
|
53
|
+
puts description
|
54
|
+
#exit 11
|
55
|
+
end
|
56
|
+
|
57
|
+
def init()
|
58
|
+
$opts = {}
|
59
|
+
optparse = OptionParser.new do |opts|
|
60
|
+
# Set a banner, displayed at the top of the help screen.
|
61
|
+
#opts.banner = "#{$0} v.#{$PROG_VER}\n Usage: #{File.basename $0} [options] file1 file2 ..."
|
62
|
+
$opts[:verbose] = $opts[:jabba] = $opts[:debug] = false
|
63
|
+
$opts[:logfile] = $opts[:grep] = nil
|
64
|
+
$opts[:tail] = $myconf[:tail_len]
|
65
|
+
opts.on( '-d', '--debug', 'enables debug (DFLT=false)' ) { $opts[:debug] = true}
|
66
|
+
opts.on( '-e', '--edit', "edits file with vi" ) { $opts[:edit] = true }
|
67
|
+
opts.on( '-h', '--help', 'Display this screen' ) { puts(opts); exit 1 }
|
68
|
+
opts.on( '-g', '--grep STRING', 'Searchs for STRING' ) {|str| $opts[:grep] = str }
|
69
|
+
opts.on( '-l', '--logfile FILE', 'Write log to FILE' ) {|file| $opts[:logfile] = file }
|
70
|
+
opts.on( '-t', '--tail', "Just tail argument (dflt tail length=#{$myconf[:tail_len]}" ) {|len| $opts[:tail] = len || $myconf[:tail_len]}
|
71
|
+
opts.on( '-v', '--verbose', 'Output more information' ) { $opts[:verbose] = true}
|
72
|
+
end
|
73
|
+
optparse.parse!
|
74
|
+
$DEBUG = $opts[:debug]
|
75
|
+
debug_on('enabled via GetOpts') if $opts[:debug]
|
76
|
+
puts "Being verbose" if $opts[:verbose]
|
77
|
+
puts "Logging to file #{$opts[:logfile]}" if $opts[:logfile]
|
78
|
+
end
|
79
|
+
|
80
|
+
def remember_and_execute_command(command,logfile,remember=true)
|
81
|
+
if remember
|
82
|
+
File.open(logfile, 'a') { |f| f.write "#{Time.now} #{Socket.gethostname} [#{ENV['USER']}] #{command}\n" }
|
83
|
+
puts "#Remembering: '''#{command}'''"
|
84
|
+
puts "#Written file: #{logfile}"
|
85
|
+
end
|
86
|
+
puts "#Now executing: #{command}"
|
87
|
+
system(command) # Id need a "$@"
|
88
|
+
deb "#Just executed (exit=#{$!}): #{command}"
|
89
|
+
deb "#Written file (2): #{logfile}"
|
90
|
+
end
|
91
|
+
|
92
|
+
#Tue Aug 28 15:57:38 +0100 2012 derek.dub.corp.google.com [rcarlesso] @tag21 @tags2 my command
|
93
|
+
def remember_color_regex(str)
|
94
|
+
d1,d2,d3,tim,gmt,yr,host,user,command = str.split(' ',9)
|
95
|
+
color_date = gray([d1,d2,d3,tim,gmt,yr].join(' '))
|
96
|
+
color_host = blue(host.split('.').first)
|
97
|
+
color_user = gray(user)
|
98
|
+
# makes the tags cyan :)
|
99
|
+
color_cmd = yellow(command)
|
100
|
+
color_cmd = command.split(' ').map{|word| word.begin_with?('@') ? cyan(word) : yellow(word) }.join(' ')
|
101
|
+
|
102
|
+
#puts str
|
103
|
+
#return [ color_date, color_host, color_user, color_cmd ].join ' '
|
104
|
+
color_cmd
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
def show_last_commands(logfile)
|
109
|
+
mycommand = "tail -n #{$opts[:tail]} '#{logfile}'"
|
110
|
+
if $opts[:grep]
|
111
|
+
mycommand ="grep --color '#{ $opts[:grep] }' '#{logfile}'"
|
112
|
+
end
|
113
|
+
deb "command: #{mycommand}"
|
114
|
+
lines = %x{ #{mycommand} } # doesnt work in ruby1.9!
|
115
|
+
#lines = `#{mycommand}` # doesnt work in ruby1.9!
|
116
|
+
lines.split("\n").each do |line|
|
117
|
+
puts remember_color_regex(line) # "Line: #{line}"
|
118
|
+
end
|
119
|
+
$stderr.puts "# Try also: cat #{logfile}"
|
120
|
+
end
|
121
|
+
|
122
|
+
def main
|
123
|
+
init
|
124
|
+
path = File.expand_path($myconf[:remember_dir]) # for normal users
|
125
|
+
path = File.expand_path(ENV['SVNHOME'] + "/var/remember/" ) if ENV['SVNHOME'] # for Riccardo
|
126
|
+
logfile = path +"/all"
|
127
|
+
mycommand = ARGV.join ' '
|
128
|
+
if ($opts[:edit]) # vi and piositions at end of file
|
129
|
+
remember_and_execute_command("vi + '#{logfile}'", logfile, false)
|
130
|
+
exit 0
|
131
|
+
end
|
132
|
+
unless(ARGV.size > 0) # No arguments provided
|
133
|
+
show_last_commands(logfile)
|
134
|
+
exit 1
|
135
|
+
end
|
136
|
+
puts `mkdir -p '#{path}'`
|
137
|
+
remember_and_execute_command(mycommand, logfile)
|
138
|
+
end
|
139
|
+
|
140
|
+
main()
|
@@ -0,0 +1,140 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
=begin
|
4
|
+
|
5
|
+
############################################################
|
6
|
+
@author: Riccardo Carlesso
|
7
|
+
@email: riccardo.carlesso@gmail.com
|
8
|
+
@maturity: development
|
9
|
+
@language: Ruby
|
10
|
+
@synopsis: dumps command into a history file
|
11
|
+
@tags: development, rcarlesso, test
|
12
|
+
@description:
|
13
|
+
See in $myconf
|
14
|
+
|
15
|
+
Since version 0.9.3 it supports options. Try -e, its super cool
|
16
|
+
############################################################
|
17
|
+
|
18
|
+
=end
|
19
|
+
|
20
|
+
require 'optparse' # http://ruby.about.com/od/advancedruby/a/optionparser.htm
|
21
|
+
require 'socket'
|
22
|
+
require ENV['SAKURALIB'] + '/ric_colors'
|
23
|
+
require ENV['SAKURALIB'] + '/ric_strings'
|
24
|
+
|
25
|
+
# Program constants, automagically picked up by RicLib
|
26
|
+
# More configuration could be written in:
|
27
|
+
# $SVNHOME/etc/ricsvn/<FILENAME>.yml
|
28
|
+
# That would go into the variable '$prog_conf_d'
|
29
|
+
$myconf = {
|
30
|
+
:app_name => 'remember',
|
31
|
+
:remember_dir => '~/remember',
|
32
|
+
:tail_len => 20,
|
33
|
+
:description => 'This script tries to remember what you just did on the CLI
|
34
|
+
for future use. It does it by recording on a directory.
|
35
|
+
Basically its a "persistent" history'
|
36
|
+
}
|
37
|
+
|
38
|
+
$PROG_VER = '0.9.3'
|
39
|
+
$DEBUG = false
|
40
|
+
|
41
|
+
def deb(str)
|
42
|
+
puts "#DEB# #{str}" if $DEBUG #
|
43
|
+
end
|
44
|
+
|
45
|
+
def debug_on(str)
|
46
|
+
$DEBUG = true
|
47
|
+
end
|
48
|
+
|
49
|
+
def usage(comment=nil)
|
50
|
+
puts "#{$0} v.#{$PROG_VER}"
|
51
|
+
puts "Usage: #{File.basename $0} [-dhjtv] [-l LOGFILE] [-g STR] <COMMAND> <TO> <ISSUE>"
|
52
|
+
puts comment if comment
|
53
|
+
puts description
|
54
|
+
#exit 11
|
55
|
+
end
|
56
|
+
|
57
|
+
def init()
|
58
|
+
$opts = {}
|
59
|
+
optparse = OptionParser.new do |opts|
|
60
|
+
# Set a banner, displayed at the top of the help screen.
|
61
|
+
#opts.banner = "#{$0} v.#{$PROG_VER}\n Usage: #{File.basename $0} [options] file1 file2 ..."
|
62
|
+
$opts[:verbose] = $opts[:jabba] = $opts[:debug] = false
|
63
|
+
$opts[:logfile] = $opts[:grep] = nil
|
64
|
+
$opts[:tail] = $myconf[:tail_len]
|
65
|
+
opts.on( '-d', '--debug', 'enables debug (DFLT=false)' ) { $opts[:debug] = true}
|
66
|
+
opts.on( '-e', '--edit', "edits file with vi" ) { $opts[:edit] = true }
|
67
|
+
opts.on( '-h', '--help', 'Display this screen' ) { puts(opts); exit 1 }
|
68
|
+
opts.on( '-g', '--grep STRING', 'Searchs for STRING' ) {|str| $opts[:grep] = str }
|
69
|
+
opts.on( '-l', '--logfile FILE', 'Write log to FILE' ) {|file| $opts[:logfile] = file }
|
70
|
+
opts.on( '-t', '--tail', "Just tail argument (dflt tail length=#{$myconf[:tail_len]}" ) {|len| $opts[:tail] = len || $myconf[:tail_len]}
|
71
|
+
opts.on( '-v', '--verbose', 'Output more information' ) { $opts[:verbose] = true}
|
72
|
+
end
|
73
|
+
optparse.parse!
|
74
|
+
$DEBUG = $opts[:debug]
|
75
|
+
debug_on('enabled via GetOpts') if $opts[:debug]
|
76
|
+
puts "Being verbose" if $opts[:verbose]
|
77
|
+
puts "Logging to file #{$opts[:logfile]}" if $opts[:logfile]
|
78
|
+
end
|
79
|
+
|
80
|
+
def remember_and_execute_command(command,logfile,remember=true)
|
81
|
+
if remember
|
82
|
+
File.open(logfile, 'a') { |f| f.write "#{Time.now} #{Socket.gethostname} [#{ENV['USER']}] #{command}\n" }
|
83
|
+
puts "#Remembering: '''#{command}'''"
|
84
|
+
puts "#Written file: #{logfile}"
|
85
|
+
end
|
86
|
+
puts "#Now executing: #{command}"
|
87
|
+
system(command) # Id need a "$@"
|
88
|
+
deb "#Just executed (exit=#{$!}): #{command}"
|
89
|
+
deb "#Written file (2): #{logfile}"
|
90
|
+
end
|
91
|
+
|
92
|
+
#Tue Aug 28 15:57:38 +0100 2012 derek.dub.corp.google.com [rcarlesso] @tag21 @tags2 my command
|
93
|
+
def remember_color_regex(str)
|
94
|
+
d1,d2,d3,tim,gmt,yr,host,user,command = str.split(' ',9)
|
95
|
+
color_date = gray([d1,d2,d3,tim,gmt,yr].join(' '))
|
96
|
+
color_host = blue(host.split('.').first)
|
97
|
+
color_user = gray(user)
|
98
|
+
# makes the tags cyan :)
|
99
|
+
color_cmd = yellow(command)
|
100
|
+
color_cmd = command.split(' ').map{|word| word.begin_with?('@') ? cyan(word) : yellow(word) }.join(' ')
|
101
|
+
|
102
|
+
#puts str
|
103
|
+
#return [ color_date, color_host, color_user, color_cmd ].join ' '
|
104
|
+
color_cmd
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
def show_last_commands(logfile)
|
109
|
+
mycommand = "tail -n #{$opts[:tail]} '#{logfile}'"
|
110
|
+
if $opts[:grep]
|
111
|
+
mycommand ="grep --color '#{ $opts[:grep] }' '#{logfile}'"
|
112
|
+
end
|
113
|
+
deb "command: #{mycommand}"
|
114
|
+
lines = %x{ #{mycommand} } # doesnt work in ruby1.9!
|
115
|
+
#lines = `#{mycommand}` # doesnt work in ruby1.9!
|
116
|
+
lines.split("\n").each do |line|
|
117
|
+
puts remember_color_regex(line) # "Line: #{line}"
|
118
|
+
end
|
119
|
+
$stderr.puts "# Try also: cat #{logfile}"
|
120
|
+
end
|
121
|
+
|
122
|
+
def main
|
123
|
+
init
|
124
|
+
path = File.expand_path($myconf[:remember_dir]) # for normal users
|
125
|
+
path = File.expand_path(ENV['SVNHOME'] + "/var/remember/" ) if ENV['SVNHOME'] # for Riccardo
|
126
|
+
logfile = path +"/all"
|
127
|
+
mycommand = ARGV.join ' '
|
128
|
+
if ($opts[:edit]) # vi and piositions at end of file
|
129
|
+
remember_and_execute_command("vi + '#{logfile}'", logfile, false)
|
130
|
+
exit 0
|
131
|
+
end
|
132
|
+
unless(ARGV.size > 0) # No arguments provided
|
133
|
+
show_last_commands(logfile)
|
134
|
+
exit 1
|
135
|
+
end
|
136
|
+
puts `mkdir -p '#{path}'`
|
137
|
+
remember_and_execute_command(mycommand, logfile)
|
138
|
+
end
|
139
|
+
|
140
|
+
main()
|
data/bin/richelp
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require ENV['SAKURALIB'] + '/ric.rb' # || die( "Can't find $SAKURALIB!")
|
4
|
+
require 'yaml' # to parse .yml files
|
5
|
+
require 'find'
|
6
|
+
|
7
|
+
# local status... this is SOOOOO 80s!
|
8
|
+
$some_exception = false
|
9
|
+
|
10
|
+
include RicHelpModule
|
11
|
+
|
12
|
+
def help(k, value=red('???'), query='', opts = {} )
|
13
|
+
a = k.to_s.escape_printf
|
14
|
+
b = value.to_s.escape_printf
|
15
|
+
if (query != '')
|
16
|
+
return unless (a.match(/#{query}/i) || b.match(/#{query}/i) )
|
17
|
+
end
|
18
|
+
return sprintf(
|
19
|
+
"#{ colora( $color_line_key, "%-#{$column_length}s") } #{ colora( ($color_line_val rescue 2) , "%s") }#{red " (#{opts})" unless opts.to_s == '{}' }\n" % [a,b]
|
20
|
+
) rescue prosso("Bad Line ('#{$!}'): #{ [gray( a), white( b)] }")
|
21
|
+
end
|
22
|
+
|
23
|
+
def title(s)
|
24
|
+
puts( colora($color_title," #{s}") )
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
def special_help_title?(k2)
|
29
|
+
k2.match(/^_/) # inizia con '_'
|
30
|
+
end
|
31
|
+
|
32
|
+
def exception_yml(msg='')
|
33
|
+
$some_exception = true
|
34
|
+
{ "Exception parsing YML file: '#{red msg}'" =>
|
35
|
+
{ 'File/Line' => "#{__FILE__}, line #{__LINE__}",
|
36
|
+
"Legal files" => yellow( $help_files.sort.join(', ')) ,
|
37
|
+
}
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
def init(helpfile)
|
42
|
+
# compute help files
|
43
|
+
$help_files = []
|
44
|
+
Find.find($HELP_DIR) { |f| $help_files << File.basename(f, '.yml') if f.match('.yml$') }
|
45
|
+
# compute max length on the left
|
46
|
+
# TODO make this length dynamic on the search
|
47
|
+
$column_length = 5 # minimum
|
48
|
+
if( helpfile == '' || helpfile.nil? )
|
49
|
+
usage
|
50
|
+
exit 1
|
51
|
+
end
|
52
|
+
if helpfile == 'all'
|
53
|
+
puts "usali tutti TBD: #{$help_files.join ' '}"
|
54
|
+
helpfiles = $help_files
|
55
|
+
else
|
56
|
+
helpfiles = [ helpfile ]
|
57
|
+
end
|
58
|
+
helpfiles.each do |helpfile|
|
59
|
+
$help_opt = helpfile_parse( helpfile)
|
60
|
+
$help_opt.each{ |k1,v1|
|
61
|
+
v1.each{ |k2,v2|
|
62
|
+
k2 = k2.to_s
|
63
|
+
$column_length = k2.length if ( k2.length > $column_length )
|
64
|
+
} unless special_help_title?(k1)
|
65
|
+
}
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
def usage
|
71
|
+
puts "Usage: #{$0} [-hdvm] <FILE> [<QUERY>]"
|
72
|
+
puts " -d: debug"
|
73
|
+
puts " -h: this help"
|
74
|
+
puts " -m: open file with textmate (or GUARDA equivalent)"
|
75
|
+
puts " -t: just test file"
|
76
|
+
puts "Available files are: " + yellow( $help_files.join(', '))
|
77
|
+
exit 1
|
78
|
+
end
|
79
|
+
|
80
|
+
def main
|
81
|
+
usable_argv = ARGV.select{|arg| ! arg.match /^-/ }
|
82
|
+
debug_on('from ARGV') if ARGV.match /-d/
|
83
|
+
usage if ARGV.match /^-h/
|
84
|
+
file_str = usable_argv[0]
|
85
|
+
query_str = usable_argv[1] rescue ''
|
86
|
+
init(file_str)
|
87
|
+
puts "Search for: '#{green query_str}' into #{gray "#{file_str}.yml"}" if query_str
|
88
|
+
if ARGV.match /^-t/
|
89
|
+
show_test(file_str) # just test
|
90
|
+
else
|
91
|
+
show_help(query_str)
|
92
|
+
end
|
93
|
+
mate_cmd = "vim #{$HELP_DIR}/#{file_str}.yml"
|
94
|
+
puts "# To add stuff, type: #{gray mate_cmd }"
|
95
|
+
`#{mate_cmd}` if ARGV.match /-m/
|
96
|
+
exit ($some_exception ? 42 : 0)
|
97
|
+
end
|
98
|
+
|
99
|
+
main()
|
data/bin/ricorda-comando
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
=begin
|
4
|
+
|
5
|
+
############################################################
|
6
|
+
@author: Riccardo Carlesso
|
7
|
+
@email: riccardo.carlesso@gmail.com
|
8
|
+
@maturity: development
|
9
|
+
@language: Ruby
|
10
|
+
@synopsis: dumps command into a history file
|
11
|
+
@tags: development, rcarlesso, test
|
12
|
+
@description:
|
13
|
+
See in $myconf
|
14
|
+
|
15
|
+
Since version 0.9.3 it supports options. Try -e, its super cool
|
16
|
+
############################################################
|
17
|
+
|
18
|
+
=end
|
19
|
+
|
20
|
+
require 'optparse' # http://ruby.about.com/od/advancedruby/a/optionparser.htm
|
21
|
+
require 'socket'
|
22
|
+
require ENV['SAKURALIB'] + '/ric_colors'
|
23
|
+
require ENV['SAKURALIB'] + '/ric_strings'
|
24
|
+
|
25
|
+
# Program constants, automagically picked up by RicLib
|
26
|
+
# More configuration could be written in:
|
27
|
+
# $SVNHOME/etc/ricsvn/<FILENAME>.yml
|
28
|
+
# That would go into the variable '$prog_conf_d'
|
29
|
+
$myconf = {
|
30
|
+
:app_name => 'remember',
|
31
|
+
:remember_dir => '~/remember',
|
32
|
+
:tail_len => 20,
|
33
|
+
:description => 'This script tries to remember what you just did on the CLI
|
34
|
+
for future use. It does it by recording on a directory.
|
35
|
+
Basically its a "persistent" history'
|
36
|
+
}
|
37
|
+
|
38
|
+
$PROG_VER = '0.9.3'
|
39
|
+
$DEBUG = false
|
40
|
+
|
41
|
+
def deb(str)
|
42
|
+
puts "#DEB# #{str}" if $DEBUG #
|
43
|
+
end
|
44
|
+
|
45
|
+
def debug_on(str)
|
46
|
+
$DEBUG = true
|
47
|
+
end
|
48
|
+
|
49
|
+
def usage(comment=nil)
|
50
|
+
puts "#{$0} v.#{$PROG_VER}"
|
51
|
+
puts "Usage: #{File.basename $0} [-dhjtv] [-l LOGFILE] [-g STR] <COMMAND> <TO> <ISSUE>"
|
52
|
+
puts comment if comment
|
53
|
+
puts description
|
54
|
+
#exit 11
|
55
|
+
end
|
56
|
+
|
57
|
+
def init()
|
58
|
+
$opts = {}
|
59
|
+
optparse = OptionParser.new do |opts|
|
60
|
+
# Set a banner, displayed at the top of the help screen.
|
61
|
+
#opts.banner = "#{$0} v.#{$PROG_VER}\n Usage: #{File.basename $0} [options] file1 file2 ..."
|
62
|
+
$opts[:verbose] = $opts[:jabba] = $opts[:debug] = false
|
63
|
+
$opts[:logfile] = $opts[:grep] = nil
|
64
|
+
$opts[:tail] = $myconf[:tail_len]
|
65
|
+
opts.on( '-d', '--debug', 'enables debug (DFLT=false)' ) { $opts[:debug] = true}
|
66
|
+
opts.on( '-e', '--edit', "edits file with vi" ) { $opts[:edit] = true }
|
67
|
+
opts.on( '-h', '--help', 'Display this screen' ) { puts(opts); exit 1 }
|
68
|
+
opts.on( '-g', '--grep STRING', 'Searchs for STRING' ) {|str| $opts[:grep] = str }
|
69
|
+
opts.on( '-l', '--logfile FILE', 'Write log to FILE' ) {|file| $opts[:logfile] = file }
|
70
|
+
opts.on( '-t', '--tail', "Just tail argument (dflt tail length=#{$myconf[:tail_len]}" ) {|len| $opts[:tail] = len || $myconf[:tail_len]}
|
71
|
+
opts.on( '-v', '--verbose', 'Output more information' ) { $opts[:verbose] = true}
|
72
|
+
end
|
73
|
+
optparse.parse!
|
74
|
+
$DEBUG = $opts[:debug]
|
75
|
+
debug_on('enabled via GetOpts') if $opts[:debug]
|
76
|
+
puts "Being verbose" if $opts[:verbose]
|
77
|
+
puts "Logging to file #{$opts[:logfile]}" if $opts[:logfile]
|
78
|
+
end
|
79
|
+
|
80
|
+
def remember_and_execute_command(command,logfile,remember=true)
|
81
|
+
if remember
|
82
|
+
File.open(logfile, 'a') { |f| f.write "#{Time.now} #{Socket.gethostname} [#{ENV['USER']}] #{command}\n" }
|
83
|
+
puts "#Remembering: '''#{command}'''"
|
84
|
+
puts "#Written file: #{logfile}"
|
85
|
+
end
|
86
|
+
puts "#Now executing: #{command}"
|
87
|
+
system(command) # Id need a "$@"
|
88
|
+
deb "#Just executed (exit=#{$!}): #{command}"
|
89
|
+
deb "#Written file (2): #{logfile}"
|
90
|
+
end
|
91
|
+
|
92
|
+
#Tue Aug 28 15:57:38 +0100 2012 derek.dub.corp.google.com [rcarlesso] @tag21 @tags2 my command
|
93
|
+
def remember_color_regex(str)
|
94
|
+
d1,d2,d3,tim,gmt,yr,host,user,command = str.split(' ',9)
|
95
|
+
color_date = gray([d1,d2,d3,tim,gmt,yr].join(' '))
|
96
|
+
color_host = blue(host.split('.').first)
|
97
|
+
color_user = gray(user)
|
98
|
+
# makes the tags cyan :)
|
99
|
+
color_cmd = yellow(command)
|
100
|
+
color_cmd = command.split(' ').map{|word| word.begin_with?('@') ? cyan(word) : yellow(word) }.join(' ')
|
101
|
+
|
102
|
+
#puts str
|
103
|
+
#return [ color_date, color_host, color_user, color_cmd ].join ' '
|
104
|
+
color_cmd
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
def show_last_commands(logfile)
|
109
|
+
mycommand = "tail -n #{$opts[:tail]} '#{logfile}'"
|
110
|
+
if $opts[:grep]
|
111
|
+
mycommand ="grep --color '#{ $opts[:grep] }' '#{logfile}'"
|
112
|
+
end
|
113
|
+
deb "command: #{mycommand}"
|
114
|
+
lines = %x{ #{mycommand} } # doesnt work in ruby1.9!
|
115
|
+
#lines = `#{mycommand}` # doesnt work in ruby1.9!
|
116
|
+
lines.split("\n").each do |line|
|
117
|
+
puts remember_color_regex(line) # "Line: #{line}"
|
118
|
+
end
|
119
|
+
$stderr.puts "# Try also: cat #{logfile}"
|
120
|
+
end
|
121
|
+
|
122
|
+
def main
|
123
|
+
init
|
124
|
+
path = File.expand_path($myconf[:remember_dir]) # for normal users
|
125
|
+
path = File.expand_path(ENV['SVNHOME'] + "/var/remember/" ) if ENV['SVNHOME'] # for Riccardo
|
126
|
+
logfile = path +"/all"
|
127
|
+
mycommand = ARGV.join ' '
|
128
|
+
if ($opts[:edit]) # vi and piositions at end of file
|
129
|
+
remember_and_execute_command("vi + '#{logfile}'", logfile, false)
|
130
|
+
exit 0
|
131
|
+
end
|
132
|
+
unless(ARGV.size > 0) # No arguments provided
|
133
|
+
show_last_commands(logfile)
|
134
|
+
exit 1
|
135
|
+
end
|
136
|
+
puts `mkdir -p '#{path}'`
|
137
|
+
remember_and_execute_command(mycommand, logfile)
|
138
|
+
end
|
139
|
+
|
140
|
+
main()
|