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/epoch2date
ADDED
data/bin/fanout
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
#Copyright 2000, 2001, 2002, 2003 William Stearns <wstearns@pobox.com>
|
3
|
+
#GPL'd, of course.
|
4
|
+
#Version 0.6.1, 8/7/2002
|
5
|
+
#Home web site: http://www.stearns.org/fanout/
|
6
|
+
|
7
|
+
fanoutcleanup () {
|
8
|
+
echo -n Exiting fanout, cleaning up... >/dev/stderr
|
9
|
+
if [ -n "$OUTFILES" ]; then
|
10
|
+
for ONEFILE in $OUTFILES ; do
|
11
|
+
if [ -f $ONEFILE ]; then
|
12
|
+
rm -f ONEFILE
|
13
|
+
fi
|
14
|
+
done
|
15
|
+
fi
|
16
|
+
echo done. >/dev/stderr
|
17
|
+
exit
|
18
|
+
}
|
19
|
+
|
20
|
+
trap fanoutcleanup EXIT #Clean up on exit
|
21
|
+
|
22
|
+
usage () {
|
23
|
+
echo "Usage:" >/dev/stderr
|
24
|
+
echo " $0 \"MACHINES\" \"commands and parameters to run on each machine\"" >/dev/stderr
|
25
|
+
echo " $0 -h #Show this help" >/dev/stderr
|
26
|
+
echo >/dev/stderr
|
27
|
+
echo "Examples:" >/dev/stderr
|
28
|
+
echo " fanout \"wstearns@localhost localhost anotherhost.someplace.net\" \\" >/dev/stderr
|
29
|
+
echo " \"echo My PID is \\\"\$PPID\\\" ; sleep 15\"" >/dev/stderr
|
30
|
+
echo >/dev/stderr
|
31
|
+
echo " fanout \"localhost\" \"uname -a ; rpm -qa | egrep -i '(openlinux|redhat-release)' \\" >/dev/stderr
|
32
|
+
echo " ; uptime ; df -P / ; netstat -a | grep '*:*'\" | less" >/dev/stderr
|
33
|
+
echo >/dev/stderr
|
34
|
+
echo " fanout \"localhost myaccount@localhost\" \"uptime\" >uptime-sample" >/dev/stderr
|
35
|
+
echo >/dev/stderr
|
36
|
+
echo " If you set the SERVERS variable in your environment, you can run commands on" >/dev/stderr
|
37
|
+
echo " these machines over and over:" >/dev/stderr
|
38
|
+
echo >/dev/stderr
|
39
|
+
echo " export SERVERS=\"web1 web2 mail\"" >/dev/stderr
|
40
|
+
echo " fanout \"\$SERVERS \" \"uname -a ; ( if [ -f /var/log/dmesg ]; then \\" >/dev/stderr
|
41
|
+
echo " cat /var/log/dmesg ; else dmesg ; fi ) | egrep -i '(hd[a-h]|sd[a-h])' ; ls -al \\" >/dev/stderr
|
42
|
+
echo " /proc/kcore ; cat /proc/cpuinfo\" >serverspecs" >/dev/stderr
|
43
|
+
exit
|
44
|
+
}
|
45
|
+
|
46
|
+
if [ -z "$1" ]; then usage ; fi
|
47
|
+
if [ "$1" = "-h" ]; then usage ; fi
|
48
|
+
if [ "$1" = "--noping" ]; then PING="NO" ; shift ; fi
|
49
|
+
|
50
|
+
MYPID="$$"
|
51
|
+
TARGETS=`echo "$1" | tr ' ' '\012' | sort | uniq` #Sort and remove dupes
|
52
|
+
shift #Leave just the commands and params to be executed.
|
53
|
+
STARTTIME=`date`
|
54
|
+
for ONETARGET in $TARGETS ; do
|
55
|
+
case $ONETARGET in
|
56
|
+
*@*) #user@machine form
|
57
|
+
ONEUSER="-l ${ONETARGET%%@*}"
|
58
|
+
ONEMACH=${ONETARGET##*@}
|
59
|
+
HEADER="==== As ${ONETARGET%%@*} on $ONEMACH ===="
|
60
|
+
;;
|
61
|
+
*) #just machine form
|
62
|
+
ONEUSER=""
|
63
|
+
ONEMACH=$ONETARGET
|
64
|
+
HEADER="==== On $ONEMACH ===="
|
65
|
+
;;
|
66
|
+
esac
|
67
|
+
|
68
|
+
if type -path mktemp >/dev/null 2>/dev/null ; then
|
69
|
+
TMPFILE=`mktemp -q /tmp/fanout.XXXXXX`
|
70
|
+
if [ $? -ne 0 ]; then
|
71
|
+
echo "$0: Can't create temp file ${TMPFILE}." >/dev/stderr
|
72
|
+
exit 1
|
73
|
+
fi
|
74
|
+
else
|
75
|
+
TMPFILE="/tmp/fanout.$MYPID.$ONETARGET.$RANDOM"
|
76
|
+
touch $TMPFILE
|
77
|
+
if [ $? -ne 0 ]; then
|
78
|
+
echo "$0: Can't create temp file ${TMPFILE}." >/dev/stderr
|
79
|
+
exit 1
|
80
|
+
fi
|
81
|
+
fi
|
82
|
+
OUTFILES="$OUTFILES $TMPFILE" #Remember the filename for later display, cleanup
|
83
|
+
if [ "$PING" = "NO" ] || ping -c 3 $ONEMACH >/dev/null 2>/dev/null ; then
|
84
|
+
echo Starting $ONETARGET >/dev/stderr #Machine is reachable
|
85
|
+
#Show machine name header, show command output, indented two spaces, save all to a temp file.
|
86
|
+
( echo $HEADER ; ssh -n $ONEUSER $ONEMACH "$*" | sed -e 's/^/ /' ; echo ) >$TMPFILE &
|
87
|
+
else
|
88
|
+
echo $ONETARGET unavailable >/dev/stderr #Machine not responding
|
89
|
+
echo $HEADER ; echo "==== Machine unreachable by ping" ; echo >$TMPFILE
|
90
|
+
fi
|
91
|
+
done
|
92
|
+
wait #Until everyone's done.
|
93
|
+
|
94
|
+
echo "Fanout executing \"$*\""
|
95
|
+
echo Start time $STARTTIME , End time `date`
|
96
|
+
for ONEFILE in $OUTFILES ; do
|
97
|
+
cat $ONEFILE
|
98
|
+
rm -f $ONEFILE
|
99
|
+
done
|
100
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# This finds everything which is in the current dir (and below) and looks for broken links.
|
4
|
+
|
5
|
+
WHERE=${1:-.}
|
6
|
+
CANCELLA=${2:-noncancellare}
|
7
|
+
|
8
|
+
usage() {
|
9
|
+
echo "Usage: $(basename $0) [<DIRECTORY>] [--delete]"
|
10
|
+
echo ""
|
11
|
+
echo " This scripts finds the symlinks in the specified DIR tree."
|
12
|
+
echo " If directory is not specified, current dir ('.') is assumed."
|
13
|
+
echo " With --delete option, it'll also delete them"
|
14
|
+
}
|
15
|
+
|
16
|
+
if echo $2 | egrep -q '^--delete$' ; then
|
17
|
+
blue "# I DELETE symlinks from '$WHERE' in giu:" >&2
|
18
|
+
find $WHERE -type l ! -exec test -r {} \; -print0 | xargs -0 rm
|
19
|
+
green "Done"
|
20
|
+
else
|
21
|
+
yellow "# I look for symlinks from '$WHERE' downwards:" >&2
|
22
|
+
find $WHERE -type l ! -exec test -r {} \; -print
|
23
|
+
usage
|
24
|
+
# echo "+ If you want to delete em, please type: '$0 $WHERE --delete'"
|
25
|
+
fi
|
26
|
+
|
data/bin/find-duplicates
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
DIR=${1:-.}
|
4
|
+
#DEBUG=true
|
5
|
+
DEBUG=false
|
6
|
+
|
7
|
+
################################################################################
|
8
|
+
# This program finds all files in the current directrory with the same md5 and it prints them out.
|
9
|
+
################################################################################
|
10
|
+
|
11
|
+
function debugga() {
|
12
|
+
if $DEBUG ; then
|
13
|
+
echo '#DEB# ' $* >&2
|
14
|
+
fi
|
15
|
+
}
|
16
|
+
TMPFILE="/tmp/md5z.$USER.$$"
|
17
|
+
#DOPPIONIcaTMP_DUPLICATES="/tmp/m5d-duplicates"
|
18
|
+
#TMPFILE='./.md5z.list'
|
19
|
+
TMP_DUPLICATES='./.md5z.duplicates'
|
20
|
+
FIND_OPTS='-not -type l'
|
21
|
+
|
22
|
+
# creao lista degli md5 almeno doppi.
|
23
|
+
rm -f $TMPFILE $TMP_DUPLICATES
|
24
|
+
# in case its empty..
|
25
|
+
touch $TMPFILE $TMP_DUPLICATES
|
26
|
+
find "$DIR" $FIND_OPTS | fgrep -v '/.svn/' | while read F; do
|
27
|
+
debugga File "$F"
|
28
|
+
md5sum "$F" >>$TMPFILE # 2>/dev/null
|
29
|
+
done
|
30
|
+
|
31
|
+
debugga "Creating file with duplicates from dir: '$DIR'"
|
32
|
+
cat $TMPFILE|sort|awk '{print $1}'|uniq -c|egrep -v " 1"|awk '{print $2}' >$TMP_DUPLICATES
|
33
|
+
|
34
|
+
#debugga "Leggo i file e ti dico cosa ho trovato:"
|
35
|
+
|
36
|
+
cat $TMP_DUPLICATES|while read row
|
37
|
+
do
|
38
|
+
echo " ### MD5: $row ###"
|
39
|
+
fgrep $row $TMPFILE|cut -d" " -f 2-
|
40
|
+
echo
|
41
|
+
done
|
42
|
+
|
43
|
+
if $DEBUG; then
|
44
|
+
debugga Leaving files where they are for debug.
|
45
|
+
else
|
46
|
+
rm -f $TMPFILE $TMP_DUPLICATES
|
47
|
+
fi
|
48
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
DIR=${1:-.}
|
4
|
+
|
5
|
+
#echo "# Mancano ancora le parentesi tonde e quadre)"
|
6
|
+
echo "#Looking for filenames with special characters for dir: '$DIR'..." >&2
|
7
|
+
find "$DIR" | while read x; do
|
8
|
+
y=$( echo $x | sed -e 's/[a-zA-Z0-9@ ()./_-]//g' )
|
9
|
+
if echo $y | egrep -qv '^$' ; then
|
10
|
+
yellow "'$x' --> '$y'";
|
11
|
+
fi
|
12
|
+
done
|
data/bin/fix-terminal
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -x
|
4
|
+
|
5
|
+
sudo python /usr/share/imagebundle/image_bundle.py -r / -o /tmp/ --log_file=/tmp/image_creation.log
|
6
|
+
echo please now find the logs and the tar.gz in /tmp. You might want to try this:
|
7
|
+
echo gsutil mb gs://gce-java-image/
|
8
|
+
echo gsutil cp /tmp/*.tar.gz gs://gce-java-image/java-image.tar.gz
|
data/bin/gce-get-token
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# @tags: gce, google compute engine, metadata, json, parser
|
4
|
+
|
5
|
+
# verify gem jazor has been installed
|
6
|
+
if [ ! -f /usr/bin/jazor ] ; then
|
7
|
+
echo 'Jazor gem not found. Try this: sudo gem install jazor'
|
8
|
+
exit 1
|
9
|
+
fi
|
10
|
+
|
11
|
+
GCUTIL_JSON="gcutil getproject --format json"
|
12
|
+
|
13
|
+
usage() {
|
14
|
+
echo "$0 [<METADATA>]"
|
15
|
+
echo " --help: this help"
|
16
|
+
echo " <METADATA>: retrieves value for this metadata Key"
|
17
|
+
echo " --show: retrieves a list of metadata keys"
|
18
|
+
echo "Note. Only the current project is available ATM. To change project, you have to change ~/.gcutil.flags"
|
19
|
+
exit 1
|
20
|
+
}
|
21
|
+
|
22
|
+
if [ "A$1" = 'A--help' -o "A$1" = 'A-h' ] ; then
|
23
|
+
usage
|
24
|
+
fi
|
25
|
+
if [ "$#" -eq 0 ];then
|
26
|
+
usage
|
27
|
+
fi
|
28
|
+
|
29
|
+
if [ "$1" = '--show' ];then
|
30
|
+
echo 'List of Project Metadata:'
|
31
|
+
$GCUTIL_JSON | jazor 'commonInstanceMetadata.items.map{|x| x["key"] }.each{|x| print "- " + x, "\n" }; "\n"'
|
32
|
+
else
|
33
|
+
ARGUMENT="$1"
|
34
|
+
$GCUTIL_JSON | jazor 'commonInstanceMetadata.items.map{|x| x["key"]=="'$ARGUMENT'" ? x["value"] : null }.compact()[0]'
|
35
|
+
fi
|
data/bin/gce-public-ip
ADDED
data/bin/gcutil-fetch
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# Author: A. Iurlano
|
4
|
+
|
5
|
+
# run this as normal user, with bash shell
|
6
|
+
|
7
|
+
GZNAME=`curl -s https://developers.google.com/compute/docs/gcutil/ | grep -o 'https://code.google.com/p/google-compute-engine-tools/downloads/detail?name=gcutil-[^"]*.tar.gz'| grep -o 'gcutil.*'`
|
8
|
+
|
9
|
+
GCURL='https://google-compute-engine-tools.googlecode.com/files/'${GZNAME}
|
10
|
+
|
11
|
+
#echo ${GCURL}
|
12
|
+
#echo ${GZNAME}
|
13
|
+
|
14
|
+
cd /usr/local/
|
15
|
+
|
16
|
+
sudo -E wget -c ${GCURL} -O ${GZNAME}
|
17
|
+
|
18
|
+
sudo tar zxvf ${GZNAME}
|
19
|
+
|
20
|
+
export FOLDERNAME=${GZNAME:0:$((${#GZNAME}-7))}
|
21
|
+
|
22
|
+
sudo rm -f /usr/local/gcutil
|
23
|
+
sudo ln -sf /usr/local/${FOLDERNAME} /usr/local/gcutil
|
24
|
+
|
25
|
+
#check if it was added to the path
|
26
|
+
grep -q '/usr/local/gcutil' ~/.bashrc
|
27
|
+
if [ $? -ne 0 ]; then
|
28
|
+
cat <<EOF >> ~/.bashrc
|
29
|
+
|
30
|
+
export PATH=/usr/local/gcutil:\${PATH}
|
31
|
+
|
32
|
+
EOF
|
33
|
+
echo "Warning: Your .bashrc file was modified."
|
34
|
+
echo " Remember to do . ~/.bashrc or logout and log back in"
|
35
|
+
fi
|
36
|
+
|
data/bin/giallo
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
|
4
|
+
# From here: http://stackoverflow.com/questions/2411031/git-how-do-i-clone-into-a-non-empty-directory
|
5
|
+
|
6
|
+
REPO=${1:-git://github.com/palladius/gceproject-dns.palladius.eu.git}
|
7
|
+
DIR=${2:-/tmp/}
|
8
|
+
|
9
|
+
echo Cloning $REPO into dir: $DIR
|
10
|
+
|
11
|
+
set +x
|
12
|
+
|
13
|
+
# git clone in non-empty dir
|
14
|
+
git clone --no-checkout $REPO $DIR/.gitclone.tmp/ &&
|
15
|
+
mv $DIR/.gitclone.tmp/.git $DIR/ &&
|
16
|
+
rmdir $DIR/.gitclone.tmp &&
|
17
|
+
cd $DIR/ &&
|
18
|
+
git reset --hard HEAD && # git thinks all files are deleted, this reverses that behaviour
|
19
|
+
echo 'Repo succesfully checked out into: '$DIR ||
|
20
|
+
echo "Some problems here: $?"
|
21
|
+
|
data/bin/git-ignore
ADDED
data/bin/git-repos
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
#!/usr/bin/python
|
2
|
+
|
3
|
+
import glob
|
4
|
+
import os
|
5
|
+
import sys
|
6
|
+
import subprocess
|
7
|
+
from optparse import OptionParser
|
8
|
+
|
9
|
+
version = '1.1'
|
10
|
+
default_git_basedir = os.path.expandvars("$HOME/git/")
|
11
|
+
debug = False
|
12
|
+
valid_commands = [ 'list', 'dump','help']
|
13
|
+
|
14
|
+
|
15
|
+
def deb(*args):
|
16
|
+
if (debug):
|
17
|
+
print "#DEB", ' '.join(arg.__str__() for arg in args)
|
18
|
+
|
19
|
+
def parse_python_26():
|
20
|
+
'''There's a better parser with python2.7 but that's what I have in 2.6..'''
|
21
|
+
parser = OptionParser(usage = """Usage: %prog v{1} [Options] <COMMAND>
|
22
|
+
COMMAND: {0}
|
23
|
+
|
24
|
+
Examples:
|
25
|
+
%prog list --gitdir ~/Desktop/myrepos/ # lists all git repos in it
|
26
|
+
%prog dump --dumpdir ~/Dropbox/dump/of/my/repos/ # dumps a command to clone those repos all at once!
|
27
|
+
%prog dump --dumpdir ~/Dropbox/tmp/myreposbackups/ | sh # executes it ;)
|
28
|
+
|
29
|
+
""".format(valid_commands,version))
|
30
|
+
parser.add_option("-d", "--dumpdir", dest="dumpdir", default=default_git_basedir,
|
31
|
+
help="alternate dump dir (default: '{0}')".format(default_git_basedir), metavar="DIR")
|
32
|
+
parser.add_option("-g", "--gitdir", dest="gitdir", default=default_git_basedir,
|
33
|
+
help="changes git basedir (default: '{0}')".format(default_git_basedir), metavar="DIR")
|
34
|
+
parser.add_option("-q", "--quiet",
|
35
|
+
action="store_false", dest="verbose", default=True,
|
36
|
+
help="don't print status messages to stdout")
|
37
|
+
parser.add_option("-v", "--version",
|
38
|
+
help="prints version (which peraltro is '{0}')".format(version))
|
39
|
+
(options, args) = parser.parse_args()
|
40
|
+
if len(args) != 1:
|
41
|
+
parser.error("wrong number of arguments: valid_commands={0}".format(valid_commands))
|
42
|
+
if(args[0] not in valid_commands):
|
43
|
+
parser.error("wrong command: {0}. available:{ 1}".format(args[1], valid_commands))
|
44
|
+
return (parser,options,args)
|
45
|
+
|
46
|
+
def dumprepos(mybasedir,dump_basedir):
|
47
|
+
'''Prints adump of all your repo in such a way that you can reconstruct them: cool!'''
|
48
|
+
from subprocess import Popen,PIPE
|
49
|
+
deb( "Dumping to STDOUT your local Git Repos within {0} (dumpdir='{1}'):".format(mybasedir,dump_basedir))
|
50
|
+
dump = ''
|
51
|
+
for repo in gitrepos(mybasedir):
|
52
|
+
url_cmd = 'git config --get remote.origin.url'
|
53
|
+
p = Popen([url_cmd], cwd = repo, stdout=PIPE,shell=True, env = {'PATH': '/usr/local/bin/'}) # .wait() #stdout.read()
|
54
|
+
out,err=p.communicate()
|
55
|
+
url = out.strip() # trailing CRLF
|
56
|
+
if err or len(url) < 10:
|
57
|
+
sys.stderr.write( "Skipping '{0}': ERR={1} URL='{2}'\n".format(repo,err,url) )
|
58
|
+
else:
|
59
|
+
desturl= repo
|
60
|
+
dump += "git clone '{0}' '{1}'\n".format(url,desturl.replace(mybasedir,dump_basedir))
|
61
|
+
return dump
|
62
|
+
|
63
|
+
def main():
|
64
|
+
(parser,opts, args) = parse_python_26()
|
65
|
+
if args[0] == 'list':
|
66
|
+
deb( "Listing your local Git Repos:")
|
67
|
+
for repo in gitrepos(opts.gitdir):
|
68
|
+
print repo
|
69
|
+
elif args[0] == 'dump':
|
70
|
+
print dumprepos(opts.gitdir,opts.dumpdir)
|
71
|
+
elif args[0] == 'help':
|
72
|
+
#print dir(parser)
|
73
|
+
print parser.format_help()
|
74
|
+
#parser.print_usage()
|
75
|
+
else:
|
76
|
+
print "Unrecognized command: {0}".format(args[0])
|
77
|
+
exit(1)
|
78
|
+
exit(0)
|
79
|
+
|
80
|
+
def isGitRepo(dir):
|
81
|
+
'''Dice se la sottodir ha un ./.git/ e magari altre cose..'''
|
82
|
+
return os.path.isdir("{0}/.git/".format(dir))
|
83
|
+
|
84
|
+
def gitrepos(basedir):
|
85
|
+
'''Dice i repo che sono sotto ~/git/DIR o ~/git/DIR1/DIR2. Li riconosce dalla dir .git'''
|
86
|
+
repos = []
|
87
|
+
GITGLOB = '.git/'
|
88
|
+
os.chdir(basedir)
|
89
|
+
for files in glob.glob('*/{0}'.format(GITGLOB)) + glob.glob("*/*/{0}".format(GITGLOB)):
|
90
|
+
repodir = (basedir + files.__str__())[:-len(GITGLOB)] # removes "/.git/"
|
91
|
+
if isGitRepo(repodir):
|
92
|
+
repos.append(repodir)
|
93
|
+
return repos
|
94
|
+
|
95
|
+
if __name__ == '__main__':
|
96
|
+
main()
|
97
|
+
else:
|
98
|
+
print 'Bella Ric! Prova ad usare: gitrepos(), o main()!'
|
data/bin/git-repos.py
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
#!/usr/bin/python
|
2
|
+
|
3
|
+
import glob
|
4
|
+
import os
|
5
|
+
import sys
|
6
|
+
import subprocess
|
7
|
+
default_git_basedir = os.path.expandvars("$HOME/git/")
|
8
|
+
|
9
|
+
valid_commands = [ 'list', 'dump','help']
|
10
|
+
debug = False
|
11
|
+
version = '1.1'
|
12
|
+
|
13
|
+
def deb(*args):
|
14
|
+
if (debug):
|
15
|
+
print "#DEB", ' '.join(arg.__str__() for arg in args)
|
16
|
+
|
17
|
+
def parse_python_26():
|
18
|
+
from optparse import OptionParser
|
19
|
+
parser = OptionParser(usage = """Usage: %prog v{1} [Options] <COMMAND>
|
20
|
+
COMMAND: {0}
|
21
|
+
|
22
|
+
Examples:
|
23
|
+
%prog list --gitdir ~/Desktop/myrepos/ # lists all git repos in it
|
24
|
+
%prog dump --dumpdir ~/Dropbox/dump/of/my/repos/ # dumps a command to clone those repos all at once!
|
25
|
+
%prog dump --dumpdir ~/Dropbox/tmp/myreposbackups/ | sh # executes it ;)
|
26
|
+
|
27
|
+
""".format(valid_commands,version))
|
28
|
+
parser.add_option("-d", "--dumpdir", dest="dumpdir", default=default_git_basedir,
|
29
|
+
help="alternate dump dir (default: '{0}')".format(default_git_basedir), metavar="DIR")
|
30
|
+
parser.add_option("-g", "--gitdir", dest="gitdir", default=default_git_basedir,
|
31
|
+
help="changes git basedir (default: '{0}')".format(default_git_basedir), metavar="DIR")
|
32
|
+
parser.add_option("-q", "--quiet",
|
33
|
+
action="store_false", dest="verbose", default=True,
|
34
|
+
help="don't print status messages to stdout")
|
35
|
+
parser.add_option("-v", "--version",
|
36
|
+
help="prints version (which peraltro is '{0}')".format(version))
|
37
|
+
(options, args) = parser.parse_args()
|
38
|
+
if len(args) != 1:
|
39
|
+
parser.error("wrong number of arguments: valid_commands={0}".format(valid_commands))
|
40
|
+
if(args[0] not in valid_commands):
|
41
|
+
parser.error("wrong command: {0}. available:{ 1}".format(args[1], valid_commands))
|
42
|
+
return (parser,options,args)
|
43
|
+
|
44
|
+
def dumprepos(mybasedir,dump_basedir):
|
45
|
+
'''Prints adump of all your repo in such a way that you can reconstruct them: cool!'''
|
46
|
+
deb( "Dumping to STDOUT your local Git Repos within {0} (dumpdir='{1}'):".format(mybasedir,dump_basedir))
|
47
|
+
dump = ''
|
48
|
+
from subprocess import Popen,PIPE
|
49
|
+
for repo in gitrepos(mybasedir):
|
50
|
+
url_cmd = 'git config --get remote.origin.url'
|
51
|
+
p = Popen([url_cmd], cwd = repo, stdout=PIPE,shell=True, env = {'PATH': '/usr/local/bin/'}) # .wait() #stdout.read()
|
52
|
+
out,err=p.communicate()
|
53
|
+
url = out.strip() # trailing CRLF
|
54
|
+
if err or len(url) < 10:
|
55
|
+
sys.stderr.write( "Skipping '{0}': ERR={1} URL='{2}'\n".format(repo,err,url) )
|
56
|
+
else:
|
57
|
+
desturl= repo
|
58
|
+
#dump += "git clone '{0}' '{1}'\n".format(url,desturl)
|
59
|
+
#dump += "git clone '{0}' '{1}'\n".format(url,mybasedir)
|
60
|
+
#dump += "git clone '{0}' '{1}'\n".format(url,dump_basedir)
|
61
|
+
dump += "git clone '{0}' '{1}'\n".format(url,desturl.replace(mybasedir,dump_basedir))
|
62
|
+
return dump
|
63
|
+
|
64
|
+
def main():
|
65
|
+
(parser,opts, args) = parse_python_26()
|
66
|
+
if args[0] == 'list':
|
67
|
+
deb( "Listing your local Git Repos:")
|
68
|
+
for repo in gitrepos(opts.gitdir):
|
69
|
+
print repo
|
70
|
+
elif args[0] == 'dump':
|
71
|
+
print dumprepos(opts.gitdir,opts.dumpdir)
|
72
|
+
elif args[0] == 'help':
|
73
|
+
#print dir(parser)
|
74
|
+
print parser.format_help()
|
75
|
+
#parser.print_usage()
|
76
|
+
else:
|
77
|
+
print "Unrecognized command: {0}".format(args[0])
|
78
|
+
exit(1)
|
79
|
+
exit(0)
|
80
|
+
|
81
|
+
def isGitRepo(dir):
|
82
|
+
'''Dice se la sottodir ha un ./.git/ e magari altre cose..'''
|
83
|
+
return os.path.isdir("{0}/.git/".format(dir))
|
84
|
+
|
85
|
+
def gitrepos(basedir):
|
86
|
+
'''Dice i repo che sono sotto ~/git/DIR o ~/git/DIR1/DIR2. Li riconosce dalla dir .git'''
|
87
|
+
repos = []
|
88
|
+
GITGLOB = '.git/'
|
89
|
+
os.chdir(basedir)
|
90
|
+
for files in glob.glob('*/{0}'.format(GITGLOB)) + glob.glob("*/*/{0}".format(GITGLOB)):
|
91
|
+
repodir = (basedir + files.__str__())[:-len(GITGLOB)] # removes "/.git/"
|
92
|
+
if isGitRepo(repodir):
|
93
|
+
repos.append(repodir)
|
94
|
+
return repos
|
95
|
+
|
96
|
+
if __name__ == '__main__':
|
97
|
+
main()
|
98
|
+
else:
|
99
|
+
print 'Bella Ric! Prova ad usare: gitrepos(), o main()!'
|