diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/clean_exit.sh b/Scripts/clean_exit.sh new file mode 100755 index 0000000..f219da8 --- /dev/null +++ b/Scripts/clean_exit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Exit and wipe the entire bash history including removing that we did this command +# +rm ~/.bash_history ; kill -9 $PPID + + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/clean_exit.sh b/Scripts/clean_exit.sh new file mode 100755 index 0000000..f219da8 --- /dev/null +++ b/Scripts/clean_exit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Exit and wipe the entire bash history including removing that we did this command +# +rm ~/.bash_history ; kill -9 $PPID + + diff --git a/Scripts/code2pdf.sh b/Scripts/code2pdf.sh new file mode 100755 index 0000000..bc9b3d8 --- /dev/null +++ b/Scripts/code2pdf.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: code2pdf.sh +# +# USAGE: ./code2pdf.sh +# +# DESCRIPTION: Formats and converts a source code file to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 19/07/2008 19:31:39 CST +# REVISION: --- +#=============================================================================== + +vgrind $1 | pstopdf -i -o $1.pdf + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/clean_exit.sh b/Scripts/clean_exit.sh new file mode 100755 index 0000000..f219da8 --- /dev/null +++ b/Scripts/clean_exit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Exit and wipe the entire bash history including removing that we did this command +# +rm ~/.bash_history ; kill -9 $PPID + + diff --git a/Scripts/code2pdf.sh b/Scripts/code2pdf.sh new file mode 100755 index 0000000..bc9b3d8 --- /dev/null +++ b/Scripts/code2pdf.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: code2pdf.sh +# +# USAGE: ./code2pdf.sh +# +# DESCRIPTION: Formats and converts a source code file to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 19/07/2008 19:31:39 CST +# REVISION: --- +#=============================================================================== + +vgrind $1 | pstopdf -i -o $1.pdf + diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh new file mode 100755 index 0000000..e8ac44a --- /dev/null +++ b/Scripts/convertToPDF.sh @@ -0,0 +1,27 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: convertToPDF.sh +# +# USAGE: ./convertToPDF.sh +# +# DESCRIPTION: Converts any file the OpenOffice can open to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/25/08 17:26:25 CST +# REVISION: --- +#=============================================================================== +if [ -f "$1" ] +then + echo "Converting \"$1\" to PDF" + /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\) +else + echo "Usage: $0 filename" +fi + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/clean_exit.sh b/Scripts/clean_exit.sh new file mode 100755 index 0000000..f219da8 --- /dev/null +++ b/Scripts/clean_exit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Exit and wipe the entire bash history including removing that we did this command +# +rm ~/.bash_history ; kill -9 $PPID + + diff --git a/Scripts/code2pdf.sh b/Scripts/code2pdf.sh new file mode 100755 index 0000000..bc9b3d8 --- /dev/null +++ b/Scripts/code2pdf.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: code2pdf.sh +# +# USAGE: ./code2pdf.sh +# +# DESCRIPTION: Formats and converts a source code file to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 19/07/2008 19:31:39 CST +# REVISION: --- +#=============================================================================== + +vgrind $1 | pstopdf -i -o $1.pdf + diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh new file mode 100755 index 0000000..e8ac44a --- /dev/null +++ b/Scripts/convertToPDF.sh @@ -0,0 +1,27 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: convertToPDF.sh +# +# USAGE: ./convertToPDF.sh +# +# DESCRIPTION: Converts any file the OpenOffice can open to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/25/08 17:26:25 CST +# REVISION: --- +#=============================================================================== +if [ -f "$1" ] +then + echo "Converting \"$1\" to PDF" + /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\) +else + echo "Usage: $0 filename" +fi + diff --git a/Scripts/dos2unix.sh b/Scripts/dos2unix.sh new file mode 100755 index 0000000..653749b --- /dev/null +++ b/Scripts/dos2unix.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +################################################################## +# Based on d2u from http://www.geocities.com/usmbish/scripts.html +# (C) 2003 USM Bish +# Released under GNU GPL v2 - http://www.gnu.org/copyleft/gpl.html +################################################################## + +if [ $# -ne 2 ] +then + echo 1>&2 Usage: dos2unix [dosfile] [unixfile] + exit 1 +else + if ! [ -e $1 ] + then + echo "Error: $1 not found." + exit 1 + fi + if [ -e $2 ] + then + echo "Error: $2 already exists." + exit 1 + fi +fi + +cat $1 | tr -d '\015' > $2 + + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/clean_exit.sh b/Scripts/clean_exit.sh new file mode 100755 index 0000000..f219da8 --- /dev/null +++ b/Scripts/clean_exit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Exit and wipe the entire bash history including removing that we did this command +# +rm ~/.bash_history ; kill -9 $PPID + + diff --git a/Scripts/code2pdf.sh b/Scripts/code2pdf.sh new file mode 100755 index 0000000..bc9b3d8 --- /dev/null +++ b/Scripts/code2pdf.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: code2pdf.sh +# +# USAGE: ./code2pdf.sh +# +# DESCRIPTION: Formats and converts a source code file to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 19/07/2008 19:31:39 CST +# REVISION: --- +#=============================================================================== + +vgrind $1 | pstopdf -i -o $1.pdf + diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh new file mode 100755 index 0000000..e8ac44a --- /dev/null +++ b/Scripts/convertToPDF.sh @@ -0,0 +1,27 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: convertToPDF.sh +# +# USAGE: ./convertToPDF.sh +# +# DESCRIPTION: Converts any file the OpenOffice can open to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/25/08 17:26:25 CST +# REVISION: --- +#=============================================================================== +if [ -f "$1" ] +then + echo "Converting \"$1\" to PDF" + /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\) +else + echo "Usage: $0 filename" +fi + diff --git a/Scripts/dos2unix.sh b/Scripts/dos2unix.sh new file mode 100755 index 0000000..653749b --- /dev/null +++ b/Scripts/dos2unix.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +################################################################## +# Based on d2u from http://www.geocities.com/usmbish/scripts.html +# (C) 2003 USM Bish +# Released under GNU GPL v2 - http://www.gnu.org/copyleft/gpl.html +################################################################## + +if [ $# -ne 2 ] +then + echo 1>&2 Usage: dos2unix [dosfile] [unixfile] + exit 1 +else + if ! [ -e $1 ] + then + echo "Error: $1 not found." + exit 1 + fi + if [ -e $2 ] + then + echo "Error: $2 already exists." + exit 1 + fi +fi + +cat $1 | tr -d '\015' > $2 + + diff --git a/Scripts/list.sh b/Scripts/list.sh new file mode 100755 index 0000000..d564162 --- /dev/null +++ b/Scripts/list.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: list.sh +# +# USAGE: ./list.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 06/21/08 10:11:00 CST +# REVISION: --- +#=============================================================================== + +for (( a=0 ; a != $1 ; a+=1 )) +do + echo 0000$a | sed "s/.*\([0-9][0-9][0-9]$\)/\1/" +done + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/clean_exit.sh b/Scripts/clean_exit.sh new file mode 100755 index 0000000..f219da8 --- /dev/null +++ b/Scripts/clean_exit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Exit and wipe the entire bash history including removing that we did this command +# +rm ~/.bash_history ; kill -9 $PPID + + diff --git a/Scripts/code2pdf.sh b/Scripts/code2pdf.sh new file mode 100755 index 0000000..bc9b3d8 --- /dev/null +++ b/Scripts/code2pdf.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: code2pdf.sh +# +# USAGE: ./code2pdf.sh +# +# DESCRIPTION: Formats and converts a source code file to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 19/07/2008 19:31:39 CST +# REVISION: --- +#=============================================================================== + +vgrind $1 | pstopdf -i -o $1.pdf + diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh new file mode 100755 index 0000000..e8ac44a --- /dev/null +++ b/Scripts/convertToPDF.sh @@ -0,0 +1,27 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: convertToPDF.sh +# +# USAGE: ./convertToPDF.sh +# +# DESCRIPTION: Converts any file the OpenOffice can open to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/25/08 17:26:25 CST +# REVISION: --- +#=============================================================================== +if [ -f "$1" ] +then + echo "Converting \"$1\" to PDF" + /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\) +else + echo "Usage: $0 filename" +fi + diff --git a/Scripts/dos2unix.sh b/Scripts/dos2unix.sh new file mode 100755 index 0000000..653749b --- /dev/null +++ b/Scripts/dos2unix.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +################################################################## +# Based on d2u from http://www.geocities.com/usmbish/scripts.html +# (C) 2003 USM Bish +# Released under GNU GPL v2 - http://www.gnu.org/copyleft/gpl.html +################################################################## + +if [ $# -ne 2 ] +then + echo 1>&2 Usage: dos2unix [dosfile] [unixfile] + exit 1 +else + if ! [ -e $1 ] + then + echo "Error: $1 not found." + exit 1 + fi + if [ -e $2 ] + then + echo "Error: $2 already exists." + exit 1 + fi +fi + +cat $1 | tr -d '\015' > $2 + + diff --git a/Scripts/list.sh b/Scripts/list.sh new file mode 100755 index 0000000..d564162 --- /dev/null +++ b/Scripts/list.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: list.sh +# +# USAGE: ./list.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 06/21/08 10:11:00 CST +# REVISION: --- +#=============================================================================== + +for (( a=0 ; a != $1 ; a+=1 )) +do + echo 0000$a | sed "s/.*\([0-9][0-9][0-9]$\)/\1/" +done + diff --git a/Scripts/man.sh b/Scripts/man.sh new file mode 100755 index 0000000..35c2f28 --- /dev/null +++ b/Scripts/man.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +# http://www.macosxhints.com/article.php?story=200412080923108 +# +/usr/bin/osascript -e 'tell application "Safari" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Safari" to click menu item "New Tab" of menu "File" of menu bar item "File" of menu bar 1' +/usr/bin/open 'man:'$(/usr/bin/man -w $1 | /usr/bin/sed 's/\/.*\///') + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/clean_exit.sh b/Scripts/clean_exit.sh new file mode 100755 index 0000000..f219da8 --- /dev/null +++ b/Scripts/clean_exit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Exit and wipe the entire bash history including removing that we did this command +# +rm ~/.bash_history ; kill -9 $PPID + + diff --git a/Scripts/code2pdf.sh b/Scripts/code2pdf.sh new file mode 100755 index 0000000..bc9b3d8 --- /dev/null +++ b/Scripts/code2pdf.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: code2pdf.sh +# +# USAGE: ./code2pdf.sh +# +# DESCRIPTION: Formats and converts a source code file to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 19/07/2008 19:31:39 CST +# REVISION: --- +#=============================================================================== + +vgrind $1 | pstopdf -i -o $1.pdf + diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh new file mode 100755 index 0000000..e8ac44a --- /dev/null +++ b/Scripts/convertToPDF.sh @@ -0,0 +1,27 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: convertToPDF.sh +# +# USAGE: ./convertToPDF.sh +# +# DESCRIPTION: Converts any file the OpenOffice can open to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/25/08 17:26:25 CST +# REVISION: --- +#=============================================================================== +if [ -f "$1" ] +then + echo "Converting \"$1\" to PDF" + /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\) +else + echo "Usage: $0 filename" +fi + diff --git a/Scripts/dos2unix.sh b/Scripts/dos2unix.sh new file mode 100755 index 0000000..653749b --- /dev/null +++ b/Scripts/dos2unix.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +################################################################## +# Based on d2u from http://www.geocities.com/usmbish/scripts.html +# (C) 2003 USM Bish +# Released under GNU GPL v2 - http://www.gnu.org/copyleft/gpl.html +################################################################## + +if [ $# -ne 2 ] +then + echo 1>&2 Usage: dos2unix [dosfile] [unixfile] + exit 1 +else + if ! [ -e $1 ] + then + echo "Error: $1 not found." + exit 1 + fi + if [ -e $2 ] + then + echo "Error: $2 already exists." + exit 1 + fi +fi + +cat $1 | tr -d '\015' > $2 + + diff --git a/Scripts/list.sh b/Scripts/list.sh new file mode 100755 index 0000000..d564162 --- /dev/null +++ b/Scripts/list.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: list.sh +# +# USAGE: ./list.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 06/21/08 10:11:00 CST +# REVISION: --- +#=============================================================================== + +for (( a=0 ; a != $1 ; a+=1 )) +do + echo 0000$a | sed "s/.*\([0-9][0-9][0-9]$\)/\1/" +done + diff --git a/Scripts/man.sh b/Scripts/man.sh new file mode 100755 index 0000000..35c2f28 --- /dev/null +++ b/Scripts/man.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +# http://www.macosxhints.com/article.php?story=200412080923108 +# +/usr/bin/osascript -e 'tell application "Safari" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Safari" to click menu item "New Tab" of menu "File" of menu bar item "File" of menu bar 1' +/usr/bin/open 'man:'$(/usr/bin/man -w $1 | /usr/bin/sed 's/\/.*\///') + diff --git a/Scripts/mkdmg.sh b/Scripts/mkdmg.sh new file mode 100755 index 0000000..c8d7e4c --- /dev/null +++ b/Scripts/mkdmg.sh @@ -0,0 +1,49 @@ +#!/bin/zsh +#=============================================================================== +# +# FILE: mkdmg.sh +# +# USAGE: ./mkdmg.sh +# +# DESCRIPTION: Script to take a Mac app and turn it in to a DMG package +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 16:54:36 CST +# REVISION: --- +#=============================================================================== +# +# Original script of this useful tool from here: +# http://www.kernelthread.com/mac/apme/archive/ +# +PATH=/bin:/sbin:/usr/bin:/usr/sbin +SCRATCH=./.mkdmg.$$$$ +error() +{ + echo "Error" + rm -rf $ + exit 1 +} +[ $ -ne 1 ] && echo "usage: mkdmg " && exit 1 +[ ! -e $ ] && echo "*** $ does not exist." && exit 1 +NAME=`basename $` +NAME="$" +ARCH="$ Archive" +IMAGE=$/$.dmg +OUTPUT="./$.dmg" +mkdir $ +echo "Creating disk image $..." +SIZE=`du -s -k $ | awk '{print $}'` || error +hdiutil create "$" -volname "$" -megabytes `expr 5 + $ / 1000` -type SPARSE -fs HFS+ > /dev/null 2>&1 || error +hdid $.sparseimage > /dev/null 2>&1 || error +ditto -rsrcFork $ "/Volumes/$/$" > /dev/null 2>&1 || error +hdiutil detach `mount | grep "Volumes/$" | awk '{print $}'` > /dev/null 2>&1 || error +hdiutil convert "$.sparseimage" -format UDZO -o $ -imagekey zlib-devel=9 > /dev/null 2>&1 || error +echo "Disk image $ ready" +rm -rf $ + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/clean_exit.sh b/Scripts/clean_exit.sh new file mode 100755 index 0000000..f219da8 --- /dev/null +++ b/Scripts/clean_exit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Exit and wipe the entire bash history including removing that we did this command +# +rm ~/.bash_history ; kill -9 $PPID + + diff --git a/Scripts/code2pdf.sh b/Scripts/code2pdf.sh new file mode 100755 index 0000000..bc9b3d8 --- /dev/null +++ b/Scripts/code2pdf.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: code2pdf.sh +# +# USAGE: ./code2pdf.sh +# +# DESCRIPTION: Formats and converts a source code file to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 19/07/2008 19:31:39 CST +# REVISION: --- +#=============================================================================== + +vgrind $1 | pstopdf -i -o $1.pdf + diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh new file mode 100755 index 0000000..e8ac44a --- /dev/null +++ b/Scripts/convertToPDF.sh @@ -0,0 +1,27 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: convertToPDF.sh +# +# USAGE: ./convertToPDF.sh +# +# DESCRIPTION: Converts any file the OpenOffice can open to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/25/08 17:26:25 CST +# REVISION: --- +#=============================================================================== +if [ -f "$1" ] +then + echo "Converting \"$1\" to PDF" + /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\) +else + echo "Usage: $0 filename" +fi + diff --git a/Scripts/dos2unix.sh b/Scripts/dos2unix.sh new file mode 100755 index 0000000..653749b --- /dev/null +++ b/Scripts/dos2unix.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +################################################################## +# Based on d2u from http://www.geocities.com/usmbish/scripts.html +# (C) 2003 USM Bish +# Released under GNU GPL v2 - http://www.gnu.org/copyleft/gpl.html +################################################################## + +if [ $# -ne 2 ] +then + echo 1>&2 Usage: dos2unix [dosfile] [unixfile] + exit 1 +else + if ! [ -e $1 ] + then + echo "Error: $1 not found." + exit 1 + fi + if [ -e $2 ] + then + echo "Error: $2 already exists." + exit 1 + fi +fi + +cat $1 | tr -d '\015' > $2 + + diff --git a/Scripts/list.sh b/Scripts/list.sh new file mode 100755 index 0000000..d564162 --- /dev/null +++ b/Scripts/list.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: list.sh +# +# USAGE: ./list.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 06/21/08 10:11:00 CST +# REVISION: --- +#=============================================================================== + +for (( a=0 ; a != $1 ; a+=1 )) +do + echo 0000$a | sed "s/.*\([0-9][0-9][0-9]$\)/\1/" +done + diff --git a/Scripts/man.sh b/Scripts/man.sh new file mode 100755 index 0000000..35c2f28 --- /dev/null +++ b/Scripts/man.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +# http://www.macosxhints.com/article.php?story=200412080923108 +# +/usr/bin/osascript -e 'tell application "Safari" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Safari" to click menu item "New Tab" of menu "File" of menu bar item "File" of menu bar 1' +/usr/bin/open 'man:'$(/usr/bin/man -w $1 | /usr/bin/sed 's/\/.*\///') + diff --git a/Scripts/mkdmg.sh b/Scripts/mkdmg.sh new file mode 100755 index 0000000..c8d7e4c --- /dev/null +++ b/Scripts/mkdmg.sh @@ -0,0 +1,49 @@ +#!/bin/zsh +#=============================================================================== +# +# FILE: mkdmg.sh +# +# USAGE: ./mkdmg.sh +# +# DESCRIPTION: Script to take a Mac app and turn it in to a DMG package +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 16:54:36 CST +# REVISION: --- +#=============================================================================== +# +# Original script of this useful tool from here: +# http://www.kernelthread.com/mac/apme/archive/ +# +PATH=/bin:/sbin:/usr/bin:/usr/sbin +SCRATCH=./.mkdmg.$$$$ +error() +{ + echo "Error" + rm -rf $ + exit 1 +} +[ $ -ne 1 ] && echo "usage: mkdmg " && exit 1 +[ ! -e $ ] && echo "*** $ does not exist." && exit 1 +NAME=`basename $` +NAME="$" +ARCH="$ Archive" +IMAGE=$/$.dmg +OUTPUT="./$.dmg" +mkdir $ +echo "Creating disk image $..." +SIZE=`du -s -k $ | awk '{print $}'` || error +hdiutil create "$" -volname "$" -megabytes `expr 5 + $ / 1000` -type SPARSE -fs HFS+ > /dev/null 2>&1 || error +hdid $.sparseimage > /dev/null 2>&1 || error +ditto -rsrcFork $ "/Volumes/$/$" > /dev/null 2>&1 || error +hdiutil detach `mount | grep "Volumes/$" | awk '{print $}'` > /dev/null 2>&1 || error +hdiutil convert "$.sparseimage" -format UDZO -o $ -imagekey zlib-devel=9 > /dev/null 2>&1 || error +echo "Disk image $ ready" +rm -rf $ + diff --git a/Scripts/publish_xiaofrog.sh b/Scripts/publish_xiaofrog.sh new file mode 100755 index 0000000..43888b2 --- /dev/null +++ b/Scripts/publish_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: publish.sh +# +# USAGE: ./publish.sh +# +# DESCRIPTION: Prepare and then upload the web content to the website +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 19:30:43 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com /home/jryland/publish.sh + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/clean_exit.sh b/Scripts/clean_exit.sh new file mode 100755 index 0000000..f219da8 --- /dev/null +++ b/Scripts/clean_exit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Exit and wipe the entire bash history including removing that we did this command +# +rm ~/.bash_history ; kill -9 $PPID + + diff --git a/Scripts/code2pdf.sh b/Scripts/code2pdf.sh new file mode 100755 index 0000000..bc9b3d8 --- /dev/null +++ b/Scripts/code2pdf.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: code2pdf.sh +# +# USAGE: ./code2pdf.sh +# +# DESCRIPTION: Formats and converts a source code file to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 19/07/2008 19:31:39 CST +# REVISION: --- +#=============================================================================== + +vgrind $1 | pstopdf -i -o $1.pdf + diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh new file mode 100755 index 0000000..e8ac44a --- /dev/null +++ b/Scripts/convertToPDF.sh @@ -0,0 +1,27 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: convertToPDF.sh +# +# USAGE: ./convertToPDF.sh +# +# DESCRIPTION: Converts any file the OpenOffice can open to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/25/08 17:26:25 CST +# REVISION: --- +#=============================================================================== +if [ -f "$1" ] +then + echo "Converting \"$1\" to PDF" + /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\) +else + echo "Usage: $0 filename" +fi + diff --git a/Scripts/dos2unix.sh b/Scripts/dos2unix.sh new file mode 100755 index 0000000..653749b --- /dev/null +++ b/Scripts/dos2unix.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +################################################################## +# Based on d2u from http://www.geocities.com/usmbish/scripts.html +# (C) 2003 USM Bish +# Released under GNU GPL v2 - http://www.gnu.org/copyleft/gpl.html +################################################################## + +if [ $# -ne 2 ] +then + echo 1>&2 Usage: dos2unix [dosfile] [unixfile] + exit 1 +else + if ! [ -e $1 ] + then + echo "Error: $1 not found." + exit 1 + fi + if [ -e $2 ] + then + echo "Error: $2 already exists." + exit 1 + fi +fi + +cat $1 | tr -d '\015' > $2 + + diff --git a/Scripts/list.sh b/Scripts/list.sh new file mode 100755 index 0000000..d564162 --- /dev/null +++ b/Scripts/list.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: list.sh +# +# USAGE: ./list.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 06/21/08 10:11:00 CST +# REVISION: --- +#=============================================================================== + +for (( a=0 ; a != $1 ; a+=1 )) +do + echo 0000$a | sed "s/.*\([0-9][0-9][0-9]$\)/\1/" +done + diff --git a/Scripts/man.sh b/Scripts/man.sh new file mode 100755 index 0000000..35c2f28 --- /dev/null +++ b/Scripts/man.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +# http://www.macosxhints.com/article.php?story=200412080923108 +# +/usr/bin/osascript -e 'tell application "Safari" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Safari" to click menu item "New Tab" of menu "File" of menu bar item "File" of menu bar 1' +/usr/bin/open 'man:'$(/usr/bin/man -w $1 | /usr/bin/sed 's/\/.*\///') + diff --git a/Scripts/mkdmg.sh b/Scripts/mkdmg.sh new file mode 100755 index 0000000..c8d7e4c --- /dev/null +++ b/Scripts/mkdmg.sh @@ -0,0 +1,49 @@ +#!/bin/zsh +#=============================================================================== +# +# FILE: mkdmg.sh +# +# USAGE: ./mkdmg.sh +# +# DESCRIPTION: Script to take a Mac app and turn it in to a DMG package +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 16:54:36 CST +# REVISION: --- +#=============================================================================== +# +# Original script of this useful tool from here: +# http://www.kernelthread.com/mac/apme/archive/ +# +PATH=/bin:/sbin:/usr/bin:/usr/sbin +SCRATCH=./.mkdmg.$$$$ +error() +{ + echo "Error" + rm -rf $ + exit 1 +} +[ $ -ne 1 ] && echo "usage: mkdmg " && exit 1 +[ ! -e $ ] && echo "*** $ does not exist." && exit 1 +NAME=`basename $` +NAME="$" +ARCH="$ Archive" +IMAGE=$/$.dmg +OUTPUT="./$.dmg" +mkdir $ +echo "Creating disk image $..." +SIZE=`du -s -k $ | awk '{print $}'` || error +hdiutil create "$" -volname "$" -megabytes `expr 5 + $ / 1000` -type SPARSE -fs HFS+ > /dev/null 2>&1 || error +hdid $.sparseimage > /dev/null 2>&1 || error +ditto -rsrcFork $ "/Volumes/$/$" > /dev/null 2>&1 || error +hdiutil detach `mount | grep "Volumes/$" | awk '{print $}'` > /dev/null 2>&1 || error +hdiutil convert "$.sparseimage" -format UDZO -o $ -imagekey zlib-devel=9 > /dev/null 2>&1 || error +echo "Disk image $ ready" +rm -rf $ + diff --git a/Scripts/publish_xiaofrog.sh b/Scripts/publish_xiaofrog.sh new file mode 100755 index 0000000..43888b2 --- /dev/null +++ b/Scripts/publish_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: publish.sh +# +# USAGE: ./publish.sh +# +# DESCRIPTION: Prepare and then upload the web content to the website +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 19:30:43 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com /home/jryland/publish.sh + diff --git a/Scripts/renameTitle.pl b/Scripts/renameTitle.pl new file mode 100755 index 0000000..e6595a8 --- /dev/null +++ b/Scripts/renameTitle.pl @@ -0,0 +1,4 @@ +#!/usr/bin/perl +#dcop $KONSOLE_DCOP_SESSION renameSession "$@" +print "\033]30;".join(" ",@ARGV)."\007"; + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/clean_exit.sh b/Scripts/clean_exit.sh new file mode 100755 index 0000000..f219da8 --- /dev/null +++ b/Scripts/clean_exit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Exit and wipe the entire bash history including removing that we did this command +# +rm ~/.bash_history ; kill -9 $PPID + + diff --git a/Scripts/code2pdf.sh b/Scripts/code2pdf.sh new file mode 100755 index 0000000..bc9b3d8 --- /dev/null +++ b/Scripts/code2pdf.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: code2pdf.sh +# +# USAGE: ./code2pdf.sh +# +# DESCRIPTION: Formats and converts a source code file to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 19/07/2008 19:31:39 CST +# REVISION: --- +#=============================================================================== + +vgrind $1 | pstopdf -i -o $1.pdf + diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh new file mode 100755 index 0000000..e8ac44a --- /dev/null +++ b/Scripts/convertToPDF.sh @@ -0,0 +1,27 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: convertToPDF.sh +# +# USAGE: ./convertToPDF.sh +# +# DESCRIPTION: Converts any file the OpenOffice can open to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/25/08 17:26:25 CST +# REVISION: --- +#=============================================================================== +if [ -f "$1" ] +then + echo "Converting \"$1\" to PDF" + /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\) +else + echo "Usage: $0 filename" +fi + diff --git a/Scripts/dos2unix.sh b/Scripts/dos2unix.sh new file mode 100755 index 0000000..653749b --- /dev/null +++ b/Scripts/dos2unix.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +################################################################## +# Based on d2u from http://www.geocities.com/usmbish/scripts.html +# (C) 2003 USM Bish +# Released under GNU GPL v2 - http://www.gnu.org/copyleft/gpl.html +################################################################## + +if [ $# -ne 2 ] +then + echo 1>&2 Usage: dos2unix [dosfile] [unixfile] + exit 1 +else + if ! [ -e $1 ] + then + echo "Error: $1 not found." + exit 1 + fi + if [ -e $2 ] + then + echo "Error: $2 already exists." + exit 1 + fi +fi + +cat $1 | tr -d '\015' > $2 + + diff --git a/Scripts/list.sh b/Scripts/list.sh new file mode 100755 index 0000000..d564162 --- /dev/null +++ b/Scripts/list.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: list.sh +# +# USAGE: ./list.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 06/21/08 10:11:00 CST +# REVISION: --- +#=============================================================================== + +for (( a=0 ; a != $1 ; a+=1 )) +do + echo 0000$a | sed "s/.*\([0-9][0-9][0-9]$\)/\1/" +done + diff --git a/Scripts/man.sh b/Scripts/man.sh new file mode 100755 index 0000000..35c2f28 --- /dev/null +++ b/Scripts/man.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +# http://www.macosxhints.com/article.php?story=200412080923108 +# +/usr/bin/osascript -e 'tell application "Safari" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Safari" to click menu item "New Tab" of menu "File" of menu bar item "File" of menu bar 1' +/usr/bin/open 'man:'$(/usr/bin/man -w $1 | /usr/bin/sed 's/\/.*\///') + diff --git a/Scripts/mkdmg.sh b/Scripts/mkdmg.sh new file mode 100755 index 0000000..c8d7e4c --- /dev/null +++ b/Scripts/mkdmg.sh @@ -0,0 +1,49 @@ +#!/bin/zsh +#=============================================================================== +# +# FILE: mkdmg.sh +# +# USAGE: ./mkdmg.sh +# +# DESCRIPTION: Script to take a Mac app and turn it in to a DMG package +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 16:54:36 CST +# REVISION: --- +#=============================================================================== +# +# Original script of this useful tool from here: +# http://www.kernelthread.com/mac/apme/archive/ +# +PATH=/bin:/sbin:/usr/bin:/usr/sbin +SCRATCH=./.mkdmg.$$$$ +error() +{ + echo "Error" + rm -rf $ + exit 1 +} +[ $ -ne 1 ] && echo "usage: mkdmg " && exit 1 +[ ! -e $ ] && echo "*** $ does not exist." && exit 1 +NAME=`basename $` +NAME="$" +ARCH="$ Archive" +IMAGE=$/$.dmg +OUTPUT="./$.dmg" +mkdir $ +echo "Creating disk image $..." +SIZE=`du -s -k $ | awk '{print $}'` || error +hdiutil create "$" -volname "$" -megabytes `expr 5 + $ / 1000` -type SPARSE -fs HFS+ > /dev/null 2>&1 || error +hdid $.sparseimage > /dev/null 2>&1 || error +ditto -rsrcFork $ "/Volumes/$/$" > /dev/null 2>&1 || error +hdiutil detach `mount | grep "Volumes/$" | awk '{print $}'` > /dev/null 2>&1 || error +hdiutil convert "$.sparseimage" -format UDZO -o $ -imagekey zlib-devel=9 > /dev/null 2>&1 || error +echo "Disk image $ ready" +rm -rf $ + diff --git a/Scripts/publish_xiaofrog.sh b/Scripts/publish_xiaofrog.sh new file mode 100755 index 0000000..43888b2 --- /dev/null +++ b/Scripts/publish_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: publish.sh +# +# USAGE: ./publish.sh +# +# DESCRIPTION: Prepare and then upload the web content to the website +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 19:30:43 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com /home/jryland/publish.sh + diff --git a/Scripts/renameTitle.pl b/Scripts/renameTitle.pl new file mode 100755 index 0000000..e6595a8 --- /dev/null +++ b/Scripts/renameTitle.pl @@ -0,0 +1,4 @@ +#!/usr/bin/perl +#dcop $KONSOLE_DCOP_SESSION renameSession "$@" +print "\033]30;".join(" ",@ARGV)."\007"; + diff --git a/Scripts/s60make.sh b/Scripts/s60make.sh new file mode 100755 index 0000000..846fdae --- /dev/null +++ b/Scripts/s60make.sh @@ -0,0 +1,31 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: s60make.sh +# +# USAGE: ./s60make.sh +# +# DESCRIPTION: Does all the steps to build a S60 app project +# Just uses a self signed certificate +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 07/05/08 22:41:18 CST +# REVISION: --- +#=============================================================================== +export EPOCROOT=~/opt/symbian-sdks/s60_32/ +export PATH=~/opt/symbian-eka2/bin/:$EPOCROOT/epoc32/tools:$PATH +cd group +bldmake bldfiles +abld build gcce urel +cd ../sis +makesis *_gcce.pkg test.sis +# makekeys -cert -expdays 3650 -password mykey.key mycert.cer +signsis test.sis test.sisx +/Applications/Utilities/Bluetooth\ File\ Exchange.app/Contents/MacOS/Bluetooth\ File\ Exchange ./test.sisx +cd .. + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/clean_exit.sh b/Scripts/clean_exit.sh new file mode 100755 index 0000000..f219da8 --- /dev/null +++ b/Scripts/clean_exit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Exit and wipe the entire bash history including removing that we did this command +# +rm ~/.bash_history ; kill -9 $PPID + + diff --git a/Scripts/code2pdf.sh b/Scripts/code2pdf.sh new file mode 100755 index 0000000..bc9b3d8 --- /dev/null +++ b/Scripts/code2pdf.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: code2pdf.sh +# +# USAGE: ./code2pdf.sh +# +# DESCRIPTION: Formats and converts a source code file to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 19/07/2008 19:31:39 CST +# REVISION: --- +#=============================================================================== + +vgrind $1 | pstopdf -i -o $1.pdf + diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh new file mode 100755 index 0000000..e8ac44a --- /dev/null +++ b/Scripts/convertToPDF.sh @@ -0,0 +1,27 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: convertToPDF.sh +# +# USAGE: ./convertToPDF.sh +# +# DESCRIPTION: Converts any file the OpenOffice can open to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/25/08 17:26:25 CST +# REVISION: --- +#=============================================================================== +if [ -f "$1" ] +then + echo "Converting \"$1\" to PDF" + /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\) +else + echo "Usage: $0 filename" +fi + diff --git a/Scripts/dos2unix.sh b/Scripts/dos2unix.sh new file mode 100755 index 0000000..653749b --- /dev/null +++ b/Scripts/dos2unix.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +################################################################## +# Based on d2u from http://www.geocities.com/usmbish/scripts.html +# (C) 2003 USM Bish +# Released under GNU GPL v2 - http://www.gnu.org/copyleft/gpl.html +################################################################## + +if [ $# -ne 2 ] +then + echo 1>&2 Usage: dos2unix [dosfile] [unixfile] + exit 1 +else + if ! [ -e $1 ] + then + echo "Error: $1 not found." + exit 1 + fi + if [ -e $2 ] + then + echo "Error: $2 already exists." + exit 1 + fi +fi + +cat $1 | tr -d '\015' > $2 + + diff --git a/Scripts/list.sh b/Scripts/list.sh new file mode 100755 index 0000000..d564162 --- /dev/null +++ b/Scripts/list.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: list.sh +# +# USAGE: ./list.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 06/21/08 10:11:00 CST +# REVISION: --- +#=============================================================================== + +for (( a=0 ; a != $1 ; a+=1 )) +do + echo 0000$a | sed "s/.*\([0-9][0-9][0-9]$\)/\1/" +done + diff --git a/Scripts/man.sh b/Scripts/man.sh new file mode 100755 index 0000000..35c2f28 --- /dev/null +++ b/Scripts/man.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +# http://www.macosxhints.com/article.php?story=200412080923108 +# +/usr/bin/osascript -e 'tell application "Safari" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Safari" to click menu item "New Tab" of menu "File" of menu bar item "File" of menu bar 1' +/usr/bin/open 'man:'$(/usr/bin/man -w $1 | /usr/bin/sed 's/\/.*\///') + diff --git a/Scripts/mkdmg.sh b/Scripts/mkdmg.sh new file mode 100755 index 0000000..c8d7e4c --- /dev/null +++ b/Scripts/mkdmg.sh @@ -0,0 +1,49 @@ +#!/bin/zsh +#=============================================================================== +# +# FILE: mkdmg.sh +# +# USAGE: ./mkdmg.sh +# +# DESCRIPTION: Script to take a Mac app and turn it in to a DMG package +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 16:54:36 CST +# REVISION: --- +#=============================================================================== +# +# Original script of this useful tool from here: +# http://www.kernelthread.com/mac/apme/archive/ +# +PATH=/bin:/sbin:/usr/bin:/usr/sbin +SCRATCH=./.mkdmg.$$$$ +error() +{ + echo "Error" + rm -rf $ + exit 1 +} +[ $ -ne 1 ] && echo "usage: mkdmg " && exit 1 +[ ! -e $ ] && echo "*** $ does not exist." && exit 1 +NAME=`basename $` +NAME="$" +ARCH="$ Archive" +IMAGE=$/$.dmg +OUTPUT="./$.dmg" +mkdir $ +echo "Creating disk image $..." +SIZE=`du -s -k $ | awk '{print $}'` || error +hdiutil create "$" -volname "$" -megabytes `expr 5 + $ / 1000` -type SPARSE -fs HFS+ > /dev/null 2>&1 || error +hdid $.sparseimage > /dev/null 2>&1 || error +ditto -rsrcFork $ "/Volumes/$/$" > /dev/null 2>&1 || error +hdiutil detach `mount | grep "Volumes/$" | awk '{print $}'` > /dev/null 2>&1 || error +hdiutil convert "$.sparseimage" -format UDZO -o $ -imagekey zlib-devel=9 > /dev/null 2>&1 || error +echo "Disk image $ ready" +rm -rf $ + diff --git a/Scripts/publish_xiaofrog.sh b/Scripts/publish_xiaofrog.sh new file mode 100755 index 0000000..43888b2 --- /dev/null +++ b/Scripts/publish_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: publish.sh +# +# USAGE: ./publish.sh +# +# DESCRIPTION: Prepare and then upload the web content to the website +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 19:30:43 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com /home/jryland/publish.sh + diff --git a/Scripts/renameTitle.pl b/Scripts/renameTitle.pl new file mode 100755 index 0000000..e6595a8 --- /dev/null +++ b/Scripts/renameTitle.pl @@ -0,0 +1,4 @@ +#!/usr/bin/perl +#dcop $KONSOLE_DCOP_SESSION renameSession "$@" +print "\033]30;".join(" ",@ARGV)."\007"; + diff --git a/Scripts/s60make.sh b/Scripts/s60make.sh new file mode 100755 index 0000000..846fdae --- /dev/null +++ b/Scripts/s60make.sh @@ -0,0 +1,31 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: s60make.sh +# +# USAGE: ./s60make.sh +# +# DESCRIPTION: Does all the steps to build a S60 app project +# Just uses a self signed certificate +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 07/05/08 22:41:18 CST +# REVISION: --- +#=============================================================================== +export EPOCROOT=~/opt/symbian-sdks/s60_32/ +export PATH=~/opt/symbian-eka2/bin/:$EPOCROOT/epoc32/tools:$PATH +cd group +bldmake bldfiles +abld build gcce urel +cd ../sis +makesis *_gcce.pkg test.sis +# makekeys -cert -expdays 3650 -password mykey.key mycert.cer +signsis test.sis test.sisx +/Applications/Utilities/Bluetooth\ File\ Exchange.app/Contents/MacOS/Bluetooth\ File\ Exchange ./test.sisx +cd .. + diff --git a/Scripts/scriptify.sh b/Scripts/scriptify.sh new file mode 100755 index 0000000..1c1a7f4 --- /dev/null +++ b/Scripts/scriptify.sh @@ -0,0 +1,26 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: scriptify.sh +# +# USAGE: ./scriptify.sh filename +# +# DESCRIPTION: Turns a file into bash script code for embedding in a script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: Filename can't have any slashs or funny characters in it +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 14:05:38 CST +# REVISION: --- +#=============================================================================== +cp $1 $1.sh +sed -i "" -e 's/\\/\\\\/g' $1.sh +sed -i "" -e 's/\$/\\\$/g' $1.sh +sed -i "" -e 's/"/\\"/g' $1.sh +sed -i "" -e 's/^/echo "/g' $1.sh +sed -i "" -e "s/\$/\" >> $1/g" $1.sh + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/clean_exit.sh b/Scripts/clean_exit.sh new file mode 100755 index 0000000..f219da8 --- /dev/null +++ b/Scripts/clean_exit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Exit and wipe the entire bash history including removing that we did this command +# +rm ~/.bash_history ; kill -9 $PPID + + diff --git a/Scripts/code2pdf.sh b/Scripts/code2pdf.sh new file mode 100755 index 0000000..bc9b3d8 --- /dev/null +++ b/Scripts/code2pdf.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: code2pdf.sh +# +# USAGE: ./code2pdf.sh +# +# DESCRIPTION: Formats and converts a source code file to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 19/07/2008 19:31:39 CST +# REVISION: --- +#=============================================================================== + +vgrind $1 | pstopdf -i -o $1.pdf + diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh new file mode 100755 index 0000000..e8ac44a --- /dev/null +++ b/Scripts/convertToPDF.sh @@ -0,0 +1,27 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: convertToPDF.sh +# +# USAGE: ./convertToPDF.sh +# +# DESCRIPTION: Converts any file the OpenOffice can open to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/25/08 17:26:25 CST +# REVISION: --- +#=============================================================================== +if [ -f "$1" ] +then + echo "Converting \"$1\" to PDF" + /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\) +else + echo "Usage: $0 filename" +fi + diff --git a/Scripts/dos2unix.sh b/Scripts/dos2unix.sh new file mode 100755 index 0000000..653749b --- /dev/null +++ b/Scripts/dos2unix.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +################################################################## +# Based on d2u from http://www.geocities.com/usmbish/scripts.html +# (C) 2003 USM Bish +# Released under GNU GPL v2 - http://www.gnu.org/copyleft/gpl.html +################################################################## + +if [ $# -ne 2 ] +then + echo 1>&2 Usage: dos2unix [dosfile] [unixfile] + exit 1 +else + if ! [ -e $1 ] + then + echo "Error: $1 not found." + exit 1 + fi + if [ -e $2 ] + then + echo "Error: $2 already exists." + exit 1 + fi +fi + +cat $1 | tr -d '\015' > $2 + + diff --git a/Scripts/list.sh b/Scripts/list.sh new file mode 100755 index 0000000..d564162 --- /dev/null +++ b/Scripts/list.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: list.sh +# +# USAGE: ./list.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 06/21/08 10:11:00 CST +# REVISION: --- +#=============================================================================== + +for (( a=0 ; a != $1 ; a+=1 )) +do + echo 0000$a | sed "s/.*\([0-9][0-9][0-9]$\)/\1/" +done + diff --git a/Scripts/man.sh b/Scripts/man.sh new file mode 100755 index 0000000..35c2f28 --- /dev/null +++ b/Scripts/man.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +# http://www.macosxhints.com/article.php?story=200412080923108 +# +/usr/bin/osascript -e 'tell application "Safari" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Safari" to click menu item "New Tab" of menu "File" of menu bar item "File" of menu bar 1' +/usr/bin/open 'man:'$(/usr/bin/man -w $1 | /usr/bin/sed 's/\/.*\///') + diff --git a/Scripts/mkdmg.sh b/Scripts/mkdmg.sh new file mode 100755 index 0000000..c8d7e4c --- /dev/null +++ b/Scripts/mkdmg.sh @@ -0,0 +1,49 @@ +#!/bin/zsh +#=============================================================================== +# +# FILE: mkdmg.sh +# +# USAGE: ./mkdmg.sh +# +# DESCRIPTION: Script to take a Mac app and turn it in to a DMG package +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 16:54:36 CST +# REVISION: --- +#=============================================================================== +# +# Original script of this useful tool from here: +# http://www.kernelthread.com/mac/apme/archive/ +# +PATH=/bin:/sbin:/usr/bin:/usr/sbin +SCRATCH=./.mkdmg.$$$$ +error() +{ + echo "Error" + rm -rf $ + exit 1 +} +[ $ -ne 1 ] && echo "usage: mkdmg " && exit 1 +[ ! -e $ ] && echo "*** $ does not exist." && exit 1 +NAME=`basename $` +NAME="$" +ARCH="$ Archive" +IMAGE=$/$.dmg +OUTPUT="./$.dmg" +mkdir $ +echo "Creating disk image $..." +SIZE=`du -s -k $ | awk '{print $}'` || error +hdiutil create "$" -volname "$" -megabytes `expr 5 + $ / 1000` -type SPARSE -fs HFS+ > /dev/null 2>&1 || error +hdid $.sparseimage > /dev/null 2>&1 || error +ditto -rsrcFork $ "/Volumes/$/$" > /dev/null 2>&1 || error +hdiutil detach `mount | grep "Volumes/$" | awk '{print $}'` > /dev/null 2>&1 || error +hdiutil convert "$.sparseimage" -format UDZO -o $ -imagekey zlib-devel=9 > /dev/null 2>&1 || error +echo "Disk image $ ready" +rm -rf $ + diff --git a/Scripts/publish_xiaofrog.sh b/Scripts/publish_xiaofrog.sh new file mode 100755 index 0000000..43888b2 --- /dev/null +++ b/Scripts/publish_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: publish.sh +# +# USAGE: ./publish.sh +# +# DESCRIPTION: Prepare and then upload the web content to the website +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 19:30:43 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com /home/jryland/publish.sh + diff --git a/Scripts/renameTitle.pl b/Scripts/renameTitle.pl new file mode 100755 index 0000000..e6595a8 --- /dev/null +++ b/Scripts/renameTitle.pl @@ -0,0 +1,4 @@ +#!/usr/bin/perl +#dcop $KONSOLE_DCOP_SESSION renameSession "$@" +print "\033]30;".join(" ",@ARGV)."\007"; + diff --git a/Scripts/s60make.sh b/Scripts/s60make.sh new file mode 100755 index 0000000..846fdae --- /dev/null +++ b/Scripts/s60make.sh @@ -0,0 +1,31 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: s60make.sh +# +# USAGE: ./s60make.sh +# +# DESCRIPTION: Does all the steps to build a S60 app project +# Just uses a self signed certificate +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 07/05/08 22:41:18 CST +# REVISION: --- +#=============================================================================== +export EPOCROOT=~/opt/symbian-sdks/s60_32/ +export PATH=~/opt/symbian-eka2/bin/:$EPOCROOT/epoc32/tools:$PATH +cd group +bldmake bldfiles +abld build gcce urel +cd ../sis +makesis *_gcce.pkg test.sis +# makekeys -cert -expdays 3650 -password mykey.key mycert.cer +signsis test.sis test.sisx +/Applications/Utilities/Bluetooth\ File\ Exchange.app/Contents/MacOS/Bluetooth\ File\ Exchange ./test.sisx +cd .. + diff --git a/Scripts/scriptify.sh b/Scripts/scriptify.sh new file mode 100755 index 0000000..1c1a7f4 --- /dev/null +++ b/Scripts/scriptify.sh @@ -0,0 +1,26 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: scriptify.sh +# +# USAGE: ./scriptify.sh filename +# +# DESCRIPTION: Turns a file into bash script code for embedding in a script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: Filename can't have any slashs or funny characters in it +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 14:05:38 CST +# REVISION: --- +#=============================================================================== +cp $1 $1.sh +sed -i "" -e 's/\\/\\\\/g' $1.sh +sed -i "" -e 's/\$/\\\$/g' $1.sh +sed -i "" -e 's/"/\\"/g' $1.sh +sed -i "" -e 's/^/echo "/g' $1.sh +sed -i "" -e "s/\$/\" >> $1/g" $1.sh + diff --git a/Scripts/setup_profile.sh b/Scripts/setup_profile.sh new file mode 100755 index 0000000..0e3bfac --- /dev/null +++ b/Scripts/setup_profile.sh @@ -0,0 +1,250 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_profile.sh +# +# USAGE: ./setup_profile.sh +# +# DESCRIPTION: This is run from .profile and is a way to keep the settings +# and scripts together with the other scripts by calling it here +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (JR), (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 01/03/2008 00:46:55 JST +# REVISION: --- +#=============================================================================== + +export USER_NAME="John Ryland" +export USER_REF="JR" +export USER_EMAIL="(jryland@invertedlogic.com)" +export USER_COMPANY="InvertedLogic" +export PS1='\u@\h:$PWD \$ ' +export SVN_EDITOR=vi +export PATH=~/Code/Scripts/:~/usr/local/bin/:$PATH +export BASEDIR=~/Code/research/signals-slots + +# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH +# umask 002 + + +# JR - Make safe versions of rm, rmdir, unlink, mv etc +############################################################################## +# Make our environment safer from overwriting/deleting files by mistake # +############################################################################## + +# Used by safe versions of rm, rmdir and unlink +# Add to this function checks for any directories you don't want deleted so easily by mistake +function check_args() +{ + while [ $# -ne 0 ] + do + [ "$1" == "~" ] && return 0 + [ "$1" == "/" ] && return 0 + [ "$1" == "/Users" ] && return 0 + [ "$1" == "/Users/" ] && return 0 + [ "$1" == "/Users/jryland" ] && return 0 + [ "$1" == "/Users/jryland/" ] && return 0 + [ "$1" == "/Users/jryland/Code" ] && return 0 + [ "$1" == "/Users/jryland/Code/" ] && return 0 + [ "$1" == "/home" ] && return 0 + [ "$1" == "/home/" ] && return 0 + [ "$1" == "/home/jryland" ] && return 0 + [ "$1" == "/home/jryland/" ] && return 0 + [ "$1" == "/test/test" ] && return 0 + shift + done + return 1 +} + + +# +# I don't think I need to explain how the rm command can be dangerous +# +# Pretty obvious that "rm -rf /" can be a pretty devistating command to execute +# Or "rm -rf ~" is not very nice either. Guess what, before making this safe +# function, I had by mistake executed these 2 example commands before. +# Real dumb I know, but it really can happen. +# +# Senerio might be working on a +# remote system such as an embedded development device thats being tested +# and need a fresh home directory for running a test, wiping out the home +# directory on the target is easy with "rm -rf ~" if nothing valuable there. +# I've worked a lot on embedded targets with a telnet session from my PC. +# But if accidently type it in to the wrong terminal and disaster. When it +# most recently happened to me, the senario was another one. It was late at +# night and a little tired, and I had some poo files I was cleaning up after +# executing some commands that left behind some temporary files and also I +# saw a file named "~". When cleaning up these files I typed: +# +# "rm -rf blah.tmp ~ foo" +# +# I hit enter and a moment later when I thought that this is taking a bit +# longer than I expected, I realised, "oh crap"! and immediately hit ctrl-c. +# I was pretty lucky, mainly some .foo directories with thumbnails and cached +# data and unimportant stuff was erased, but this made me realise really how +# dangerous some commands are and I didn't want to make this same mistake +# again if it could be prevented easily which is what these functions are for. +# +# Yes, you should have backups too, but it doesn't hurt to have +# a safer working environment. +# +function rm() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/rm "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function unlink() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/unlink "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function rmdir() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/rmdir "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function check_not_overwrite_file_in_directory() +{ + dir=$1 + shift + while [ $# -ne 1 ] + do + # XXX need to check $1 doesn't start with '-' + [ -f "$dir/`basename $1`" ] && return 0 + shift + done + return 1 +} + + +# +# mv can be quite dangerous, imagine you type "mv *" and accidently hit +# enter before entering the directory to put the files to. It will mv +# all the files in to the last file name in the list which will mean +# that all files in the directory will be lost except the 2nd last one. +# Or just as bad, "mv * somename" where somename is the name of a +# directory but is mis-spelt, then all files except the last in the +# directory will be lost. +# +# Even you think you got it right, and the last argument is a directory +# name, what happens when you mv a file with a name that already exists +# in the destination directory? Yep, you guest it, puff, gone. +# +# And nearly always if moving multiple files and last argument is a filename +# or doesn't exist then it probably is not what is intented unless it +# is being used as a fancy way to delete some files while renaming another +# file at the same time, but I think that's a really really bad side +# effect to take advantage of and a pretty dumb idea in general. +# +function mv() +{ + last="echo \$$#" + last=`eval $last` + + if [ -d "$last" ] + then + check_not_overwrite_file_in_directory "$last" "$@" + if [ $? -eq 1 ] + then + /bin/mv "$@" + else + echo "Safe-mv by John Ryland" + echo "Looks like one of the files will overwrite a file in the destination directory" + echo "Bailing out just in case to save your arse \(files\)" + fi + return + fi + + if [ $# -gt 2 ] + then + echo "Safe-mv by John Ryland" + echo "Looks like you are wanting to move several files, but" + echo "NO NO NO... last argument is NOT a directory!!!" + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + if [ -f "$last" ] + then + echo "Safe-mv by John Ryland" + echo "NO NO NO... new name is an existing file, you will overwrite it!!!" + echo "I suggest better to explicity delete the other file first." + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + /bin/mv "$@" + return + fi + fi +} + + +# +# Similar problems occur for the cp command as mv, easily overwriting destination, +# if last argument is directory and file exists in destination directory, +# even if not explicitly given, overwrites the file of the same name as the +# source acting the same as the mv command. This might catch you out at +# some time, but can sometimes be useful. Perhaps better to try to be save +# than sorry. +# +function cp() +{ + last="echo \$$#" + last=`eval $last` + + if [ -d "$last" ] + then + check_not_overwrite_file_in_directory "$last" "$@" + if [ $? -eq 1 ] + then + /bin/cp "$@" + else + echo "Safe-cp by John Ryland" + echo "Looks like one of the files will overwrite a file in the destination directory" + echo "Bailing out just in case to save your arse \(files\)" + fi + return + fi + + if [ -f "$last" ] + then + echo "Safe-cp by John Ryland" + echo "NO NO NO... destination name is an existing file, you will overwrite it!!!" + echo "I suggest better to explicity delete the other file first." + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + /bin/cp "$@" + return + fi +} + + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/clean_exit.sh b/Scripts/clean_exit.sh new file mode 100755 index 0000000..f219da8 --- /dev/null +++ b/Scripts/clean_exit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Exit and wipe the entire bash history including removing that we did this command +# +rm ~/.bash_history ; kill -9 $PPID + + diff --git a/Scripts/code2pdf.sh b/Scripts/code2pdf.sh new file mode 100755 index 0000000..bc9b3d8 --- /dev/null +++ b/Scripts/code2pdf.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: code2pdf.sh +# +# USAGE: ./code2pdf.sh +# +# DESCRIPTION: Formats and converts a source code file to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 19/07/2008 19:31:39 CST +# REVISION: --- +#=============================================================================== + +vgrind $1 | pstopdf -i -o $1.pdf + diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh new file mode 100755 index 0000000..e8ac44a --- /dev/null +++ b/Scripts/convertToPDF.sh @@ -0,0 +1,27 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: convertToPDF.sh +# +# USAGE: ./convertToPDF.sh +# +# DESCRIPTION: Converts any file the OpenOffice can open to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/25/08 17:26:25 CST +# REVISION: --- +#=============================================================================== +if [ -f "$1" ] +then + echo "Converting \"$1\" to PDF" + /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\) +else + echo "Usage: $0 filename" +fi + diff --git a/Scripts/dos2unix.sh b/Scripts/dos2unix.sh new file mode 100755 index 0000000..653749b --- /dev/null +++ b/Scripts/dos2unix.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +################################################################## +# Based on d2u from http://www.geocities.com/usmbish/scripts.html +# (C) 2003 USM Bish +# Released under GNU GPL v2 - http://www.gnu.org/copyleft/gpl.html +################################################################## + +if [ $# -ne 2 ] +then + echo 1>&2 Usage: dos2unix [dosfile] [unixfile] + exit 1 +else + if ! [ -e $1 ] + then + echo "Error: $1 not found." + exit 1 + fi + if [ -e $2 ] + then + echo "Error: $2 already exists." + exit 1 + fi +fi + +cat $1 | tr -d '\015' > $2 + + diff --git a/Scripts/list.sh b/Scripts/list.sh new file mode 100755 index 0000000..d564162 --- /dev/null +++ b/Scripts/list.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: list.sh +# +# USAGE: ./list.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 06/21/08 10:11:00 CST +# REVISION: --- +#=============================================================================== + +for (( a=0 ; a != $1 ; a+=1 )) +do + echo 0000$a | sed "s/.*\([0-9][0-9][0-9]$\)/\1/" +done + diff --git a/Scripts/man.sh b/Scripts/man.sh new file mode 100755 index 0000000..35c2f28 --- /dev/null +++ b/Scripts/man.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +# http://www.macosxhints.com/article.php?story=200412080923108 +# +/usr/bin/osascript -e 'tell application "Safari" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Safari" to click menu item "New Tab" of menu "File" of menu bar item "File" of menu bar 1' +/usr/bin/open 'man:'$(/usr/bin/man -w $1 | /usr/bin/sed 's/\/.*\///') + diff --git a/Scripts/mkdmg.sh b/Scripts/mkdmg.sh new file mode 100755 index 0000000..c8d7e4c --- /dev/null +++ b/Scripts/mkdmg.sh @@ -0,0 +1,49 @@ +#!/bin/zsh +#=============================================================================== +# +# FILE: mkdmg.sh +# +# USAGE: ./mkdmg.sh +# +# DESCRIPTION: Script to take a Mac app and turn it in to a DMG package +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 16:54:36 CST +# REVISION: --- +#=============================================================================== +# +# Original script of this useful tool from here: +# http://www.kernelthread.com/mac/apme/archive/ +# +PATH=/bin:/sbin:/usr/bin:/usr/sbin +SCRATCH=./.mkdmg.$$$$ +error() +{ + echo "Error" + rm -rf $ + exit 1 +} +[ $ -ne 1 ] && echo "usage: mkdmg " && exit 1 +[ ! -e $ ] && echo "*** $ does not exist." && exit 1 +NAME=`basename $` +NAME="$" +ARCH="$ Archive" +IMAGE=$/$.dmg +OUTPUT="./$.dmg" +mkdir $ +echo "Creating disk image $..." +SIZE=`du -s -k $ | awk '{print $}'` || error +hdiutil create "$" -volname "$" -megabytes `expr 5 + $ / 1000` -type SPARSE -fs HFS+ > /dev/null 2>&1 || error +hdid $.sparseimage > /dev/null 2>&1 || error +ditto -rsrcFork $ "/Volumes/$/$" > /dev/null 2>&1 || error +hdiutil detach `mount | grep "Volumes/$" | awk '{print $}'` > /dev/null 2>&1 || error +hdiutil convert "$.sparseimage" -format UDZO -o $ -imagekey zlib-devel=9 > /dev/null 2>&1 || error +echo "Disk image $ ready" +rm -rf $ + diff --git a/Scripts/publish_xiaofrog.sh b/Scripts/publish_xiaofrog.sh new file mode 100755 index 0000000..43888b2 --- /dev/null +++ b/Scripts/publish_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: publish.sh +# +# USAGE: ./publish.sh +# +# DESCRIPTION: Prepare and then upload the web content to the website +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 19:30:43 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com /home/jryland/publish.sh + diff --git a/Scripts/renameTitle.pl b/Scripts/renameTitle.pl new file mode 100755 index 0000000..e6595a8 --- /dev/null +++ b/Scripts/renameTitle.pl @@ -0,0 +1,4 @@ +#!/usr/bin/perl +#dcop $KONSOLE_DCOP_SESSION renameSession "$@" +print "\033]30;".join(" ",@ARGV)."\007"; + diff --git a/Scripts/s60make.sh b/Scripts/s60make.sh new file mode 100755 index 0000000..846fdae --- /dev/null +++ b/Scripts/s60make.sh @@ -0,0 +1,31 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: s60make.sh +# +# USAGE: ./s60make.sh +# +# DESCRIPTION: Does all the steps to build a S60 app project +# Just uses a self signed certificate +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 07/05/08 22:41:18 CST +# REVISION: --- +#=============================================================================== +export EPOCROOT=~/opt/symbian-sdks/s60_32/ +export PATH=~/opt/symbian-eka2/bin/:$EPOCROOT/epoc32/tools:$PATH +cd group +bldmake bldfiles +abld build gcce urel +cd ../sis +makesis *_gcce.pkg test.sis +# makekeys -cert -expdays 3650 -password mykey.key mycert.cer +signsis test.sis test.sisx +/Applications/Utilities/Bluetooth\ File\ Exchange.app/Contents/MacOS/Bluetooth\ File\ Exchange ./test.sisx +cd .. + diff --git a/Scripts/scriptify.sh b/Scripts/scriptify.sh new file mode 100755 index 0000000..1c1a7f4 --- /dev/null +++ b/Scripts/scriptify.sh @@ -0,0 +1,26 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: scriptify.sh +# +# USAGE: ./scriptify.sh filename +# +# DESCRIPTION: Turns a file into bash script code for embedding in a script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: Filename can't have any slashs or funny characters in it +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 14:05:38 CST +# REVISION: --- +#=============================================================================== +cp $1 $1.sh +sed -i "" -e 's/\\/\\\\/g' $1.sh +sed -i "" -e 's/\$/\\\$/g' $1.sh +sed -i "" -e 's/"/\\"/g' $1.sh +sed -i "" -e 's/^/echo "/g' $1.sh +sed -i "" -e "s/\$/\" >> $1/g" $1.sh + diff --git a/Scripts/setup_profile.sh b/Scripts/setup_profile.sh new file mode 100755 index 0000000..0e3bfac --- /dev/null +++ b/Scripts/setup_profile.sh @@ -0,0 +1,250 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_profile.sh +# +# USAGE: ./setup_profile.sh +# +# DESCRIPTION: This is run from .profile and is a way to keep the settings +# and scripts together with the other scripts by calling it here +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (JR), (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 01/03/2008 00:46:55 JST +# REVISION: --- +#=============================================================================== + +export USER_NAME="John Ryland" +export USER_REF="JR" +export USER_EMAIL="(jryland@invertedlogic.com)" +export USER_COMPANY="InvertedLogic" +export PS1='\u@\h:$PWD \$ ' +export SVN_EDITOR=vi +export PATH=~/Code/Scripts/:~/usr/local/bin/:$PATH +export BASEDIR=~/Code/research/signals-slots + +# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH +# umask 002 + + +# JR - Make safe versions of rm, rmdir, unlink, mv etc +############################################################################## +# Make our environment safer from overwriting/deleting files by mistake # +############################################################################## + +# Used by safe versions of rm, rmdir and unlink +# Add to this function checks for any directories you don't want deleted so easily by mistake +function check_args() +{ + while [ $# -ne 0 ] + do + [ "$1" == "~" ] && return 0 + [ "$1" == "/" ] && return 0 + [ "$1" == "/Users" ] && return 0 + [ "$1" == "/Users/" ] && return 0 + [ "$1" == "/Users/jryland" ] && return 0 + [ "$1" == "/Users/jryland/" ] && return 0 + [ "$1" == "/Users/jryland/Code" ] && return 0 + [ "$1" == "/Users/jryland/Code/" ] && return 0 + [ "$1" == "/home" ] && return 0 + [ "$1" == "/home/" ] && return 0 + [ "$1" == "/home/jryland" ] && return 0 + [ "$1" == "/home/jryland/" ] && return 0 + [ "$1" == "/test/test" ] && return 0 + shift + done + return 1 +} + + +# +# I don't think I need to explain how the rm command can be dangerous +# +# Pretty obvious that "rm -rf /" can be a pretty devistating command to execute +# Or "rm -rf ~" is not very nice either. Guess what, before making this safe +# function, I had by mistake executed these 2 example commands before. +# Real dumb I know, but it really can happen. +# +# Senerio might be working on a +# remote system such as an embedded development device thats being tested +# and need a fresh home directory for running a test, wiping out the home +# directory on the target is easy with "rm -rf ~" if nothing valuable there. +# I've worked a lot on embedded targets with a telnet session from my PC. +# But if accidently type it in to the wrong terminal and disaster. When it +# most recently happened to me, the senario was another one. It was late at +# night and a little tired, and I had some poo files I was cleaning up after +# executing some commands that left behind some temporary files and also I +# saw a file named "~". When cleaning up these files I typed: +# +# "rm -rf blah.tmp ~ foo" +# +# I hit enter and a moment later when I thought that this is taking a bit +# longer than I expected, I realised, "oh crap"! and immediately hit ctrl-c. +# I was pretty lucky, mainly some .foo directories with thumbnails and cached +# data and unimportant stuff was erased, but this made me realise really how +# dangerous some commands are and I didn't want to make this same mistake +# again if it could be prevented easily which is what these functions are for. +# +# Yes, you should have backups too, but it doesn't hurt to have +# a safer working environment. +# +function rm() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/rm "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function unlink() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/unlink "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function rmdir() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/rmdir "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function check_not_overwrite_file_in_directory() +{ + dir=$1 + shift + while [ $# -ne 1 ] + do + # XXX need to check $1 doesn't start with '-' + [ -f "$dir/`basename $1`" ] && return 0 + shift + done + return 1 +} + + +# +# mv can be quite dangerous, imagine you type "mv *" and accidently hit +# enter before entering the directory to put the files to. It will mv +# all the files in to the last file name in the list which will mean +# that all files in the directory will be lost except the 2nd last one. +# Or just as bad, "mv * somename" where somename is the name of a +# directory but is mis-spelt, then all files except the last in the +# directory will be lost. +# +# Even you think you got it right, and the last argument is a directory +# name, what happens when you mv a file with a name that already exists +# in the destination directory? Yep, you guest it, puff, gone. +# +# And nearly always if moving multiple files and last argument is a filename +# or doesn't exist then it probably is not what is intented unless it +# is being used as a fancy way to delete some files while renaming another +# file at the same time, but I think that's a really really bad side +# effect to take advantage of and a pretty dumb idea in general. +# +function mv() +{ + last="echo \$$#" + last=`eval $last` + + if [ -d "$last" ] + then + check_not_overwrite_file_in_directory "$last" "$@" + if [ $? -eq 1 ] + then + /bin/mv "$@" + else + echo "Safe-mv by John Ryland" + echo "Looks like one of the files will overwrite a file in the destination directory" + echo "Bailing out just in case to save your arse \(files\)" + fi + return + fi + + if [ $# -gt 2 ] + then + echo "Safe-mv by John Ryland" + echo "Looks like you are wanting to move several files, but" + echo "NO NO NO... last argument is NOT a directory!!!" + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + if [ -f "$last" ] + then + echo "Safe-mv by John Ryland" + echo "NO NO NO... new name is an existing file, you will overwrite it!!!" + echo "I suggest better to explicity delete the other file first." + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + /bin/mv "$@" + return + fi + fi +} + + +# +# Similar problems occur for the cp command as mv, easily overwriting destination, +# if last argument is directory and file exists in destination directory, +# even if not explicitly given, overwrites the file of the same name as the +# source acting the same as the mv command. This might catch you out at +# some time, but can sometimes be useful. Perhaps better to try to be save +# than sorry. +# +function cp() +{ + last="echo \$$#" + last=`eval $last` + + if [ -d "$last" ] + then + check_not_overwrite_file_in_directory "$last" "$@" + if [ $? -eq 1 ] + then + /bin/cp "$@" + else + echo "Safe-cp by John Ryland" + echo "Looks like one of the files will overwrite a file in the destination directory" + echo "Bailing out just in case to save your arse \(files\)" + fi + return + fi + + if [ -f "$last" ] + then + echo "Safe-cp by John Ryland" + echo "NO NO NO... destination name is an existing file, you will overwrite it!!!" + echo "I suggest better to explicity delete the other file first." + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + /bin/cp "$@" + return + fi +} + + diff --git a/Scripts/setup_sites.sh b/Scripts/setup_sites.sh new file mode 100755 index 0000000..e9bd07c --- /dev/null +++ b/Scripts/setup_sites.sh @@ -0,0 +1,29 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_sites.sh +# +# USAGE: ./setup_sites.sh +# +# DESCRIPTION: Begin web development for invertedlogic on a new machine +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 15:18:21 CST +# REVISION: --- +#=============================================================================== + +if [ -e ./Sites ] +then + echo "Directory \"./Sites\" already exists, aborting" + echo "(try to rename the existing ./Sites dir to a new name first)" +else + # svn co --username web http://internal.invertedlogic.com/dev/web Sites + svn co svn+ssh://invertedlogic_internal@internal.invertedlogic.com/home/invertedlogic_internal/svn/web Sites +fi + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/clean_exit.sh b/Scripts/clean_exit.sh new file mode 100755 index 0000000..f219da8 --- /dev/null +++ b/Scripts/clean_exit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Exit and wipe the entire bash history including removing that we did this command +# +rm ~/.bash_history ; kill -9 $PPID + + diff --git a/Scripts/code2pdf.sh b/Scripts/code2pdf.sh new file mode 100755 index 0000000..bc9b3d8 --- /dev/null +++ b/Scripts/code2pdf.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: code2pdf.sh +# +# USAGE: ./code2pdf.sh +# +# DESCRIPTION: Formats and converts a source code file to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 19/07/2008 19:31:39 CST +# REVISION: --- +#=============================================================================== + +vgrind $1 | pstopdf -i -o $1.pdf + diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh new file mode 100755 index 0000000..e8ac44a --- /dev/null +++ b/Scripts/convertToPDF.sh @@ -0,0 +1,27 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: convertToPDF.sh +# +# USAGE: ./convertToPDF.sh +# +# DESCRIPTION: Converts any file the OpenOffice can open to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/25/08 17:26:25 CST +# REVISION: --- +#=============================================================================== +if [ -f "$1" ] +then + echo "Converting \"$1\" to PDF" + /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\) +else + echo "Usage: $0 filename" +fi + diff --git a/Scripts/dos2unix.sh b/Scripts/dos2unix.sh new file mode 100755 index 0000000..653749b --- /dev/null +++ b/Scripts/dos2unix.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +################################################################## +# Based on d2u from http://www.geocities.com/usmbish/scripts.html +# (C) 2003 USM Bish +# Released under GNU GPL v2 - http://www.gnu.org/copyleft/gpl.html +################################################################## + +if [ $# -ne 2 ] +then + echo 1>&2 Usage: dos2unix [dosfile] [unixfile] + exit 1 +else + if ! [ -e $1 ] + then + echo "Error: $1 not found." + exit 1 + fi + if [ -e $2 ] + then + echo "Error: $2 already exists." + exit 1 + fi +fi + +cat $1 | tr -d '\015' > $2 + + diff --git a/Scripts/list.sh b/Scripts/list.sh new file mode 100755 index 0000000..d564162 --- /dev/null +++ b/Scripts/list.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: list.sh +# +# USAGE: ./list.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 06/21/08 10:11:00 CST +# REVISION: --- +#=============================================================================== + +for (( a=0 ; a != $1 ; a+=1 )) +do + echo 0000$a | sed "s/.*\([0-9][0-9][0-9]$\)/\1/" +done + diff --git a/Scripts/man.sh b/Scripts/man.sh new file mode 100755 index 0000000..35c2f28 --- /dev/null +++ b/Scripts/man.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +# http://www.macosxhints.com/article.php?story=200412080923108 +# +/usr/bin/osascript -e 'tell application "Safari" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Safari" to click menu item "New Tab" of menu "File" of menu bar item "File" of menu bar 1' +/usr/bin/open 'man:'$(/usr/bin/man -w $1 | /usr/bin/sed 's/\/.*\///') + diff --git a/Scripts/mkdmg.sh b/Scripts/mkdmg.sh new file mode 100755 index 0000000..c8d7e4c --- /dev/null +++ b/Scripts/mkdmg.sh @@ -0,0 +1,49 @@ +#!/bin/zsh +#=============================================================================== +# +# FILE: mkdmg.sh +# +# USAGE: ./mkdmg.sh +# +# DESCRIPTION: Script to take a Mac app and turn it in to a DMG package +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 16:54:36 CST +# REVISION: --- +#=============================================================================== +# +# Original script of this useful tool from here: +# http://www.kernelthread.com/mac/apme/archive/ +# +PATH=/bin:/sbin:/usr/bin:/usr/sbin +SCRATCH=./.mkdmg.$$$$ +error() +{ + echo "Error" + rm -rf $ + exit 1 +} +[ $ -ne 1 ] && echo "usage: mkdmg " && exit 1 +[ ! -e $ ] && echo "*** $ does not exist." && exit 1 +NAME=`basename $` +NAME="$" +ARCH="$ Archive" +IMAGE=$/$.dmg +OUTPUT="./$.dmg" +mkdir $ +echo "Creating disk image $..." +SIZE=`du -s -k $ | awk '{print $}'` || error +hdiutil create "$" -volname "$" -megabytes `expr 5 + $ / 1000` -type SPARSE -fs HFS+ > /dev/null 2>&1 || error +hdid $.sparseimage > /dev/null 2>&1 || error +ditto -rsrcFork $ "/Volumes/$/$" > /dev/null 2>&1 || error +hdiutil detach `mount | grep "Volumes/$" | awk '{print $}'` > /dev/null 2>&1 || error +hdiutil convert "$.sparseimage" -format UDZO -o $ -imagekey zlib-devel=9 > /dev/null 2>&1 || error +echo "Disk image $ ready" +rm -rf $ + diff --git a/Scripts/publish_xiaofrog.sh b/Scripts/publish_xiaofrog.sh new file mode 100755 index 0000000..43888b2 --- /dev/null +++ b/Scripts/publish_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: publish.sh +# +# USAGE: ./publish.sh +# +# DESCRIPTION: Prepare and then upload the web content to the website +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 19:30:43 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com /home/jryland/publish.sh + diff --git a/Scripts/renameTitle.pl b/Scripts/renameTitle.pl new file mode 100755 index 0000000..e6595a8 --- /dev/null +++ b/Scripts/renameTitle.pl @@ -0,0 +1,4 @@ +#!/usr/bin/perl +#dcop $KONSOLE_DCOP_SESSION renameSession "$@" +print "\033]30;".join(" ",@ARGV)."\007"; + diff --git a/Scripts/s60make.sh b/Scripts/s60make.sh new file mode 100755 index 0000000..846fdae --- /dev/null +++ b/Scripts/s60make.sh @@ -0,0 +1,31 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: s60make.sh +# +# USAGE: ./s60make.sh +# +# DESCRIPTION: Does all the steps to build a S60 app project +# Just uses a self signed certificate +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 07/05/08 22:41:18 CST +# REVISION: --- +#=============================================================================== +export EPOCROOT=~/opt/symbian-sdks/s60_32/ +export PATH=~/opt/symbian-eka2/bin/:$EPOCROOT/epoc32/tools:$PATH +cd group +bldmake bldfiles +abld build gcce urel +cd ../sis +makesis *_gcce.pkg test.sis +# makekeys -cert -expdays 3650 -password mykey.key mycert.cer +signsis test.sis test.sisx +/Applications/Utilities/Bluetooth\ File\ Exchange.app/Contents/MacOS/Bluetooth\ File\ Exchange ./test.sisx +cd .. + diff --git a/Scripts/scriptify.sh b/Scripts/scriptify.sh new file mode 100755 index 0000000..1c1a7f4 --- /dev/null +++ b/Scripts/scriptify.sh @@ -0,0 +1,26 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: scriptify.sh +# +# USAGE: ./scriptify.sh filename +# +# DESCRIPTION: Turns a file into bash script code for embedding in a script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: Filename can't have any slashs or funny characters in it +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 14:05:38 CST +# REVISION: --- +#=============================================================================== +cp $1 $1.sh +sed -i "" -e 's/\\/\\\\/g' $1.sh +sed -i "" -e 's/\$/\\\$/g' $1.sh +sed -i "" -e 's/"/\\"/g' $1.sh +sed -i "" -e 's/^/echo "/g' $1.sh +sed -i "" -e "s/\$/\" >> $1/g" $1.sh + diff --git a/Scripts/setup_profile.sh b/Scripts/setup_profile.sh new file mode 100755 index 0000000..0e3bfac --- /dev/null +++ b/Scripts/setup_profile.sh @@ -0,0 +1,250 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_profile.sh +# +# USAGE: ./setup_profile.sh +# +# DESCRIPTION: This is run from .profile and is a way to keep the settings +# and scripts together with the other scripts by calling it here +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (JR), (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 01/03/2008 00:46:55 JST +# REVISION: --- +#=============================================================================== + +export USER_NAME="John Ryland" +export USER_REF="JR" +export USER_EMAIL="(jryland@invertedlogic.com)" +export USER_COMPANY="InvertedLogic" +export PS1='\u@\h:$PWD \$ ' +export SVN_EDITOR=vi +export PATH=~/Code/Scripts/:~/usr/local/bin/:$PATH +export BASEDIR=~/Code/research/signals-slots + +# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH +# umask 002 + + +# JR - Make safe versions of rm, rmdir, unlink, mv etc +############################################################################## +# Make our environment safer from overwriting/deleting files by mistake # +############################################################################## + +# Used by safe versions of rm, rmdir and unlink +# Add to this function checks for any directories you don't want deleted so easily by mistake +function check_args() +{ + while [ $# -ne 0 ] + do + [ "$1" == "~" ] && return 0 + [ "$1" == "/" ] && return 0 + [ "$1" == "/Users" ] && return 0 + [ "$1" == "/Users/" ] && return 0 + [ "$1" == "/Users/jryland" ] && return 0 + [ "$1" == "/Users/jryland/" ] && return 0 + [ "$1" == "/Users/jryland/Code" ] && return 0 + [ "$1" == "/Users/jryland/Code/" ] && return 0 + [ "$1" == "/home" ] && return 0 + [ "$1" == "/home/" ] && return 0 + [ "$1" == "/home/jryland" ] && return 0 + [ "$1" == "/home/jryland/" ] && return 0 + [ "$1" == "/test/test" ] && return 0 + shift + done + return 1 +} + + +# +# I don't think I need to explain how the rm command can be dangerous +# +# Pretty obvious that "rm -rf /" can be a pretty devistating command to execute +# Or "rm -rf ~" is not very nice either. Guess what, before making this safe +# function, I had by mistake executed these 2 example commands before. +# Real dumb I know, but it really can happen. +# +# Senerio might be working on a +# remote system such as an embedded development device thats being tested +# and need a fresh home directory for running a test, wiping out the home +# directory on the target is easy with "rm -rf ~" if nothing valuable there. +# I've worked a lot on embedded targets with a telnet session from my PC. +# But if accidently type it in to the wrong terminal and disaster. When it +# most recently happened to me, the senario was another one. It was late at +# night and a little tired, and I had some poo files I was cleaning up after +# executing some commands that left behind some temporary files and also I +# saw a file named "~". When cleaning up these files I typed: +# +# "rm -rf blah.tmp ~ foo" +# +# I hit enter and a moment later when I thought that this is taking a bit +# longer than I expected, I realised, "oh crap"! and immediately hit ctrl-c. +# I was pretty lucky, mainly some .foo directories with thumbnails and cached +# data and unimportant stuff was erased, but this made me realise really how +# dangerous some commands are and I didn't want to make this same mistake +# again if it could be prevented easily which is what these functions are for. +# +# Yes, you should have backups too, but it doesn't hurt to have +# a safer working environment. +# +function rm() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/rm "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function unlink() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/unlink "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function rmdir() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/rmdir "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function check_not_overwrite_file_in_directory() +{ + dir=$1 + shift + while [ $# -ne 1 ] + do + # XXX need to check $1 doesn't start with '-' + [ -f "$dir/`basename $1`" ] && return 0 + shift + done + return 1 +} + + +# +# mv can be quite dangerous, imagine you type "mv *" and accidently hit +# enter before entering the directory to put the files to. It will mv +# all the files in to the last file name in the list which will mean +# that all files in the directory will be lost except the 2nd last one. +# Or just as bad, "mv * somename" where somename is the name of a +# directory but is mis-spelt, then all files except the last in the +# directory will be lost. +# +# Even you think you got it right, and the last argument is a directory +# name, what happens when you mv a file with a name that already exists +# in the destination directory? Yep, you guest it, puff, gone. +# +# And nearly always if moving multiple files and last argument is a filename +# or doesn't exist then it probably is not what is intented unless it +# is being used as a fancy way to delete some files while renaming another +# file at the same time, but I think that's a really really bad side +# effect to take advantage of and a pretty dumb idea in general. +# +function mv() +{ + last="echo \$$#" + last=`eval $last` + + if [ -d "$last" ] + then + check_not_overwrite_file_in_directory "$last" "$@" + if [ $? -eq 1 ] + then + /bin/mv "$@" + else + echo "Safe-mv by John Ryland" + echo "Looks like one of the files will overwrite a file in the destination directory" + echo "Bailing out just in case to save your arse \(files\)" + fi + return + fi + + if [ $# -gt 2 ] + then + echo "Safe-mv by John Ryland" + echo "Looks like you are wanting to move several files, but" + echo "NO NO NO... last argument is NOT a directory!!!" + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + if [ -f "$last" ] + then + echo "Safe-mv by John Ryland" + echo "NO NO NO... new name is an existing file, you will overwrite it!!!" + echo "I suggest better to explicity delete the other file first." + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + /bin/mv "$@" + return + fi + fi +} + + +# +# Similar problems occur for the cp command as mv, easily overwriting destination, +# if last argument is directory and file exists in destination directory, +# even if not explicitly given, overwrites the file of the same name as the +# source acting the same as the mv command. This might catch you out at +# some time, but can sometimes be useful. Perhaps better to try to be save +# than sorry. +# +function cp() +{ + last="echo \$$#" + last=`eval $last` + + if [ -d "$last" ] + then + check_not_overwrite_file_in_directory "$last" "$@" + if [ $? -eq 1 ] + then + /bin/cp "$@" + else + echo "Safe-cp by John Ryland" + echo "Looks like one of the files will overwrite a file in the destination directory" + echo "Bailing out just in case to save your arse \(files\)" + fi + return + fi + + if [ -f "$last" ] + then + echo "Safe-cp by John Ryland" + echo "NO NO NO... destination name is an existing file, you will overwrite it!!!" + echo "I suggest better to explicity delete the other file first." + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + /bin/cp "$@" + return + fi +} + + diff --git a/Scripts/setup_sites.sh b/Scripts/setup_sites.sh new file mode 100755 index 0000000..e9bd07c --- /dev/null +++ b/Scripts/setup_sites.sh @@ -0,0 +1,29 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_sites.sh +# +# USAGE: ./setup_sites.sh +# +# DESCRIPTION: Begin web development for invertedlogic on a new machine +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 15:18:21 CST +# REVISION: --- +#=============================================================================== + +if [ -e ./Sites ] +then + echo "Directory \"./Sites\" already exists, aborting" + echo "(try to rename the existing ./Sites dir to a new name first)" +else + # svn co --username web http://internal.invertedlogic.com/dev/web Sites + svn co svn+ssh://invertedlogic_internal@internal.invertedlogic.com/home/invertedlogic_internal/svn/web Sites +fi + diff --git a/Scripts/setup_ssh.sh b/Scripts/setup_ssh.sh new file mode 100755 index 0000000..5cc6e2c --- /dev/null +++ b/Scripts/setup_ssh.sh @@ -0,0 +1,35 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_ssh.sh +# +# USAGE: ./setup_ssh.sh server-address +# +# DESCRIPTION: Sets up password-less ssh login to another machine +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 31/07/2008 22:53:01 JST +# REVISION: --- +#=============================================================================== + +if [ "$1" == "" ] +then + echo "Usage $0 server-address" + exit 0 +fi + +if [ ! -f ~/.ssh/id_rsa.pub ] +then + echo | ssh-keygen -t rsa +fi + +scp ~/.ssh/id_rsa.pub $1:tmp.pub +ssh $1 'mkdir -p ~/.ssh ; chmod 700 ~/.ssh ; cat tmp.pub >> ~/.ssh/authorized_keys ; chmod 600 ~/.ssh/authorized_keys ; rm tmp.pub' + + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/clean_exit.sh b/Scripts/clean_exit.sh new file mode 100755 index 0000000..f219da8 --- /dev/null +++ b/Scripts/clean_exit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Exit and wipe the entire bash history including removing that we did this command +# +rm ~/.bash_history ; kill -9 $PPID + + diff --git a/Scripts/code2pdf.sh b/Scripts/code2pdf.sh new file mode 100755 index 0000000..bc9b3d8 --- /dev/null +++ b/Scripts/code2pdf.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: code2pdf.sh +# +# USAGE: ./code2pdf.sh +# +# DESCRIPTION: Formats and converts a source code file to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 19/07/2008 19:31:39 CST +# REVISION: --- +#=============================================================================== + +vgrind $1 | pstopdf -i -o $1.pdf + diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh new file mode 100755 index 0000000..e8ac44a --- /dev/null +++ b/Scripts/convertToPDF.sh @@ -0,0 +1,27 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: convertToPDF.sh +# +# USAGE: ./convertToPDF.sh +# +# DESCRIPTION: Converts any file the OpenOffice can open to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/25/08 17:26:25 CST +# REVISION: --- +#=============================================================================== +if [ -f "$1" ] +then + echo "Converting \"$1\" to PDF" + /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\) +else + echo "Usage: $0 filename" +fi + diff --git a/Scripts/dos2unix.sh b/Scripts/dos2unix.sh new file mode 100755 index 0000000..653749b --- /dev/null +++ b/Scripts/dos2unix.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +################################################################## +# Based on d2u from http://www.geocities.com/usmbish/scripts.html +# (C) 2003 USM Bish +# Released under GNU GPL v2 - http://www.gnu.org/copyleft/gpl.html +################################################################## + +if [ $# -ne 2 ] +then + echo 1>&2 Usage: dos2unix [dosfile] [unixfile] + exit 1 +else + if ! [ -e $1 ] + then + echo "Error: $1 not found." + exit 1 + fi + if [ -e $2 ] + then + echo "Error: $2 already exists." + exit 1 + fi +fi + +cat $1 | tr -d '\015' > $2 + + diff --git a/Scripts/list.sh b/Scripts/list.sh new file mode 100755 index 0000000..d564162 --- /dev/null +++ b/Scripts/list.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: list.sh +# +# USAGE: ./list.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 06/21/08 10:11:00 CST +# REVISION: --- +#=============================================================================== + +for (( a=0 ; a != $1 ; a+=1 )) +do + echo 0000$a | sed "s/.*\([0-9][0-9][0-9]$\)/\1/" +done + diff --git a/Scripts/man.sh b/Scripts/man.sh new file mode 100755 index 0000000..35c2f28 --- /dev/null +++ b/Scripts/man.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +# http://www.macosxhints.com/article.php?story=200412080923108 +# +/usr/bin/osascript -e 'tell application "Safari" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Safari" to click menu item "New Tab" of menu "File" of menu bar item "File" of menu bar 1' +/usr/bin/open 'man:'$(/usr/bin/man -w $1 | /usr/bin/sed 's/\/.*\///') + diff --git a/Scripts/mkdmg.sh b/Scripts/mkdmg.sh new file mode 100755 index 0000000..c8d7e4c --- /dev/null +++ b/Scripts/mkdmg.sh @@ -0,0 +1,49 @@ +#!/bin/zsh +#=============================================================================== +# +# FILE: mkdmg.sh +# +# USAGE: ./mkdmg.sh +# +# DESCRIPTION: Script to take a Mac app and turn it in to a DMG package +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 16:54:36 CST +# REVISION: --- +#=============================================================================== +# +# Original script of this useful tool from here: +# http://www.kernelthread.com/mac/apme/archive/ +# +PATH=/bin:/sbin:/usr/bin:/usr/sbin +SCRATCH=./.mkdmg.$$$$ +error() +{ + echo "Error" + rm -rf $ + exit 1 +} +[ $ -ne 1 ] && echo "usage: mkdmg " && exit 1 +[ ! -e $ ] && echo "*** $ does not exist." && exit 1 +NAME=`basename $` +NAME="$" +ARCH="$ Archive" +IMAGE=$/$.dmg +OUTPUT="./$.dmg" +mkdir $ +echo "Creating disk image $..." +SIZE=`du -s -k $ | awk '{print $}'` || error +hdiutil create "$" -volname "$" -megabytes `expr 5 + $ / 1000` -type SPARSE -fs HFS+ > /dev/null 2>&1 || error +hdid $.sparseimage > /dev/null 2>&1 || error +ditto -rsrcFork $ "/Volumes/$/$" > /dev/null 2>&1 || error +hdiutil detach `mount | grep "Volumes/$" | awk '{print $}'` > /dev/null 2>&1 || error +hdiutil convert "$.sparseimage" -format UDZO -o $ -imagekey zlib-devel=9 > /dev/null 2>&1 || error +echo "Disk image $ ready" +rm -rf $ + diff --git a/Scripts/publish_xiaofrog.sh b/Scripts/publish_xiaofrog.sh new file mode 100755 index 0000000..43888b2 --- /dev/null +++ b/Scripts/publish_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: publish.sh +# +# USAGE: ./publish.sh +# +# DESCRIPTION: Prepare and then upload the web content to the website +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 19:30:43 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com /home/jryland/publish.sh + diff --git a/Scripts/renameTitle.pl b/Scripts/renameTitle.pl new file mode 100755 index 0000000..e6595a8 --- /dev/null +++ b/Scripts/renameTitle.pl @@ -0,0 +1,4 @@ +#!/usr/bin/perl +#dcop $KONSOLE_DCOP_SESSION renameSession "$@" +print "\033]30;".join(" ",@ARGV)."\007"; + diff --git a/Scripts/s60make.sh b/Scripts/s60make.sh new file mode 100755 index 0000000..846fdae --- /dev/null +++ b/Scripts/s60make.sh @@ -0,0 +1,31 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: s60make.sh +# +# USAGE: ./s60make.sh +# +# DESCRIPTION: Does all the steps to build a S60 app project +# Just uses a self signed certificate +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 07/05/08 22:41:18 CST +# REVISION: --- +#=============================================================================== +export EPOCROOT=~/opt/symbian-sdks/s60_32/ +export PATH=~/opt/symbian-eka2/bin/:$EPOCROOT/epoc32/tools:$PATH +cd group +bldmake bldfiles +abld build gcce urel +cd ../sis +makesis *_gcce.pkg test.sis +# makekeys -cert -expdays 3650 -password mykey.key mycert.cer +signsis test.sis test.sisx +/Applications/Utilities/Bluetooth\ File\ Exchange.app/Contents/MacOS/Bluetooth\ File\ Exchange ./test.sisx +cd .. + diff --git a/Scripts/scriptify.sh b/Scripts/scriptify.sh new file mode 100755 index 0000000..1c1a7f4 --- /dev/null +++ b/Scripts/scriptify.sh @@ -0,0 +1,26 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: scriptify.sh +# +# USAGE: ./scriptify.sh filename +# +# DESCRIPTION: Turns a file into bash script code for embedding in a script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: Filename can't have any slashs or funny characters in it +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 14:05:38 CST +# REVISION: --- +#=============================================================================== +cp $1 $1.sh +sed -i "" -e 's/\\/\\\\/g' $1.sh +sed -i "" -e 's/\$/\\\$/g' $1.sh +sed -i "" -e 's/"/\\"/g' $1.sh +sed -i "" -e 's/^/echo "/g' $1.sh +sed -i "" -e "s/\$/\" >> $1/g" $1.sh + diff --git a/Scripts/setup_profile.sh b/Scripts/setup_profile.sh new file mode 100755 index 0000000..0e3bfac --- /dev/null +++ b/Scripts/setup_profile.sh @@ -0,0 +1,250 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_profile.sh +# +# USAGE: ./setup_profile.sh +# +# DESCRIPTION: This is run from .profile and is a way to keep the settings +# and scripts together with the other scripts by calling it here +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (JR), (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 01/03/2008 00:46:55 JST +# REVISION: --- +#=============================================================================== + +export USER_NAME="John Ryland" +export USER_REF="JR" +export USER_EMAIL="(jryland@invertedlogic.com)" +export USER_COMPANY="InvertedLogic" +export PS1='\u@\h:$PWD \$ ' +export SVN_EDITOR=vi +export PATH=~/Code/Scripts/:~/usr/local/bin/:$PATH +export BASEDIR=~/Code/research/signals-slots + +# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH +# umask 002 + + +# JR - Make safe versions of rm, rmdir, unlink, mv etc +############################################################################## +# Make our environment safer from overwriting/deleting files by mistake # +############################################################################## + +# Used by safe versions of rm, rmdir and unlink +# Add to this function checks for any directories you don't want deleted so easily by mistake +function check_args() +{ + while [ $# -ne 0 ] + do + [ "$1" == "~" ] && return 0 + [ "$1" == "/" ] && return 0 + [ "$1" == "/Users" ] && return 0 + [ "$1" == "/Users/" ] && return 0 + [ "$1" == "/Users/jryland" ] && return 0 + [ "$1" == "/Users/jryland/" ] && return 0 + [ "$1" == "/Users/jryland/Code" ] && return 0 + [ "$1" == "/Users/jryland/Code/" ] && return 0 + [ "$1" == "/home" ] && return 0 + [ "$1" == "/home/" ] && return 0 + [ "$1" == "/home/jryland" ] && return 0 + [ "$1" == "/home/jryland/" ] && return 0 + [ "$1" == "/test/test" ] && return 0 + shift + done + return 1 +} + + +# +# I don't think I need to explain how the rm command can be dangerous +# +# Pretty obvious that "rm -rf /" can be a pretty devistating command to execute +# Or "rm -rf ~" is not very nice either. Guess what, before making this safe +# function, I had by mistake executed these 2 example commands before. +# Real dumb I know, but it really can happen. +# +# Senerio might be working on a +# remote system such as an embedded development device thats being tested +# and need a fresh home directory for running a test, wiping out the home +# directory on the target is easy with "rm -rf ~" if nothing valuable there. +# I've worked a lot on embedded targets with a telnet session from my PC. +# But if accidently type it in to the wrong terminal and disaster. When it +# most recently happened to me, the senario was another one. It was late at +# night and a little tired, and I had some poo files I was cleaning up after +# executing some commands that left behind some temporary files and also I +# saw a file named "~". When cleaning up these files I typed: +# +# "rm -rf blah.tmp ~ foo" +# +# I hit enter and a moment later when I thought that this is taking a bit +# longer than I expected, I realised, "oh crap"! and immediately hit ctrl-c. +# I was pretty lucky, mainly some .foo directories with thumbnails and cached +# data and unimportant stuff was erased, but this made me realise really how +# dangerous some commands are and I didn't want to make this same mistake +# again if it could be prevented easily which is what these functions are for. +# +# Yes, you should have backups too, but it doesn't hurt to have +# a safer working environment. +# +function rm() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/rm "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function unlink() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/unlink "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function rmdir() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/rmdir "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function check_not_overwrite_file_in_directory() +{ + dir=$1 + shift + while [ $# -ne 1 ] + do + # XXX need to check $1 doesn't start with '-' + [ -f "$dir/`basename $1`" ] && return 0 + shift + done + return 1 +} + + +# +# mv can be quite dangerous, imagine you type "mv *" and accidently hit +# enter before entering the directory to put the files to. It will mv +# all the files in to the last file name in the list which will mean +# that all files in the directory will be lost except the 2nd last one. +# Or just as bad, "mv * somename" where somename is the name of a +# directory but is mis-spelt, then all files except the last in the +# directory will be lost. +# +# Even you think you got it right, and the last argument is a directory +# name, what happens when you mv a file with a name that already exists +# in the destination directory? Yep, you guest it, puff, gone. +# +# And nearly always if moving multiple files and last argument is a filename +# or doesn't exist then it probably is not what is intented unless it +# is being used as a fancy way to delete some files while renaming another +# file at the same time, but I think that's a really really bad side +# effect to take advantage of and a pretty dumb idea in general. +# +function mv() +{ + last="echo \$$#" + last=`eval $last` + + if [ -d "$last" ] + then + check_not_overwrite_file_in_directory "$last" "$@" + if [ $? -eq 1 ] + then + /bin/mv "$@" + else + echo "Safe-mv by John Ryland" + echo "Looks like one of the files will overwrite a file in the destination directory" + echo "Bailing out just in case to save your arse \(files\)" + fi + return + fi + + if [ $# -gt 2 ] + then + echo "Safe-mv by John Ryland" + echo "Looks like you are wanting to move several files, but" + echo "NO NO NO... last argument is NOT a directory!!!" + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + if [ -f "$last" ] + then + echo "Safe-mv by John Ryland" + echo "NO NO NO... new name is an existing file, you will overwrite it!!!" + echo "I suggest better to explicity delete the other file first." + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + /bin/mv "$@" + return + fi + fi +} + + +# +# Similar problems occur for the cp command as mv, easily overwriting destination, +# if last argument is directory and file exists in destination directory, +# even if not explicitly given, overwrites the file of the same name as the +# source acting the same as the mv command. This might catch you out at +# some time, but can sometimes be useful. Perhaps better to try to be save +# than sorry. +# +function cp() +{ + last="echo \$$#" + last=`eval $last` + + if [ -d "$last" ] + then + check_not_overwrite_file_in_directory "$last" "$@" + if [ $? -eq 1 ] + then + /bin/cp "$@" + else + echo "Safe-cp by John Ryland" + echo "Looks like one of the files will overwrite a file in the destination directory" + echo "Bailing out just in case to save your arse \(files\)" + fi + return + fi + + if [ -f "$last" ] + then + echo "Safe-cp by John Ryland" + echo "NO NO NO... destination name is an existing file, you will overwrite it!!!" + echo "I suggest better to explicity delete the other file first." + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + /bin/cp "$@" + return + fi +} + + diff --git a/Scripts/setup_sites.sh b/Scripts/setup_sites.sh new file mode 100755 index 0000000..e9bd07c --- /dev/null +++ b/Scripts/setup_sites.sh @@ -0,0 +1,29 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_sites.sh +# +# USAGE: ./setup_sites.sh +# +# DESCRIPTION: Begin web development for invertedlogic on a new machine +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 15:18:21 CST +# REVISION: --- +#=============================================================================== + +if [ -e ./Sites ] +then + echo "Directory \"./Sites\" already exists, aborting" + echo "(try to rename the existing ./Sites dir to a new name first)" +else + # svn co --username web http://internal.invertedlogic.com/dev/web Sites + svn co svn+ssh://invertedlogic_internal@internal.invertedlogic.com/home/invertedlogic_internal/svn/web Sites +fi + diff --git a/Scripts/setup_ssh.sh b/Scripts/setup_ssh.sh new file mode 100755 index 0000000..5cc6e2c --- /dev/null +++ b/Scripts/setup_ssh.sh @@ -0,0 +1,35 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_ssh.sh +# +# USAGE: ./setup_ssh.sh server-address +# +# DESCRIPTION: Sets up password-less ssh login to another machine +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 31/07/2008 22:53:01 JST +# REVISION: --- +#=============================================================================== + +if [ "$1" == "" ] +then + echo "Usage $0 server-address" + exit 0 +fi + +if [ ! -f ~/.ssh/id_rsa.pub ] +then + echo | ssh-keygen -t rsa +fi + +scp ~/.ssh/id_rsa.pub $1:tmp.pub +ssh $1 'mkdir -p ~/.ssh ; chmod 700 ~/.ssh ; cat tmp.pub >> ~/.ssh/authorized_keys ; chmod 600 ~/.ssh/authorized_keys ; rm tmp.pub' + + diff --git a/Scripts/setup_vim.sh b/Scripts/setup_vim.sh new file mode 100755 index 0000000..fef5b76 --- /dev/null +++ b/Scripts/setup_vim.sh @@ -0,0 +1,65 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_vim.sh +# +# USAGE: ./setup_vim.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 19/08/2008 12:02:36 JST +# REVISION: --- +#=============================================================================== + +mkdir -p ~/Applications +# Current preference for this one over MacVim because it is faster to load and colors are better +curl http://macvim.org/OSX/files/binaries/OSX10.4/vim7.0.224.tar.bz2 > ./vim7.0.224.tar.bz2 + +# curl "http://repo.or.cz/w/MacVim.git?a=snapshot;h=bf2ed5675e67b37b748edfb86c9273adcba815b8;sf=tgz" > ./MacVim-src-1.2.tar.gz +# echo "MacVim Homepage at: http://code.google.com/p/macvim/" +# tar zxf ./MacVim-src-1.2.tar.gz +# cd MacVim/src +# touch auto/<###>.sh +# ./configure --enable-gui=MacVim +# make +# cd MacVim +# xcodebuild + +mkdir -p ~/.vim/.cache +cd ~/.vim/.cache +curl http://www.vim.org/scripts/download_script.php?src_id=7701 > ./taglist_45.zip +curl http://www.vim.org/scripts/download_script.php?src_id=9123 > ./bash-support.zip +curl http://www.vim.org/scripts/download_script.php?src_id=9141 > ./chlordane.vim +curl http://www.vim.org/scripts/download_script.php?src_id=7675 > ./headerguard-0.1.0.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7722 > ./omnicppcomplete-0.41.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7384 > ./code_complete.vim +curl http://www.vim.org/scripts/download_script.php?src_id=7461 > ./vimExplorer.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8830 > ./autoinclude.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8341 > ./renamec.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8029 > ./refactor.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8483 > ./doxygen-support.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7289 > ./rectcut.vim +curl http://www.vim.org/scripts/download_script.php?src_id=7877 > ./lusty-explorer.vim +curl http://www.vim.org/scripts/download_script.php?src_id=6878 > ./hints_man3.vba.gz +curl http://www.vim.org/scripts/download_script.php?src_id=8087 > ./echofunc.vim +curl http://www.vim.org/scripts/download_script.php?src_id=6682 > ./SnippetsMgr.zip +curl http://www.vim.org/scripts/download_script.php?src_id=8976 > ./NERD_tree.zip +curl http://www.vim.org/scripts/download_script.php?src_id=6181 > ./c_function_plugin.vim +curl http://www.vim.org/scripts/download_script.php?src_id=9145 > ./trinity.zip +curl http://www.vim.org/scripts/download_script.php?src_id=9144 > ./srcexpl.vim +curl http://www.vim.org/scripts/download_script.php?src_id=9146 > ./cvim.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7837 > ./lusty-juggler.vim + +cd .. +# unzip .cache/taglist_45.zip +# unzip .cache/bash-support.zip + + + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/clean_exit.sh b/Scripts/clean_exit.sh new file mode 100755 index 0000000..f219da8 --- /dev/null +++ b/Scripts/clean_exit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Exit and wipe the entire bash history including removing that we did this command +# +rm ~/.bash_history ; kill -9 $PPID + + diff --git a/Scripts/code2pdf.sh b/Scripts/code2pdf.sh new file mode 100755 index 0000000..bc9b3d8 --- /dev/null +++ b/Scripts/code2pdf.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: code2pdf.sh +# +# USAGE: ./code2pdf.sh +# +# DESCRIPTION: Formats and converts a source code file to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 19/07/2008 19:31:39 CST +# REVISION: --- +#=============================================================================== + +vgrind $1 | pstopdf -i -o $1.pdf + diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh new file mode 100755 index 0000000..e8ac44a --- /dev/null +++ b/Scripts/convertToPDF.sh @@ -0,0 +1,27 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: convertToPDF.sh +# +# USAGE: ./convertToPDF.sh +# +# DESCRIPTION: Converts any file the OpenOffice can open to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/25/08 17:26:25 CST +# REVISION: --- +#=============================================================================== +if [ -f "$1" ] +then + echo "Converting \"$1\" to PDF" + /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\) +else + echo "Usage: $0 filename" +fi + diff --git a/Scripts/dos2unix.sh b/Scripts/dos2unix.sh new file mode 100755 index 0000000..653749b --- /dev/null +++ b/Scripts/dos2unix.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +################################################################## +# Based on d2u from http://www.geocities.com/usmbish/scripts.html +# (C) 2003 USM Bish +# Released under GNU GPL v2 - http://www.gnu.org/copyleft/gpl.html +################################################################## + +if [ $# -ne 2 ] +then + echo 1>&2 Usage: dos2unix [dosfile] [unixfile] + exit 1 +else + if ! [ -e $1 ] + then + echo "Error: $1 not found." + exit 1 + fi + if [ -e $2 ] + then + echo "Error: $2 already exists." + exit 1 + fi +fi + +cat $1 | tr -d '\015' > $2 + + diff --git a/Scripts/list.sh b/Scripts/list.sh new file mode 100755 index 0000000..d564162 --- /dev/null +++ b/Scripts/list.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: list.sh +# +# USAGE: ./list.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 06/21/08 10:11:00 CST +# REVISION: --- +#=============================================================================== + +for (( a=0 ; a != $1 ; a+=1 )) +do + echo 0000$a | sed "s/.*\([0-9][0-9][0-9]$\)/\1/" +done + diff --git a/Scripts/man.sh b/Scripts/man.sh new file mode 100755 index 0000000..35c2f28 --- /dev/null +++ b/Scripts/man.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +# http://www.macosxhints.com/article.php?story=200412080923108 +# +/usr/bin/osascript -e 'tell application "Safari" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Safari" to click menu item "New Tab" of menu "File" of menu bar item "File" of menu bar 1' +/usr/bin/open 'man:'$(/usr/bin/man -w $1 | /usr/bin/sed 's/\/.*\///') + diff --git a/Scripts/mkdmg.sh b/Scripts/mkdmg.sh new file mode 100755 index 0000000..c8d7e4c --- /dev/null +++ b/Scripts/mkdmg.sh @@ -0,0 +1,49 @@ +#!/bin/zsh +#=============================================================================== +# +# FILE: mkdmg.sh +# +# USAGE: ./mkdmg.sh +# +# DESCRIPTION: Script to take a Mac app and turn it in to a DMG package +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 16:54:36 CST +# REVISION: --- +#=============================================================================== +# +# Original script of this useful tool from here: +# http://www.kernelthread.com/mac/apme/archive/ +# +PATH=/bin:/sbin:/usr/bin:/usr/sbin +SCRATCH=./.mkdmg.$$$$ +error() +{ + echo "Error" + rm -rf $ + exit 1 +} +[ $ -ne 1 ] && echo "usage: mkdmg " && exit 1 +[ ! -e $ ] && echo "*** $ does not exist." && exit 1 +NAME=`basename $` +NAME="$" +ARCH="$ Archive" +IMAGE=$/$.dmg +OUTPUT="./$.dmg" +mkdir $ +echo "Creating disk image $..." +SIZE=`du -s -k $ | awk '{print $}'` || error +hdiutil create "$" -volname "$" -megabytes `expr 5 + $ / 1000` -type SPARSE -fs HFS+ > /dev/null 2>&1 || error +hdid $.sparseimage > /dev/null 2>&1 || error +ditto -rsrcFork $ "/Volumes/$/$" > /dev/null 2>&1 || error +hdiutil detach `mount | grep "Volumes/$" | awk '{print $}'` > /dev/null 2>&1 || error +hdiutil convert "$.sparseimage" -format UDZO -o $ -imagekey zlib-devel=9 > /dev/null 2>&1 || error +echo "Disk image $ ready" +rm -rf $ + diff --git a/Scripts/publish_xiaofrog.sh b/Scripts/publish_xiaofrog.sh new file mode 100755 index 0000000..43888b2 --- /dev/null +++ b/Scripts/publish_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: publish.sh +# +# USAGE: ./publish.sh +# +# DESCRIPTION: Prepare and then upload the web content to the website +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 19:30:43 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com /home/jryland/publish.sh + diff --git a/Scripts/renameTitle.pl b/Scripts/renameTitle.pl new file mode 100755 index 0000000..e6595a8 --- /dev/null +++ b/Scripts/renameTitle.pl @@ -0,0 +1,4 @@ +#!/usr/bin/perl +#dcop $KONSOLE_DCOP_SESSION renameSession "$@" +print "\033]30;".join(" ",@ARGV)."\007"; + diff --git a/Scripts/s60make.sh b/Scripts/s60make.sh new file mode 100755 index 0000000..846fdae --- /dev/null +++ b/Scripts/s60make.sh @@ -0,0 +1,31 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: s60make.sh +# +# USAGE: ./s60make.sh +# +# DESCRIPTION: Does all the steps to build a S60 app project +# Just uses a self signed certificate +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 07/05/08 22:41:18 CST +# REVISION: --- +#=============================================================================== +export EPOCROOT=~/opt/symbian-sdks/s60_32/ +export PATH=~/opt/symbian-eka2/bin/:$EPOCROOT/epoc32/tools:$PATH +cd group +bldmake bldfiles +abld build gcce urel +cd ../sis +makesis *_gcce.pkg test.sis +# makekeys -cert -expdays 3650 -password mykey.key mycert.cer +signsis test.sis test.sisx +/Applications/Utilities/Bluetooth\ File\ Exchange.app/Contents/MacOS/Bluetooth\ File\ Exchange ./test.sisx +cd .. + diff --git a/Scripts/scriptify.sh b/Scripts/scriptify.sh new file mode 100755 index 0000000..1c1a7f4 --- /dev/null +++ b/Scripts/scriptify.sh @@ -0,0 +1,26 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: scriptify.sh +# +# USAGE: ./scriptify.sh filename +# +# DESCRIPTION: Turns a file into bash script code for embedding in a script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: Filename can't have any slashs or funny characters in it +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 14:05:38 CST +# REVISION: --- +#=============================================================================== +cp $1 $1.sh +sed -i "" -e 's/\\/\\\\/g' $1.sh +sed -i "" -e 's/\$/\\\$/g' $1.sh +sed -i "" -e 's/"/\\"/g' $1.sh +sed -i "" -e 's/^/echo "/g' $1.sh +sed -i "" -e "s/\$/\" >> $1/g" $1.sh + diff --git a/Scripts/setup_profile.sh b/Scripts/setup_profile.sh new file mode 100755 index 0000000..0e3bfac --- /dev/null +++ b/Scripts/setup_profile.sh @@ -0,0 +1,250 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_profile.sh +# +# USAGE: ./setup_profile.sh +# +# DESCRIPTION: This is run from .profile and is a way to keep the settings +# and scripts together with the other scripts by calling it here +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (JR), (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 01/03/2008 00:46:55 JST +# REVISION: --- +#=============================================================================== + +export USER_NAME="John Ryland" +export USER_REF="JR" +export USER_EMAIL="(jryland@invertedlogic.com)" +export USER_COMPANY="InvertedLogic" +export PS1='\u@\h:$PWD \$ ' +export SVN_EDITOR=vi +export PATH=~/Code/Scripts/:~/usr/local/bin/:$PATH +export BASEDIR=~/Code/research/signals-slots + +# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH +# umask 002 + + +# JR - Make safe versions of rm, rmdir, unlink, mv etc +############################################################################## +# Make our environment safer from overwriting/deleting files by mistake # +############################################################################## + +# Used by safe versions of rm, rmdir and unlink +# Add to this function checks for any directories you don't want deleted so easily by mistake +function check_args() +{ + while [ $# -ne 0 ] + do + [ "$1" == "~" ] && return 0 + [ "$1" == "/" ] && return 0 + [ "$1" == "/Users" ] && return 0 + [ "$1" == "/Users/" ] && return 0 + [ "$1" == "/Users/jryland" ] && return 0 + [ "$1" == "/Users/jryland/" ] && return 0 + [ "$1" == "/Users/jryland/Code" ] && return 0 + [ "$1" == "/Users/jryland/Code/" ] && return 0 + [ "$1" == "/home" ] && return 0 + [ "$1" == "/home/" ] && return 0 + [ "$1" == "/home/jryland" ] && return 0 + [ "$1" == "/home/jryland/" ] && return 0 + [ "$1" == "/test/test" ] && return 0 + shift + done + return 1 +} + + +# +# I don't think I need to explain how the rm command can be dangerous +# +# Pretty obvious that "rm -rf /" can be a pretty devistating command to execute +# Or "rm -rf ~" is not very nice either. Guess what, before making this safe +# function, I had by mistake executed these 2 example commands before. +# Real dumb I know, but it really can happen. +# +# Senerio might be working on a +# remote system such as an embedded development device thats being tested +# and need a fresh home directory for running a test, wiping out the home +# directory on the target is easy with "rm -rf ~" if nothing valuable there. +# I've worked a lot on embedded targets with a telnet session from my PC. +# But if accidently type it in to the wrong terminal and disaster. When it +# most recently happened to me, the senario was another one. It was late at +# night and a little tired, and I had some poo files I was cleaning up after +# executing some commands that left behind some temporary files and also I +# saw a file named "~". When cleaning up these files I typed: +# +# "rm -rf blah.tmp ~ foo" +# +# I hit enter and a moment later when I thought that this is taking a bit +# longer than I expected, I realised, "oh crap"! and immediately hit ctrl-c. +# I was pretty lucky, mainly some .foo directories with thumbnails and cached +# data and unimportant stuff was erased, but this made me realise really how +# dangerous some commands are and I didn't want to make this same mistake +# again if it could be prevented easily which is what these functions are for. +# +# Yes, you should have backups too, but it doesn't hurt to have +# a safer working environment. +# +function rm() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/rm "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function unlink() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/unlink "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function rmdir() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/rmdir "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function check_not_overwrite_file_in_directory() +{ + dir=$1 + shift + while [ $# -ne 1 ] + do + # XXX need to check $1 doesn't start with '-' + [ -f "$dir/`basename $1`" ] && return 0 + shift + done + return 1 +} + + +# +# mv can be quite dangerous, imagine you type "mv *" and accidently hit +# enter before entering the directory to put the files to. It will mv +# all the files in to the last file name in the list which will mean +# that all files in the directory will be lost except the 2nd last one. +# Or just as bad, "mv * somename" where somename is the name of a +# directory but is mis-spelt, then all files except the last in the +# directory will be lost. +# +# Even you think you got it right, and the last argument is a directory +# name, what happens when you mv a file with a name that already exists +# in the destination directory? Yep, you guest it, puff, gone. +# +# And nearly always if moving multiple files and last argument is a filename +# or doesn't exist then it probably is not what is intented unless it +# is being used as a fancy way to delete some files while renaming another +# file at the same time, but I think that's a really really bad side +# effect to take advantage of and a pretty dumb idea in general. +# +function mv() +{ + last="echo \$$#" + last=`eval $last` + + if [ -d "$last" ] + then + check_not_overwrite_file_in_directory "$last" "$@" + if [ $? -eq 1 ] + then + /bin/mv "$@" + else + echo "Safe-mv by John Ryland" + echo "Looks like one of the files will overwrite a file in the destination directory" + echo "Bailing out just in case to save your arse \(files\)" + fi + return + fi + + if [ $# -gt 2 ] + then + echo "Safe-mv by John Ryland" + echo "Looks like you are wanting to move several files, but" + echo "NO NO NO... last argument is NOT a directory!!!" + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + if [ -f "$last" ] + then + echo "Safe-mv by John Ryland" + echo "NO NO NO... new name is an existing file, you will overwrite it!!!" + echo "I suggest better to explicity delete the other file first." + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + /bin/mv "$@" + return + fi + fi +} + + +# +# Similar problems occur for the cp command as mv, easily overwriting destination, +# if last argument is directory and file exists in destination directory, +# even if not explicitly given, overwrites the file of the same name as the +# source acting the same as the mv command. This might catch you out at +# some time, but can sometimes be useful. Perhaps better to try to be save +# than sorry. +# +function cp() +{ + last="echo \$$#" + last=`eval $last` + + if [ -d "$last" ] + then + check_not_overwrite_file_in_directory "$last" "$@" + if [ $? -eq 1 ] + then + /bin/cp "$@" + else + echo "Safe-cp by John Ryland" + echo "Looks like one of the files will overwrite a file in the destination directory" + echo "Bailing out just in case to save your arse \(files\)" + fi + return + fi + + if [ -f "$last" ] + then + echo "Safe-cp by John Ryland" + echo "NO NO NO... destination name is an existing file, you will overwrite it!!!" + echo "I suggest better to explicity delete the other file first." + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + /bin/cp "$@" + return + fi +} + + diff --git a/Scripts/setup_sites.sh b/Scripts/setup_sites.sh new file mode 100755 index 0000000..e9bd07c --- /dev/null +++ b/Scripts/setup_sites.sh @@ -0,0 +1,29 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_sites.sh +# +# USAGE: ./setup_sites.sh +# +# DESCRIPTION: Begin web development for invertedlogic on a new machine +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 15:18:21 CST +# REVISION: --- +#=============================================================================== + +if [ -e ./Sites ] +then + echo "Directory \"./Sites\" already exists, aborting" + echo "(try to rename the existing ./Sites dir to a new name first)" +else + # svn co --username web http://internal.invertedlogic.com/dev/web Sites + svn co svn+ssh://invertedlogic_internal@internal.invertedlogic.com/home/invertedlogic_internal/svn/web Sites +fi + diff --git a/Scripts/setup_ssh.sh b/Scripts/setup_ssh.sh new file mode 100755 index 0000000..5cc6e2c --- /dev/null +++ b/Scripts/setup_ssh.sh @@ -0,0 +1,35 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_ssh.sh +# +# USAGE: ./setup_ssh.sh server-address +# +# DESCRIPTION: Sets up password-less ssh login to another machine +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 31/07/2008 22:53:01 JST +# REVISION: --- +#=============================================================================== + +if [ "$1" == "" ] +then + echo "Usage $0 server-address" + exit 0 +fi + +if [ ! -f ~/.ssh/id_rsa.pub ] +then + echo | ssh-keygen -t rsa +fi + +scp ~/.ssh/id_rsa.pub $1:tmp.pub +ssh $1 'mkdir -p ~/.ssh ; chmod 700 ~/.ssh ; cat tmp.pub >> ~/.ssh/authorized_keys ; chmod 600 ~/.ssh/authorized_keys ; rm tmp.pub' + + diff --git a/Scripts/setup_vim.sh b/Scripts/setup_vim.sh new file mode 100755 index 0000000..fef5b76 --- /dev/null +++ b/Scripts/setup_vim.sh @@ -0,0 +1,65 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_vim.sh +# +# USAGE: ./setup_vim.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 19/08/2008 12:02:36 JST +# REVISION: --- +#=============================================================================== + +mkdir -p ~/Applications +# Current preference for this one over MacVim because it is faster to load and colors are better +curl http://macvim.org/OSX/files/binaries/OSX10.4/vim7.0.224.tar.bz2 > ./vim7.0.224.tar.bz2 + +# curl "http://repo.or.cz/w/MacVim.git?a=snapshot;h=bf2ed5675e67b37b748edfb86c9273adcba815b8;sf=tgz" > ./MacVim-src-1.2.tar.gz +# echo "MacVim Homepage at: http://code.google.com/p/macvim/" +# tar zxf ./MacVim-src-1.2.tar.gz +# cd MacVim/src +# touch auto/<###>.sh +# ./configure --enable-gui=MacVim +# make +# cd MacVim +# xcodebuild + +mkdir -p ~/.vim/.cache +cd ~/.vim/.cache +curl http://www.vim.org/scripts/download_script.php?src_id=7701 > ./taglist_45.zip +curl http://www.vim.org/scripts/download_script.php?src_id=9123 > ./bash-support.zip +curl http://www.vim.org/scripts/download_script.php?src_id=9141 > ./chlordane.vim +curl http://www.vim.org/scripts/download_script.php?src_id=7675 > ./headerguard-0.1.0.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7722 > ./omnicppcomplete-0.41.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7384 > ./code_complete.vim +curl http://www.vim.org/scripts/download_script.php?src_id=7461 > ./vimExplorer.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8830 > ./autoinclude.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8341 > ./renamec.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8029 > ./refactor.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8483 > ./doxygen-support.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7289 > ./rectcut.vim +curl http://www.vim.org/scripts/download_script.php?src_id=7877 > ./lusty-explorer.vim +curl http://www.vim.org/scripts/download_script.php?src_id=6878 > ./hints_man3.vba.gz +curl http://www.vim.org/scripts/download_script.php?src_id=8087 > ./echofunc.vim +curl http://www.vim.org/scripts/download_script.php?src_id=6682 > ./SnippetsMgr.zip +curl http://www.vim.org/scripts/download_script.php?src_id=8976 > ./NERD_tree.zip +curl http://www.vim.org/scripts/download_script.php?src_id=6181 > ./c_function_plugin.vim +curl http://www.vim.org/scripts/download_script.php?src_id=9145 > ./trinity.zip +curl http://www.vim.org/scripts/download_script.php?src_id=9144 > ./srcexpl.vim +curl http://www.vim.org/scripts/download_script.php?src_id=9146 > ./cvim.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7837 > ./lusty-juggler.vim + +cd .. +# unzip .cache/taglist_45.zip +# unzip .cache/bash-support.zip + + + diff --git a/Scripts/setup_www_svn/domain.sh b/Scripts/setup_www_svn/domain.sh new file mode 100755 index 0000000..d954544 --- /dev/null +++ b/Scripts/setup_www_svn/domain.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +DOMAIN=internal.invertedlogic.com + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/clean_exit.sh b/Scripts/clean_exit.sh new file mode 100755 index 0000000..f219da8 --- /dev/null +++ b/Scripts/clean_exit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Exit and wipe the entire bash history including removing that we did this command +# +rm ~/.bash_history ; kill -9 $PPID + + diff --git a/Scripts/code2pdf.sh b/Scripts/code2pdf.sh new file mode 100755 index 0000000..bc9b3d8 --- /dev/null +++ b/Scripts/code2pdf.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: code2pdf.sh +# +# USAGE: ./code2pdf.sh +# +# DESCRIPTION: Formats and converts a source code file to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 19/07/2008 19:31:39 CST +# REVISION: --- +#=============================================================================== + +vgrind $1 | pstopdf -i -o $1.pdf + diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh new file mode 100755 index 0000000..e8ac44a --- /dev/null +++ b/Scripts/convertToPDF.sh @@ -0,0 +1,27 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: convertToPDF.sh +# +# USAGE: ./convertToPDF.sh +# +# DESCRIPTION: Converts any file the OpenOffice can open to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/25/08 17:26:25 CST +# REVISION: --- +#=============================================================================== +if [ -f "$1" ] +then + echo "Converting \"$1\" to PDF" + /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\) +else + echo "Usage: $0 filename" +fi + diff --git a/Scripts/dos2unix.sh b/Scripts/dos2unix.sh new file mode 100755 index 0000000..653749b --- /dev/null +++ b/Scripts/dos2unix.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +################################################################## +# Based on d2u from http://www.geocities.com/usmbish/scripts.html +# (C) 2003 USM Bish +# Released under GNU GPL v2 - http://www.gnu.org/copyleft/gpl.html +################################################################## + +if [ $# -ne 2 ] +then + echo 1>&2 Usage: dos2unix [dosfile] [unixfile] + exit 1 +else + if ! [ -e $1 ] + then + echo "Error: $1 not found." + exit 1 + fi + if [ -e $2 ] + then + echo "Error: $2 already exists." + exit 1 + fi +fi + +cat $1 | tr -d '\015' > $2 + + diff --git a/Scripts/list.sh b/Scripts/list.sh new file mode 100755 index 0000000..d564162 --- /dev/null +++ b/Scripts/list.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: list.sh +# +# USAGE: ./list.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 06/21/08 10:11:00 CST +# REVISION: --- +#=============================================================================== + +for (( a=0 ; a != $1 ; a+=1 )) +do + echo 0000$a | sed "s/.*\([0-9][0-9][0-9]$\)/\1/" +done + diff --git a/Scripts/man.sh b/Scripts/man.sh new file mode 100755 index 0000000..35c2f28 --- /dev/null +++ b/Scripts/man.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +# http://www.macosxhints.com/article.php?story=200412080923108 +# +/usr/bin/osascript -e 'tell application "Safari" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Safari" to click menu item "New Tab" of menu "File" of menu bar item "File" of menu bar 1' +/usr/bin/open 'man:'$(/usr/bin/man -w $1 | /usr/bin/sed 's/\/.*\///') + diff --git a/Scripts/mkdmg.sh b/Scripts/mkdmg.sh new file mode 100755 index 0000000..c8d7e4c --- /dev/null +++ b/Scripts/mkdmg.sh @@ -0,0 +1,49 @@ +#!/bin/zsh +#=============================================================================== +# +# FILE: mkdmg.sh +# +# USAGE: ./mkdmg.sh +# +# DESCRIPTION: Script to take a Mac app and turn it in to a DMG package +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 16:54:36 CST +# REVISION: --- +#=============================================================================== +# +# Original script of this useful tool from here: +# http://www.kernelthread.com/mac/apme/archive/ +# +PATH=/bin:/sbin:/usr/bin:/usr/sbin +SCRATCH=./.mkdmg.$$$$ +error() +{ + echo "Error" + rm -rf $ + exit 1 +} +[ $ -ne 1 ] && echo "usage: mkdmg " && exit 1 +[ ! -e $ ] && echo "*** $ does not exist." && exit 1 +NAME=`basename $` +NAME="$" +ARCH="$ Archive" +IMAGE=$/$.dmg +OUTPUT="./$.dmg" +mkdir $ +echo "Creating disk image $..." +SIZE=`du -s -k $ | awk '{print $}'` || error +hdiutil create "$" -volname "$" -megabytes `expr 5 + $ / 1000` -type SPARSE -fs HFS+ > /dev/null 2>&1 || error +hdid $.sparseimage > /dev/null 2>&1 || error +ditto -rsrcFork $ "/Volumes/$/$" > /dev/null 2>&1 || error +hdiutil detach `mount | grep "Volumes/$" | awk '{print $}'` > /dev/null 2>&1 || error +hdiutil convert "$.sparseimage" -format UDZO -o $ -imagekey zlib-devel=9 > /dev/null 2>&1 || error +echo "Disk image $ ready" +rm -rf $ + diff --git a/Scripts/publish_xiaofrog.sh b/Scripts/publish_xiaofrog.sh new file mode 100755 index 0000000..43888b2 --- /dev/null +++ b/Scripts/publish_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: publish.sh +# +# USAGE: ./publish.sh +# +# DESCRIPTION: Prepare and then upload the web content to the website +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 19:30:43 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com /home/jryland/publish.sh + diff --git a/Scripts/renameTitle.pl b/Scripts/renameTitle.pl new file mode 100755 index 0000000..e6595a8 --- /dev/null +++ b/Scripts/renameTitle.pl @@ -0,0 +1,4 @@ +#!/usr/bin/perl +#dcop $KONSOLE_DCOP_SESSION renameSession "$@" +print "\033]30;".join(" ",@ARGV)."\007"; + diff --git a/Scripts/s60make.sh b/Scripts/s60make.sh new file mode 100755 index 0000000..846fdae --- /dev/null +++ b/Scripts/s60make.sh @@ -0,0 +1,31 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: s60make.sh +# +# USAGE: ./s60make.sh +# +# DESCRIPTION: Does all the steps to build a S60 app project +# Just uses a self signed certificate +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 07/05/08 22:41:18 CST +# REVISION: --- +#=============================================================================== +export EPOCROOT=~/opt/symbian-sdks/s60_32/ +export PATH=~/opt/symbian-eka2/bin/:$EPOCROOT/epoc32/tools:$PATH +cd group +bldmake bldfiles +abld build gcce urel +cd ../sis +makesis *_gcce.pkg test.sis +# makekeys -cert -expdays 3650 -password mykey.key mycert.cer +signsis test.sis test.sisx +/Applications/Utilities/Bluetooth\ File\ Exchange.app/Contents/MacOS/Bluetooth\ File\ Exchange ./test.sisx +cd .. + diff --git a/Scripts/scriptify.sh b/Scripts/scriptify.sh new file mode 100755 index 0000000..1c1a7f4 --- /dev/null +++ b/Scripts/scriptify.sh @@ -0,0 +1,26 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: scriptify.sh +# +# USAGE: ./scriptify.sh filename +# +# DESCRIPTION: Turns a file into bash script code for embedding in a script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: Filename can't have any slashs or funny characters in it +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 14:05:38 CST +# REVISION: --- +#=============================================================================== +cp $1 $1.sh +sed -i "" -e 's/\\/\\\\/g' $1.sh +sed -i "" -e 's/\$/\\\$/g' $1.sh +sed -i "" -e 's/"/\\"/g' $1.sh +sed -i "" -e 's/^/echo "/g' $1.sh +sed -i "" -e "s/\$/\" >> $1/g" $1.sh + diff --git a/Scripts/setup_profile.sh b/Scripts/setup_profile.sh new file mode 100755 index 0000000..0e3bfac --- /dev/null +++ b/Scripts/setup_profile.sh @@ -0,0 +1,250 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_profile.sh +# +# USAGE: ./setup_profile.sh +# +# DESCRIPTION: This is run from .profile and is a way to keep the settings +# and scripts together with the other scripts by calling it here +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (JR), (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 01/03/2008 00:46:55 JST +# REVISION: --- +#=============================================================================== + +export USER_NAME="John Ryland" +export USER_REF="JR" +export USER_EMAIL="(jryland@invertedlogic.com)" +export USER_COMPANY="InvertedLogic" +export PS1='\u@\h:$PWD \$ ' +export SVN_EDITOR=vi +export PATH=~/Code/Scripts/:~/usr/local/bin/:$PATH +export BASEDIR=~/Code/research/signals-slots + +# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH +# umask 002 + + +# JR - Make safe versions of rm, rmdir, unlink, mv etc +############################################################################## +# Make our environment safer from overwriting/deleting files by mistake # +############################################################################## + +# Used by safe versions of rm, rmdir and unlink +# Add to this function checks for any directories you don't want deleted so easily by mistake +function check_args() +{ + while [ $# -ne 0 ] + do + [ "$1" == "~" ] && return 0 + [ "$1" == "/" ] && return 0 + [ "$1" == "/Users" ] && return 0 + [ "$1" == "/Users/" ] && return 0 + [ "$1" == "/Users/jryland" ] && return 0 + [ "$1" == "/Users/jryland/" ] && return 0 + [ "$1" == "/Users/jryland/Code" ] && return 0 + [ "$1" == "/Users/jryland/Code/" ] && return 0 + [ "$1" == "/home" ] && return 0 + [ "$1" == "/home/" ] && return 0 + [ "$1" == "/home/jryland" ] && return 0 + [ "$1" == "/home/jryland/" ] && return 0 + [ "$1" == "/test/test" ] && return 0 + shift + done + return 1 +} + + +# +# I don't think I need to explain how the rm command can be dangerous +# +# Pretty obvious that "rm -rf /" can be a pretty devistating command to execute +# Or "rm -rf ~" is not very nice either. Guess what, before making this safe +# function, I had by mistake executed these 2 example commands before. +# Real dumb I know, but it really can happen. +# +# Senerio might be working on a +# remote system such as an embedded development device thats being tested +# and need a fresh home directory for running a test, wiping out the home +# directory on the target is easy with "rm -rf ~" if nothing valuable there. +# I've worked a lot on embedded targets with a telnet session from my PC. +# But if accidently type it in to the wrong terminal and disaster. When it +# most recently happened to me, the senario was another one. It was late at +# night and a little tired, and I had some poo files I was cleaning up after +# executing some commands that left behind some temporary files and also I +# saw a file named "~". When cleaning up these files I typed: +# +# "rm -rf blah.tmp ~ foo" +# +# I hit enter and a moment later when I thought that this is taking a bit +# longer than I expected, I realised, "oh crap"! and immediately hit ctrl-c. +# I was pretty lucky, mainly some .foo directories with thumbnails and cached +# data and unimportant stuff was erased, but this made me realise really how +# dangerous some commands are and I didn't want to make this same mistake +# again if it could be prevented easily which is what these functions are for. +# +# Yes, you should have backups too, but it doesn't hurt to have +# a safer working environment. +# +function rm() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/rm "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function unlink() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/unlink "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function rmdir() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/rmdir "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function check_not_overwrite_file_in_directory() +{ + dir=$1 + shift + while [ $# -ne 1 ] + do + # XXX need to check $1 doesn't start with '-' + [ -f "$dir/`basename $1`" ] && return 0 + shift + done + return 1 +} + + +# +# mv can be quite dangerous, imagine you type "mv *" and accidently hit +# enter before entering the directory to put the files to. It will mv +# all the files in to the last file name in the list which will mean +# that all files in the directory will be lost except the 2nd last one. +# Or just as bad, "mv * somename" where somename is the name of a +# directory but is mis-spelt, then all files except the last in the +# directory will be lost. +# +# Even you think you got it right, and the last argument is a directory +# name, what happens when you mv a file with a name that already exists +# in the destination directory? Yep, you guest it, puff, gone. +# +# And nearly always if moving multiple files and last argument is a filename +# or doesn't exist then it probably is not what is intented unless it +# is being used as a fancy way to delete some files while renaming another +# file at the same time, but I think that's a really really bad side +# effect to take advantage of and a pretty dumb idea in general. +# +function mv() +{ + last="echo \$$#" + last=`eval $last` + + if [ -d "$last" ] + then + check_not_overwrite_file_in_directory "$last" "$@" + if [ $? -eq 1 ] + then + /bin/mv "$@" + else + echo "Safe-mv by John Ryland" + echo "Looks like one of the files will overwrite a file in the destination directory" + echo "Bailing out just in case to save your arse \(files\)" + fi + return + fi + + if [ $# -gt 2 ] + then + echo "Safe-mv by John Ryland" + echo "Looks like you are wanting to move several files, but" + echo "NO NO NO... last argument is NOT a directory!!!" + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + if [ -f "$last" ] + then + echo "Safe-mv by John Ryland" + echo "NO NO NO... new name is an existing file, you will overwrite it!!!" + echo "I suggest better to explicity delete the other file first." + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + /bin/mv "$@" + return + fi + fi +} + + +# +# Similar problems occur for the cp command as mv, easily overwriting destination, +# if last argument is directory and file exists in destination directory, +# even if not explicitly given, overwrites the file of the same name as the +# source acting the same as the mv command. This might catch you out at +# some time, but can sometimes be useful. Perhaps better to try to be save +# than sorry. +# +function cp() +{ + last="echo \$$#" + last=`eval $last` + + if [ -d "$last" ] + then + check_not_overwrite_file_in_directory "$last" "$@" + if [ $? -eq 1 ] + then + /bin/cp "$@" + else + echo "Safe-cp by John Ryland" + echo "Looks like one of the files will overwrite a file in the destination directory" + echo "Bailing out just in case to save your arse \(files\)" + fi + return + fi + + if [ -f "$last" ] + then + echo "Safe-cp by John Ryland" + echo "NO NO NO... destination name is an existing file, you will overwrite it!!!" + echo "I suggest better to explicity delete the other file first." + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + /bin/cp "$@" + return + fi +} + + diff --git a/Scripts/setup_sites.sh b/Scripts/setup_sites.sh new file mode 100755 index 0000000..e9bd07c --- /dev/null +++ b/Scripts/setup_sites.sh @@ -0,0 +1,29 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_sites.sh +# +# USAGE: ./setup_sites.sh +# +# DESCRIPTION: Begin web development for invertedlogic on a new machine +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 15:18:21 CST +# REVISION: --- +#=============================================================================== + +if [ -e ./Sites ] +then + echo "Directory \"./Sites\" already exists, aborting" + echo "(try to rename the existing ./Sites dir to a new name first)" +else + # svn co --username web http://internal.invertedlogic.com/dev/web Sites + svn co svn+ssh://invertedlogic_internal@internal.invertedlogic.com/home/invertedlogic_internal/svn/web Sites +fi + diff --git a/Scripts/setup_ssh.sh b/Scripts/setup_ssh.sh new file mode 100755 index 0000000..5cc6e2c --- /dev/null +++ b/Scripts/setup_ssh.sh @@ -0,0 +1,35 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_ssh.sh +# +# USAGE: ./setup_ssh.sh server-address +# +# DESCRIPTION: Sets up password-less ssh login to another machine +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 31/07/2008 22:53:01 JST +# REVISION: --- +#=============================================================================== + +if [ "$1" == "" ] +then + echo "Usage $0 server-address" + exit 0 +fi + +if [ ! -f ~/.ssh/id_rsa.pub ] +then + echo | ssh-keygen -t rsa +fi + +scp ~/.ssh/id_rsa.pub $1:tmp.pub +ssh $1 'mkdir -p ~/.ssh ; chmod 700 ~/.ssh ; cat tmp.pub >> ~/.ssh/authorized_keys ; chmod 600 ~/.ssh/authorized_keys ; rm tmp.pub' + + diff --git a/Scripts/setup_vim.sh b/Scripts/setup_vim.sh new file mode 100755 index 0000000..fef5b76 --- /dev/null +++ b/Scripts/setup_vim.sh @@ -0,0 +1,65 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_vim.sh +# +# USAGE: ./setup_vim.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 19/08/2008 12:02:36 JST +# REVISION: --- +#=============================================================================== + +mkdir -p ~/Applications +# Current preference for this one over MacVim because it is faster to load and colors are better +curl http://macvim.org/OSX/files/binaries/OSX10.4/vim7.0.224.tar.bz2 > ./vim7.0.224.tar.bz2 + +# curl "http://repo.or.cz/w/MacVim.git?a=snapshot;h=bf2ed5675e67b37b748edfb86c9273adcba815b8;sf=tgz" > ./MacVim-src-1.2.tar.gz +# echo "MacVim Homepage at: http://code.google.com/p/macvim/" +# tar zxf ./MacVim-src-1.2.tar.gz +# cd MacVim/src +# touch auto/<###>.sh +# ./configure --enable-gui=MacVim +# make +# cd MacVim +# xcodebuild + +mkdir -p ~/.vim/.cache +cd ~/.vim/.cache +curl http://www.vim.org/scripts/download_script.php?src_id=7701 > ./taglist_45.zip +curl http://www.vim.org/scripts/download_script.php?src_id=9123 > ./bash-support.zip +curl http://www.vim.org/scripts/download_script.php?src_id=9141 > ./chlordane.vim +curl http://www.vim.org/scripts/download_script.php?src_id=7675 > ./headerguard-0.1.0.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7722 > ./omnicppcomplete-0.41.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7384 > ./code_complete.vim +curl http://www.vim.org/scripts/download_script.php?src_id=7461 > ./vimExplorer.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8830 > ./autoinclude.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8341 > ./renamec.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8029 > ./refactor.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8483 > ./doxygen-support.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7289 > ./rectcut.vim +curl http://www.vim.org/scripts/download_script.php?src_id=7877 > ./lusty-explorer.vim +curl http://www.vim.org/scripts/download_script.php?src_id=6878 > ./hints_man3.vba.gz +curl http://www.vim.org/scripts/download_script.php?src_id=8087 > ./echofunc.vim +curl http://www.vim.org/scripts/download_script.php?src_id=6682 > ./SnippetsMgr.zip +curl http://www.vim.org/scripts/download_script.php?src_id=8976 > ./NERD_tree.zip +curl http://www.vim.org/scripts/download_script.php?src_id=6181 > ./c_function_plugin.vim +curl http://www.vim.org/scripts/download_script.php?src_id=9145 > ./trinity.zip +curl http://www.vim.org/scripts/download_script.php?src_id=9144 > ./srcexpl.vim +curl http://www.vim.org/scripts/download_script.php?src_id=9146 > ./cvim.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7837 > ./lusty-juggler.vim + +cd .. +# unzip .cache/taglist_45.zip +# unzip .cache/bash-support.zip + + + diff --git a/Scripts/setup_www_svn/domain.sh b/Scripts/setup_www_svn/domain.sh new file mode 100755 index 0000000..d954544 --- /dev/null +++ b/Scripts/setup_www_svn/domain.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +DOMAIN=internal.invertedlogic.com + diff --git a/Scripts/setup_www_svn/publish.sh b/Scripts/setup_www_svn/publish.sh new file mode 100755 index 0000000..0737877 --- /dev/null +++ b/Scripts/setup_www_svn/publish.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +. ./domain.sh + +cd $DOMAIN +echo "Updating server" +svn up +echo "Updated server" + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/clean_exit.sh b/Scripts/clean_exit.sh new file mode 100755 index 0000000..f219da8 --- /dev/null +++ b/Scripts/clean_exit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Exit and wipe the entire bash history including removing that we did this command +# +rm ~/.bash_history ; kill -9 $PPID + + diff --git a/Scripts/code2pdf.sh b/Scripts/code2pdf.sh new file mode 100755 index 0000000..bc9b3d8 --- /dev/null +++ b/Scripts/code2pdf.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: code2pdf.sh +# +# USAGE: ./code2pdf.sh +# +# DESCRIPTION: Formats and converts a source code file to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 19/07/2008 19:31:39 CST +# REVISION: --- +#=============================================================================== + +vgrind $1 | pstopdf -i -o $1.pdf + diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh new file mode 100755 index 0000000..e8ac44a --- /dev/null +++ b/Scripts/convertToPDF.sh @@ -0,0 +1,27 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: convertToPDF.sh +# +# USAGE: ./convertToPDF.sh +# +# DESCRIPTION: Converts any file the OpenOffice can open to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/25/08 17:26:25 CST +# REVISION: --- +#=============================================================================== +if [ -f "$1" ] +then + echo "Converting \"$1\" to PDF" + /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\) +else + echo "Usage: $0 filename" +fi + diff --git a/Scripts/dos2unix.sh b/Scripts/dos2unix.sh new file mode 100755 index 0000000..653749b --- /dev/null +++ b/Scripts/dos2unix.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +################################################################## +# Based on d2u from http://www.geocities.com/usmbish/scripts.html +# (C) 2003 USM Bish +# Released under GNU GPL v2 - http://www.gnu.org/copyleft/gpl.html +################################################################## + +if [ $# -ne 2 ] +then + echo 1>&2 Usage: dos2unix [dosfile] [unixfile] + exit 1 +else + if ! [ -e $1 ] + then + echo "Error: $1 not found." + exit 1 + fi + if [ -e $2 ] + then + echo "Error: $2 already exists." + exit 1 + fi +fi + +cat $1 | tr -d '\015' > $2 + + diff --git a/Scripts/list.sh b/Scripts/list.sh new file mode 100755 index 0000000..d564162 --- /dev/null +++ b/Scripts/list.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: list.sh +# +# USAGE: ./list.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 06/21/08 10:11:00 CST +# REVISION: --- +#=============================================================================== + +for (( a=0 ; a != $1 ; a+=1 )) +do + echo 0000$a | sed "s/.*\([0-9][0-9][0-9]$\)/\1/" +done + diff --git a/Scripts/man.sh b/Scripts/man.sh new file mode 100755 index 0000000..35c2f28 --- /dev/null +++ b/Scripts/man.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +# http://www.macosxhints.com/article.php?story=200412080923108 +# +/usr/bin/osascript -e 'tell application "Safari" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Safari" to click menu item "New Tab" of menu "File" of menu bar item "File" of menu bar 1' +/usr/bin/open 'man:'$(/usr/bin/man -w $1 | /usr/bin/sed 's/\/.*\///') + diff --git a/Scripts/mkdmg.sh b/Scripts/mkdmg.sh new file mode 100755 index 0000000..c8d7e4c --- /dev/null +++ b/Scripts/mkdmg.sh @@ -0,0 +1,49 @@ +#!/bin/zsh +#=============================================================================== +# +# FILE: mkdmg.sh +# +# USAGE: ./mkdmg.sh +# +# DESCRIPTION: Script to take a Mac app and turn it in to a DMG package +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 16:54:36 CST +# REVISION: --- +#=============================================================================== +# +# Original script of this useful tool from here: +# http://www.kernelthread.com/mac/apme/archive/ +# +PATH=/bin:/sbin:/usr/bin:/usr/sbin +SCRATCH=./.mkdmg.$$$$ +error() +{ + echo "Error" + rm -rf $ + exit 1 +} +[ $ -ne 1 ] && echo "usage: mkdmg " && exit 1 +[ ! -e $ ] && echo "*** $ does not exist." && exit 1 +NAME=`basename $` +NAME="$" +ARCH="$ Archive" +IMAGE=$/$.dmg +OUTPUT="./$.dmg" +mkdir $ +echo "Creating disk image $..." +SIZE=`du -s -k $ | awk '{print $}'` || error +hdiutil create "$" -volname "$" -megabytes `expr 5 + $ / 1000` -type SPARSE -fs HFS+ > /dev/null 2>&1 || error +hdid $.sparseimage > /dev/null 2>&1 || error +ditto -rsrcFork $ "/Volumes/$/$" > /dev/null 2>&1 || error +hdiutil detach `mount | grep "Volumes/$" | awk '{print $}'` > /dev/null 2>&1 || error +hdiutil convert "$.sparseimage" -format UDZO -o $ -imagekey zlib-devel=9 > /dev/null 2>&1 || error +echo "Disk image $ ready" +rm -rf $ + diff --git a/Scripts/publish_xiaofrog.sh b/Scripts/publish_xiaofrog.sh new file mode 100755 index 0000000..43888b2 --- /dev/null +++ b/Scripts/publish_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: publish.sh +# +# USAGE: ./publish.sh +# +# DESCRIPTION: Prepare and then upload the web content to the website +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 19:30:43 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com /home/jryland/publish.sh + diff --git a/Scripts/renameTitle.pl b/Scripts/renameTitle.pl new file mode 100755 index 0000000..e6595a8 --- /dev/null +++ b/Scripts/renameTitle.pl @@ -0,0 +1,4 @@ +#!/usr/bin/perl +#dcop $KONSOLE_DCOP_SESSION renameSession "$@" +print "\033]30;".join(" ",@ARGV)."\007"; + diff --git a/Scripts/s60make.sh b/Scripts/s60make.sh new file mode 100755 index 0000000..846fdae --- /dev/null +++ b/Scripts/s60make.sh @@ -0,0 +1,31 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: s60make.sh +# +# USAGE: ./s60make.sh +# +# DESCRIPTION: Does all the steps to build a S60 app project +# Just uses a self signed certificate +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 07/05/08 22:41:18 CST +# REVISION: --- +#=============================================================================== +export EPOCROOT=~/opt/symbian-sdks/s60_32/ +export PATH=~/opt/symbian-eka2/bin/:$EPOCROOT/epoc32/tools:$PATH +cd group +bldmake bldfiles +abld build gcce urel +cd ../sis +makesis *_gcce.pkg test.sis +# makekeys -cert -expdays 3650 -password mykey.key mycert.cer +signsis test.sis test.sisx +/Applications/Utilities/Bluetooth\ File\ Exchange.app/Contents/MacOS/Bluetooth\ File\ Exchange ./test.sisx +cd .. + diff --git a/Scripts/scriptify.sh b/Scripts/scriptify.sh new file mode 100755 index 0000000..1c1a7f4 --- /dev/null +++ b/Scripts/scriptify.sh @@ -0,0 +1,26 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: scriptify.sh +# +# USAGE: ./scriptify.sh filename +# +# DESCRIPTION: Turns a file into bash script code for embedding in a script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: Filename can't have any slashs or funny characters in it +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 14:05:38 CST +# REVISION: --- +#=============================================================================== +cp $1 $1.sh +sed -i "" -e 's/\\/\\\\/g' $1.sh +sed -i "" -e 's/\$/\\\$/g' $1.sh +sed -i "" -e 's/"/\\"/g' $1.sh +sed -i "" -e 's/^/echo "/g' $1.sh +sed -i "" -e "s/\$/\" >> $1/g" $1.sh + diff --git a/Scripts/setup_profile.sh b/Scripts/setup_profile.sh new file mode 100755 index 0000000..0e3bfac --- /dev/null +++ b/Scripts/setup_profile.sh @@ -0,0 +1,250 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_profile.sh +# +# USAGE: ./setup_profile.sh +# +# DESCRIPTION: This is run from .profile and is a way to keep the settings +# and scripts together with the other scripts by calling it here +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (JR), (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 01/03/2008 00:46:55 JST +# REVISION: --- +#=============================================================================== + +export USER_NAME="John Ryland" +export USER_REF="JR" +export USER_EMAIL="(jryland@invertedlogic.com)" +export USER_COMPANY="InvertedLogic" +export PS1='\u@\h:$PWD \$ ' +export SVN_EDITOR=vi +export PATH=~/Code/Scripts/:~/usr/local/bin/:$PATH +export BASEDIR=~/Code/research/signals-slots + +# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH +# umask 002 + + +# JR - Make safe versions of rm, rmdir, unlink, mv etc +############################################################################## +# Make our environment safer from overwriting/deleting files by mistake # +############################################################################## + +# Used by safe versions of rm, rmdir and unlink +# Add to this function checks for any directories you don't want deleted so easily by mistake +function check_args() +{ + while [ $# -ne 0 ] + do + [ "$1" == "~" ] && return 0 + [ "$1" == "/" ] && return 0 + [ "$1" == "/Users" ] && return 0 + [ "$1" == "/Users/" ] && return 0 + [ "$1" == "/Users/jryland" ] && return 0 + [ "$1" == "/Users/jryland/" ] && return 0 + [ "$1" == "/Users/jryland/Code" ] && return 0 + [ "$1" == "/Users/jryland/Code/" ] && return 0 + [ "$1" == "/home" ] && return 0 + [ "$1" == "/home/" ] && return 0 + [ "$1" == "/home/jryland" ] && return 0 + [ "$1" == "/home/jryland/" ] && return 0 + [ "$1" == "/test/test" ] && return 0 + shift + done + return 1 +} + + +# +# I don't think I need to explain how the rm command can be dangerous +# +# Pretty obvious that "rm -rf /" can be a pretty devistating command to execute +# Or "rm -rf ~" is not very nice either. Guess what, before making this safe +# function, I had by mistake executed these 2 example commands before. +# Real dumb I know, but it really can happen. +# +# Senerio might be working on a +# remote system such as an embedded development device thats being tested +# and need a fresh home directory for running a test, wiping out the home +# directory on the target is easy with "rm -rf ~" if nothing valuable there. +# I've worked a lot on embedded targets with a telnet session from my PC. +# But if accidently type it in to the wrong terminal and disaster. When it +# most recently happened to me, the senario was another one. It was late at +# night and a little tired, and I had some poo files I was cleaning up after +# executing some commands that left behind some temporary files and also I +# saw a file named "~". When cleaning up these files I typed: +# +# "rm -rf blah.tmp ~ foo" +# +# I hit enter and a moment later when I thought that this is taking a bit +# longer than I expected, I realised, "oh crap"! and immediately hit ctrl-c. +# I was pretty lucky, mainly some .foo directories with thumbnails and cached +# data and unimportant stuff was erased, but this made me realise really how +# dangerous some commands are and I didn't want to make this same mistake +# again if it could be prevented easily which is what these functions are for. +# +# Yes, you should have backups too, but it doesn't hurt to have +# a safer working environment. +# +function rm() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/rm "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function unlink() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/unlink "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function rmdir() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/rmdir "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function check_not_overwrite_file_in_directory() +{ + dir=$1 + shift + while [ $# -ne 1 ] + do + # XXX need to check $1 doesn't start with '-' + [ -f "$dir/`basename $1`" ] && return 0 + shift + done + return 1 +} + + +# +# mv can be quite dangerous, imagine you type "mv *" and accidently hit +# enter before entering the directory to put the files to. It will mv +# all the files in to the last file name in the list which will mean +# that all files in the directory will be lost except the 2nd last one. +# Or just as bad, "mv * somename" where somename is the name of a +# directory but is mis-spelt, then all files except the last in the +# directory will be lost. +# +# Even you think you got it right, and the last argument is a directory +# name, what happens when you mv a file with a name that already exists +# in the destination directory? Yep, you guest it, puff, gone. +# +# And nearly always if moving multiple files and last argument is a filename +# or doesn't exist then it probably is not what is intented unless it +# is being used as a fancy way to delete some files while renaming another +# file at the same time, but I think that's a really really bad side +# effect to take advantage of and a pretty dumb idea in general. +# +function mv() +{ + last="echo \$$#" + last=`eval $last` + + if [ -d "$last" ] + then + check_not_overwrite_file_in_directory "$last" "$@" + if [ $? -eq 1 ] + then + /bin/mv "$@" + else + echo "Safe-mv by John Ryland" + echo "Looks like one of the files will overwrite a file in the destination directory" + echo "Bailing out just in case to save your arse \(files\)" + fi + return + fi + + if [ $# -gt 2 ] + then + echo "Safe-mv by John Ryland" + echo "Looks like you are wanting to move several files, but" + echo "NO NO NO... last argument is NOT a directory!!!" + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + if [ -f "$last" ] + then + echo "Safe-mv by John Ryland" + echo "NO NO NO... new name is an existing file, you will overwrite it!!!" + echo "I suggest better to explicity delete the other file first." + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + /bin/mv "$@" + return + fi + fi +} + + +# +# Similar problems occur for the cp command as mv, easily overwriting destination, +# if last argument is directory and file exists in destination directory, +# even if not explicitly given, overwrites the file of the same name as the +# source acting the same as the mv command. This might catch you out at +# some time, but can sometimes be useful. Perhaps better to try to be save +# than sorry. +# +function cp() +{ + last="echo \$$#" + last=`eval $last` + + if [ -d "$last" ] + then + check_not_overwrite_file_in_directory "$last" "$@" + if [ $? -eq 1 ] + then + /bin/cp "$@" + else + echo "Safe-cp by John Ryland" + echo "Looks like one of the files will overwrite a file in the destination directory" + echo "Bailing out just in case to save your arse \(files\)" + fi + return + fi + + if [ -f "$last" ] + then + echo "Safe-cp by John Ryland" + echo "NO NO NO... destination name is an existing file, you will overwrite it!!!" + echo "I suggest better to explicity delete the other file first." + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + /bin/cp "$@" + return + fi +} + + diff --git a/Scripts/setup_sites.sh b/Scripts/setup_sites.sh new file mode 100755 index 0000000..e9bd07c --- /dev/null +++ b/Scripts/setup_sites.sh @@ -0,0 +1,29 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_sites.sh +# +# USAGE: ./setup_sites.sh +# +# DESCRIPTION: Begin web development for invertedlogic on a new machine +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 15:18:21 CST +# REVISION: --- +#=============================================================================== + +if [ -e ./Sites ] +then + echo "Directory \"./Sites\" already exists, aborting" + echo "(try to rename the existing ./Sites dir to a new name first)" +else + # svn co --username web http://internal.invertedlogic.com/dev/web Sites + svn co svn+ssh://invertedlogic_internal@internal.invertedlogic.com/home/invertedlogic_internal/svn/web Sites +fi + diff --git a/Scripts/setup_ssh.sh b/Scripts/setup_ssh.sh new file mode 100755 index 0000000..5cc6e2c --- /dev/null +++ b/Scripts/setup_ssh.sh @@ -0,0 +1,35 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_ssh.sh +# +# USAGE: ./setup_ssh.sh server-address +# +# DESCRIPTION: Sets up password-less ssh login to another machine +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 31/07/2008 22:53:01 JST +# REVISION: --- +#=============================================================================== + +if [ "$1" == "" ] +then + echo "Usage $0 server-address" + exit 0 +fi + +if [ ! -f ~/.ssh/id_rsa.pub ] +then + echo | ssh-keygen -t rsa +fi + +scp ~/.ssh/id_rsa.pub $1:tmp.pub +ssh $1 'mkdir -p ~/.ssh ; chmod 700 ~/.ssh ; cat tmp.pub >> ~/.ssh/authorized_keys ; chmod 600 ~/.ssh/authorized_keys ; rm tmp.pub' + + diff --git a/Scripts/setup_vim.sh b/Scripts/setup_vim.sh new file mode 100755 index 0000000..fef5b76 --- /dev/null +++ b/Scripts/setup_vim.sh @@ -0,0 +1,65 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_vim.sh +# +# USAGE: ./setup_vim.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 19/08/2008 12:02:36 JST +# REVISION: --- +#=============================================================================== + +mkdir -p ~/Applications +# Current preference for this one over MacVim because it is faster to load and colors are better +curl http://macvim.org/OSX/files/binaries/OSX10.4/vim7.0.224.tar.bz2 > ./vim7.0.224.tar.bz2 + +# curl "http://repo.or.cz/w/MacVim.git?a=snapshot;h=bf2ed5675e67b37b748edfb86c9273adcba815b8;sf=tgz" > ./MacVim-src-1.2.tar.gz +# echo "MacVim Homepage at: http://code.google.com/p/macvim/" +# tar zxf ./MacVim-src-1.2.tar.gz +# cd MacVim/src +# touch auto/<###>.sh +# ./configure --enable-gui=MacVim +# make +# cd MacVim +# xcodebuild + +mkdir -p ~/.vim/.cache +cd ~/.vim/.cache +curl http://www.vim.org/scripts/download_script.php?src_id=7701 > ./taglist_45.zip +curl http://www.vim.org/scripts/download_script.php?src_id=9123 > ./bash-support.zip +curl http://www.vim.org/scripts/download_script.php?src_id=9141 > ./chlordane.vim +curl http://www.vim.org/scripts/download_script.php?src_id=7675 > ./headerguard-0.1.0.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7722 > ./omnicppcomplete-0.41.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7384 > ./code_complete.vim +curl http://www.vim.org/scripts/download_script.php?src_id=7461 > ./vimExplorer.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8830 > ./autoinclude.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8341 > ./renamec.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8029 > ./refactor.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8483 > ./doxygen-support.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7289 > ./rectcut.vim +curl http://www.vim.org/scripts/download_script.php?src_id=7877 > ./lusty-explorer.vim +curl http://www.vim.org/scripts/download_script.php?src_id=6878 > ./hints_man3.vba.gz +curl http://www.vim.org/scripts/download_script.php?src_id=8087 > ./echofunc.vim +curl http://www.vim.org/scripts/download_script.php?src_id=6682 > ./SnippetsMgr.zip +curl http://www.vim.org/scripts/download_script.php?src_id=8976 > ./NERD_tree.zip +curl http://www.vim.org/scripts/download_script.php?src_id=6181 > ./c_function_plugin.vim +curl http://www.vim.org/scripts/download_script.php?src_id=9145 > ./trinity.zip +curl http://www.vim.org/scripts/download_script.php?src_id=9144 > ./srcexpl.vim +curl http://www.vim.org/scripts/download_script.php?src_id=9146 > ./cvim.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7837 > ./lusty-juggler.vim + +cd .. +# unzip .cache/taglist_45.zip +# unzip .cache/bash-support.zip + + + diff --git a/Scripts/setup_www_svn/domain.sh b/Scripts/setup_www_svn/domain.sh new file mode 100755 index 0000000..d954544 --- /dev/null +++ b/Scripts/setup_www_svn/domain.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +DOMAIN=internal.invertedlogic.com + diff --git a/Scripts/setup_www_svn/publish.sh b/Scripts/setup_www_svn/publish.sh new file mode 100755 index 0000000..0737877 --- /dev/null +++ b/Scripts/setup_www_svn/publish.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +. ./domain.sh + +cd $DOMAIN +echo "Updating server" +svn up +echo "Updated server" + diff --git a/Scripts/setup_www_svn/setup.sh b/Scripts/setup_www_svn/setup.sh new file mode 100755 index 0000000..aa7bd9a --- /dev/null +++ b/Scripts/setup_www_svn/setup.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +. ./domain.sh + +if ! [ -d "$DOMAIN" ] +then + echo "Error, expecting directory to be here first from dreamhost setup" + echo "Go to dreamhost panel first and setup the sub-domain in this account" + echo -1 +fi + +cd "$DOMAIN" + +svn co --username web "http://internal.invertedlogic.com/dev/web/$DOMAIN" ./ + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/clean_exit.sh b/Scripts/clean_exit.sh new file mode 100755 index 0000000..f219da8 --- /dev/null +++ b/Scripts/clean_exit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Exit and wipe the entire bash history including removing that we did this command +# +rm ~/.bash_history ; kill -9 $PPID + + diff --git a/Scripts/code2pdf.sh b/Scripts/code2pdf.sh new file mode 100755 index 0000000..bc9b3d8 --- /dev/null +++ b/Scripts/code2pdf.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: code2pdf.sh +# +# USAGE: ./code2pdf.sh +# +# DESCRIPTION: Formats and converts a source code file to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 19/07/2008 19:31:39 CST +# REVISION: --- +#=============================================================================== + +vgrind $1 | pstopdf -i -o $1.pdf + diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh new file mode 100755 index 0000000..e8ac44a --- /dev/null +++ b/Scripts/convertToPDF.sh @@ -0,0 +1,27 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: convertToPDF.sh +# +# USAGE: ./convertToPDF.sh +# +# DESCRIPTION: Converts any file the OpenOffice can open to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/25/08 17:26:25 CST +# REVISION: --- +#=============================================================================== +if [ -f "$1" ] +then + echo "Converting \"$1\" to PDF" + /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\) +else + echo "Usage: $0 filename" +fi + diff --git a/Scripts/dos2unix.sh b/Scripts/dos2unix.sh new file mode 100755 index 0000000..653749b --- /dev/null +++ b/Scripts/dos2unix.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +################################################################## +# Based on d2u from http://www.geocities.com/usmbish/scripts.html +# (C) 2003 USM Bish +# Released under GNU GPL v2 - http://www.gnu.org/copyleft/gpl.html +################################################################## + +if [ $# -ne 2 ] +then + echo 1>&2 Usage: dos2unix [dosfile] [unixfile] + exit 1 +else + if ! [ -e $1 ] + then + echo "Error: $1 not found." + exit 1 + fi + if [ -e $2 ] + then + echo "Error: $2 already exists." + exit 1 + fi +fi + +cat $1 | tr -d '\015' > $2 + + diff --git a/Scripts/list.sh b/Scripts/list.sh new file mode 100755 index 0000000..d564162 --- /dev/null +++ b/Scripts/list.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: list.sh +# +# USAGE: ./list.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 06/21/08 10:11:00 CST +# REVISION: --- +#=============================================================================== + +for (( a=0 ; a != $1 ; a+=1 )) +do + echo 0000$a | sed "s/.*\([0-9][0-9][0-9]$\)/\1/" +done + diff --git a/Scripts/man.sh b/Scripts/man.sh new file mode 100755 index 0000000..35c2f28 --- /dev/null +++ b/Scripts/man.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +# http://www.macosxhints.com/article.php?story=200412080923108 +# +/usr/bin/osascript -e 'tell application "Safari" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Safari" to click menu item "New Tab" of menu "File" of menu bar item "File" of menu bar 1' +/usr/bin/open 'man:'$(/usr/bin/man -w $1 | /usr/bin/sed 's/\/.*\///') + diff --git a/Scripts/mkdmg.sh b/Scripts/mkdmg.sh new file mode 100755 index 0000000..c8d7e4c --- /dev/null +++ b/Scripts/mkdmg.sh @@ -0,0 +1,49 @@ +#!/bin/zsh +#=============================================================================== +# +# FILE: mkdmg.sh +# +# USAGE: ./mkdmg.sh +# +# DESCRIPTION: Script to take a Mac app and turn it in to a DMG package +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 16:54:36 CST +# REVISION: --- +#=============================================================================== +# +# Original script of this useful tool from here: +# http://www.kernelthread.com/mac/apme/archive/ +# +PATH=/bin:/sbin:/usr/bin:/usr/sbin +SCRATCH=./.mkdmg.$$$$ +error() +{ + echo "Error" + rm -rf $ + exit 1 +} +[ $ -ne 1 ] && echo "usage: mkdmg " && exit 1 +[ ! -e $ ] && echo "*** $ does not exist." && exit 1 +NAME=`basename $` +NAME="$" +ARCH="$ Archive" +IMAGE=$/$.dmg +OUTPUT="./$.dmg" +mkdir $ +echo "Creating disk image $..." +SIZE=`du -s -k $ | awk '{print $}'` || error +hdiutil create "$" -volname "$" -megabytes `expr 5 + $ / 1000` -type SPARSE -fs HFS+ > /dev/null 2>&1 || error +hdid $.sparseimage > /dev/null 2>&1 || error +ditto -rsrcFork $ "/Volumes/$/$" > /dev/null 2>&1 || error +hdiutil detach `mount | grep "Volumes/$" | awk '{print $}'` > /dev/null 2>&1 || error +hdiutil convert "$.sparseimage" -format UDZO -o $ -imagekey zlib-devel=9 > /dev/null 2>&1 || error +echo "Disk image $ ready" +rm -rf $ + diff --git a/Scripts/publish_xiaofrog.sh b/Scripts/publish_xiaofrog.sh new file mode 100755 index 0000000..43888b2 --- /dev/null +++ b/Scripts/publish_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: publish.sh +# +# USAGE: ./publish.sh +# +# DESCRIPTION: Prepare and then upload the web content to the website +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 19:30:43 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com /home/jryland/publish.sh + diff --git a/Scripts/renameTitle.pl b/Scripts/renameTitle.pl new file mode 100755 index 0000000..e6595a8 --- /dev/null +++ b/Scripts/renameTitle.pl @@ -0,0 +1,4 @@ +#!/usr/bin/perl +#dcop $KONSOLE_DCOP_SESSION renameSession "$@" +print "\033]30;".join(" ",@ARGV)."\007"; + diff --git a/Scripts/s60make.sh b/Scripts/s60make.sh new file mode 100755 index 0000000..846fdae --- /dev/null +++ b/Scripts/s60make.sh @@ -0,0 +1,31 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: s60make.sh +# +# USAGE: ./s60make.sh +# +# DESCRIPTION: Does all the steps to build a S60 app project +# Just uses a self signed certificate +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 07/05/08 22:41:18 CST +# REVISION: --- +#=============================================================================== +export EPOCROOT=~/opt/symbian-sdks/s60_32/ +export PATH=~/opt/symbian-eka2/bin/:$EPOCROOT/epoc32/tools:$PATH +cd group +bldmake bldfiles +abld build gcce urel +cd ../sis +makesis *_gcce.pkg test.sis +# makekeys -cert -expdays 3650 -password mykey.key mycert.cer +signsis test.sis test.sisx +/Applications/Utilities/Bluetooth\ File\ Exchange.app/Contents/MacOS/Bluetooth\ File\ Exchange ./test.sisx +cd .. + diff --git a/Scripts/scriptify.sh b/Scripts/scriptify.sh new file mode 100755 index 0000000..1c1a7f4 --- /dev/null +++ b/Scripts/scriptify.sh @@ -0,0 +1,26 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: scriptify.sh +# +# USAGE: ./scriptify.sh filename +# +# DESCRIPTION: Turns a file into bash script code for embedding in a script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: Filename can't have any slashs or funny characters in it +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 14:05:38 CST +# REVISION: --- +#=============================================================================== +cp $1 $1.sh +sed -i "" -e 's/\\/\\\\/g' $1.sh +sed -i "" -e 's/\$/\\\$/g' $1.sh +sed -i "" -e 's/"/\\"/g' $1.sh +sed -i "" -e 's/^/echo "/g' $1.sh +sed -i "" -e "s/\$/\" >> $1/g" $1.sh + diff --git a/Scripts/setup_profile.sh b/Scripts/setup_profile.sh new file mode 100755 index 0000000..0e3bfac --- /dev/null +++ b/Scripts/setup_profile.sh @@ -0,0 +1,250 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_profile.sh +# +# USAGE: ./setup_profile.sh +# +# DESCRIPTION: This is run from .profile and is a way to keep the settings +# and scripts together with the other scripts by calling it here +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (JR), (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 01/03/2008 00:46:55 JST +# REVISION: --- +#=============================================================================== + +export USER_NAME="John Ryland" +export USER_REF="JR" +export USER_EMAIL="(jryland@invertedlogic.com)" +export USER_COMPANY="InvertedLogic" +export PS1='\u@\h:$PWD \$ ' +export SVN_EDITOR=vi +export PATH=~/Code/Scripts/:~/usr/local/bin/:$PATH +export BASEDIR=~/Code/research/signals-slots + +# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH +# umask 002 + + +# JR - Make safe versions of rm, rmdir, unlink, mv etc +############################################################################## +# Make our environment safer from overwriting/deleting files by mistake # +############################################################################## + +# Used by safe versions of rm, rmdir and unlink +# Add to this function checks for any directories you don't want deleted so easily by mistake +function check_args() +{ + while [ $# -ne 0 ] + do + [ "$1" == "~" ] && return 0 + [ "$1" == "/" ] && return 0 + [ "$1" == "/Users" ] && return 0 + [ "$1" == "/Users/" ] && return 0 + [ "$1" == "/Users/jryland" ] && return 0 + [ "$1" == "/Users/jryland/" ] && return 0 + [ "$1" == "/Users/jryland/Code" ] && return 0 + [ "$1" == "/Users/jryland/Code/" ] && return 0 + [ "$1" == "/home" ] && return 0 + [ "$1" == "/home/" ] && return 0 + [ "$1" == "/home/jryland" ] && return 0 + [ "$1" == "/home/jryland/" ] && return 0 + [ "$1" == "/test/test" ] && return 0 + shift + done + return 1 +} + + +# +# I don't think I need to explain how the rm command can be dangerous +# +# Pretty obvious that "rm -rf /" can be a pretty devistating command to execute +# Or "rm -rf ~" is not very nice either. Guess what, before making this safe +# function, I had by mistake executed these 2 example commands before. +# Real dumb I know, but it really can happen. +# +# Senerio might be working on a +# remote system such as an embedded development device thats being tested +# and need a fresh home directory for running a test, wiping out the home +# directory on the target is easy with "rm -rf ~" if nothing valuable there. +# I've worked a lot on embedded targets with a telnet session from my PC. +# But if accidently type it in to the wrong terminal and disaster. When it +# most recently happened to me, the senario was another one. It was late at +# night and a little tired, and I had some poo files I was cleaning up after +# executing some commands that left behind some temporary files and also I +# saw a file named "~". When cleaning up these files I typed: +# +# "rm -rf blah.tmp ~ foo" +# +# I hit enter and a moment later when I thought that this is taking a bit +# longer than I expected, I realised, "oh crap"! and immediately hit ctrl-c. +# I was pretty lucky, mainly some .foo directories with thumbnails and cached +# data and unimportant stuff was erased, but this made me realise really how +# dangerous some commands are and I didn't want to make this same mistake +# again if it could be prevented easily which is what these functions are for. +# +# Yes, you should have backups too, but it doesn't hurt to have +# a safer working environment. +# +function rm() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/rm "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function unlink() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/unlink "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function rmdir() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/rmdir "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function check_not_overwrite_file_in_directory() +{ + dir=$1 + shift + while [ $# -ne 1 ] + do + # XXX need to check $1 doesn't start with '-' + [ -f "$dir/`basename $1`" ] && return 0 + shift + done + return 1 +} + + +# +# mv can be quite dangerous, imagine you type "mv *" and accidently hit +# enter before entering the directory to put the files to. It will mv +# all the files in to the last file name in the list which will mean +# that all files in the directory will be lost except the 2nd last one. +# Or just as bad, "mv * somename" where somename is the name of a +# directory but is mis-spelt, then all files except the last in the +# directory will be lost. +# +# Even you think you got it right, and the last argument is a directory +# name, what happens when you mv a file with a name that already exists +# in the destination directory? Yep, you guest it, puff, gone. +# +# And nearly always if moving multiple files and last argument is a filename +# or doesn't exist then it probably is not what is intented unless it +# is being used as a fancy way to delete some files while renaming another +# file at the same time, but I think that's a really really bad side +# effect to take advantage of and a pretty dumb idea in general. +# +function mv() +{ + last="echo \$$#" + last=`eval $last` + + if [ -d "$last" ] + then + check_not_overwrite_file_in_directory "$last" "$@" + if [ $? -eq 1 ] + then + /bin/mv "$@" + else + echo "Safe-mv by John Ryland" + echo "Looks like one of the files will overwrite a file in the destination directory" + echo "Bailing out just in case to save your arse \(files\)" + fi + return + fi + + if [ $# -gt 2 ] + then + echo "Safe-mv by John Ryland" + echo "Looks like you are wanting to move several files, but" + echo "NO NO NO... last argument is NOT a directory!!!" + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + if [ -f "$last" ] + then + echo "Safe-mv by John Ryland" + echo "NO NO NO... new name is an existing file, you will overwrite it!!!" + echo "I suggest better to explicity delete the other file first." + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + /bin/mv "$@" + return + fi + fi +} + + +# +# Similar problems occur for the cp command as mv, easily overwriting destination, +# if last argument is directory and file exists in destination directory, +# even if not explicitly given, overwrites the file of the same name as the +# source acting the same as the mv command. This might catch you out at +# some time, but can sometimes be useful. Perhaps better to try to be save +# than sorry. +# +function cp() +{ + last="echo \$$#" + last=`eval $last` + + if [ -d "$last" ] + then + check_not_overwrite_file_in_directory "$last" "$@" + if [ $? -eq 1 ] + then + /bin/cp "$@" + else + echo "Safe-cp by John Ryland" + echo "Looks like one of the files will overwrite a file in the destination directory" + echo "Bailing out just in case to save your arse \(files\)" + fi + return + fi + + if [ -f "$last" ] + then + echo "Safe-cp by John Ryland" + echo "NO NO NO... destination name is an existing file, you will overwrite it!!!" + echo "I suggest better to explicity delete the other file first." + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + /bin/cp "$@" + return + fi +} + + diff --git a/Scripts/setup_sites.sh b/Scripts/setup_sites.sh new file mode 100755 index 0000000..e9bd07c --- /dev/null +++ b/Scripts/setup_sites.sh @@ -0,0 +1,29 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_sites.sh +# +# USAGE: ./setup_sites.sh +# +# DESCRIPTION: Begin web development for invertedlogic on a new machine +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 15:18:21 CST +# REVISION: --- +#=============================================================================== + +if [ -e ./Sites ] +then + echo "Directory \"./Sites\" already exists, aborting" + echo "(try to rename the existing ./Sites dir to a new name first)" +else + # svn co --username web http://internal.invertedlogic.com/dev/web Sites + svn co svn+ssh://invertedlogic_internal@internal.invertedlogic.com/home/invertedlogic_internal/svn/web Sites +fi + diff --git a/Scripts/setup_ssh.sh b/Scripts/setup_ssh.sh new file mode 100755 index 0000000..5cc6e2c --- /dev/null +++ b/Scripts/setup_ssh.sh @@ -0,0 +1,35 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_ssh.sh +# +# USAGE: ./setup_ssh.sh server-address +# +# DESCRIPTION: Sets up password-less ssh login to another machine +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 31/07/2008 22:53:01 JST +# REVISION: --- +#=============================================================================== + +if [ "$1" == "" ] +then + echo "Usage $0 server-address" + exit 0 +fi + +if [ ! -f ~/.ssh/id_rsa.pub ] +then + echo | ssh-keygen -t rsa +fi + +scp ~/.ssh/id_rsa.pub $1:tmp.pub +ssh $1 'mkdir -p ~/.ssh ; chmod 700 ~/.ssh ; cat tmp.pub >> ~/.ssh/authorized_keys ; chmod 600 ~/.ssh/authorized_keys ; rm tmp.pub' + + diff --git a/Scripts/setup_vim.sh b/Scripts/setup_vim.sh new file mode 100755 index 0000000..fef5b76 --- /dev/null +++ b/Scripts/setup_vim.sh @@ -0,0 +1,65 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_vim.sh +# +# USAGE: ./setup_vim.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 19/08/2008 12:02:36 JST +# REVISION: --- +#=============================================================================== + +mkdir -p ~/Applications +# Current preference for this one over MacVim because it is faster to load and colors are better +curl http://macvim.org/OSX/files/binaries/OSX10.4/vim7.0.224.tar.bz2 > ./vim7.0.224.tar.bz2 + +# curl "http://repo.or.cz/w/MacVim.git?a=snapshot;h=bf2ed5675e67b37b748edfb86c9273adcba815b8;sf=tgz" > ./MacVim-src-1.2.tar.gz +# echo "MacVim Homepage at: http://code.google.com/p/macvim/" +# tar zxf ./MacVim-src-1.2.tar.gz +# cd MacVim/src +# touch auto/<###>.sh +# ./configure --enable-gui=MacVim +# make +# cd MacVim +# xcodebuild + +mkdir -p ~/.vim/.cache +cd ~/.vim/.cache +curl http://www.vim.org/scripts/download_script.php?src_id=7701 > ./taglist_45.zip +curl http://www.vim.org/scripts/download_script.php?src_id=9123 > ./bash-support.zip +curl http://www.vim.org/scripts/download_script.php?src_id=9141 > ./chlordane.vim +curl http://www.vim.org/scripts/download_script.php?src_id=7675 > ./headerguard-0.1.0.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7722 > ./omnicppcomplete-0.41.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7384 > ./code_complete.vim +curl http://www.vim.org/scripts/download_script.php?src_id=7461 > ./vimExplorer.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8830 > ./autoinclude.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8341 > ./renamec.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8029 > ./refactor.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8483 > ./doxygen-support.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7289 > ./rectcut.vim +curl http://www.vim.org/scripts/download_script.php?src_id=7877 > ./lusty-explorer.vim +curl http://www.vim.org/scripts/download_script.php?src_id=6878 > ./hints_man3.vba.gz +curl http://www.vim.org/scripts/download_script.php?src_id=8087 > ./echofunc.vim +curl http://www.vim.org/scripts/download_script.php?src_id=6682 > ./SnippetsMgr.zip +curl http://www.vim.org/scripts/download_script.php?src_id=8976 > ./NERD_tree.zip +curl http://www.vim.org/scripts/download_script.php?src_id=6181 > ./c_function_plugin.vim +curl http://www.vim.org/scripts/download_script.php?src_id=9145 > ./trinity.zip +curl http://www.vim.org/scripts/download_script.php?src_id=9144 > ./srcexpl.vim +curl http://www.vim.org/scripts/download_script.php?src_id=9146 > ./cvim.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7837 > ./lusty-juggler.vim + +cd .. +# unzip .cache/taglist_45.zip +# unzip .cache/bash-support.zip + + + diff --git a/Scripts/setup_www_svn/domain.sh b/Scripts/setup_www_svn/domain.sh new file mode 100755 index 0000000..d954544 --- /dev/null +++ b/Scripts/setup_www_svn/domain.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +DOMAIN=internal.invertedlogic.com + diff --git a/Scripts/setup_www_svn/publish.sh b/Scripts/setup_www_svn/publish.sh new file mode 100755 index 0000000..0737877 --- /dev/null +++ b/Scripts/setup_www_svn/publish.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +. ./domain.sh + +cd $DOMAIN +echo "Updating server" +svn up +echo "Updated server" + diff --git a/Scripts/setup_www_svn/setup.sh b/Scripts/setup_www_svn/setup.sh new file mode 100755 index 0000000..aa7bd9a --- /dev/null +++ b/Scripts/setup_www_svn/setup.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +. ./domain.sh + +if ! [ -d "$DOMAIN" ] +then + echo "Error, expecting directory to be here first from dreamhost setup" + echo "Go to dreamhost panel first and setup the sub-domain in this account" + echo -1 +fi + +cd "$DOMAIN" + +svn co --username web "http://internal.invertedlogic.com/dev/web/$DOMAIN" ./ + diff --git a/Scripts/sync.sh b/Scripts/sync.sh new file mode 100755 index 0000000..785b790 --- /dev/null +++ b/Scripts/sync.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: sync.sh +# +# USAGE: ./sync.sh +# +# DESCRIPTION: Syncs local files with the webserver +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 14:05:38 CST +# REVISION: --- +#=============================================================================== + +### rsync -avz ~/Sites/ kratos.dreamhost.com:~/sync/ + +# Deprecated using rsync for this... using SVN instead which has version control... it's a better way +#rsync -avz ~/Sites/xiaofrog.com/ xiaofrog.com:~/xiaofrog.com/ + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/clean_exit.sh b/Scripts/clean_exit.sh new file mode 100755 index 0000000..f219da8 --- /dev/null +++ b/Scripts/clean_exit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Exit and wipe the entire bash history including removing that we did this command +# +rm ~/.bash_history ; kill -9 $PPID + + diff --git a/Scripts/code2pdf.sh b/Scripts/code2pdf.sh new file mode 100755 index 0000000..bc9b3d8 --- /dev/null +++ b/Scripts/code2pdf.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: code2pdf.sh +# +# USAGE: ./code2pdf.sh +# +# DESCRIPTION: Formats and converts a source code file to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 19/07/2008 19:31:39 CST +# REVISION: --- +#=============================================================================== + +vgrind $1 | pstopdf -i -o $1.pdf + diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh new file mode 100755 index 0000000..e8ac44a --- /dev/null +++ b/Scripts/convertToPDF.sh @@ -0,0 +1,27 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: convertToPDF.sh +# +# USAGE: ./convertToPDF.sh +# +# DESCRIPTION: Converts any file the OpenOffice can open to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/25/08 17:26:25 CST +# REVISION: --- +#=============================================================================== +if [ -f "$1" ] +then + echo "Converting \"$1\" to PDF" + /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\) +else + echo "Usage: $0 filename" +fi + diff --git a/Scripts/dos2unix.sh b/Scripts/dos2unix.sh new file mode 100755 index 0000000..653749b --- /dev/null +++ b/Scripts/dos2unix.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +################################################################## +# Based on d2u from http://www.geocities.com/usmbish/scripts.html +# (C) 2003 USM Bish +# Released under GNU GPL v2 - http://www.gnu.org/copyleft/gpl.html +################################################################## + +if [ $# -ne 2 ] +then + echo 1>&2 Usage: dos2unix [dosfile] [unixfile] + exit 1 +else + if ! [ -e $1 ] + then + echo "Error: $1 not found." + exit 1 + fi + if [ -e $2 ] + then + echo "Error: $2 already exists." + exit 1 + fi +fi + +cat $1 | tr -d '\015' > $2 + + diff --git a/Scripts/list.sh b/Scripts/list.sh new file mode 100755 index 0000000..d564162 --- /dev/null +++ b/Scripts/list.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: list.sh +# +# USAGE: ./list.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 06/21/08 10:11:00 CST +# REVISION: --- +#=============================================================================== + +for (( a=0 ; a != $1 ; a+=1 )) +do + echo 0000$a | sed "s/.*\([0-9][0-9][0-9]$\)/\1/" +done + diff --git a/Scripts/man.sh b/Scripts/man.sh new file mode 100755 index 0000000..35c2f28 --- /dev/null +++ b/Scripts/man.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +# http://www.macosxhints.com/article.php?story=200412080923108 +# +/usr/bin/osascript -e 'tell application "Safari" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Safari" to click menu item "New Tab" of menu "File" of menu bar item "File" of menu bar 1' +/usr/bin/open 'man:'$(/usr/bin/man -w $1 | /usr/bin/sed 's/\/.*\///') + diff --git a/Scripts/mkdmg.sh b/Scripts/mkdmg.sh new file mode 100755 index 0000000..c8d7e4c --- /dev/null +++ b/Scripts/mkdmg.sh @@ -0,0 +1,49 @@ +#!/bin/zsh +#=============================================================================== +# +# FILE: mkdmg.sh +# +# USAGE: ./mkdmg.sh +# +# DESCRIPTION: Script to take a Mac app and turn it in to a DMG package +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 16:54:36 CST +# REVISION: --- +#=============================================================================== +# +# Original script of this useful tool from here: +# http://www.kernelthread.com/mac/apme/archive/ +# +PATH=/bin:/sbin:/usr/bin:/usr/sbin +SCRATCH=./.mkdmg.$$$$ +error() +{ + echo "Error" + rm -rf $ + exit 1 +} +[ $ -ne 1 ] && echo "usage: mkdmg " && exit 1 +[ ! -e $ ] && echo "*** $ does not exist." && exit 1 +NAME=`basename $` +NAME="$" +ARCH="$ Archive" +IMAGE=$/$.dmg +OUTPUT="./$.dmg" +mkdir $ +echo "Creating disk image $..." +SIZE=`du -s -k $ | awk '{print $}'` || error +hdiutil create "$" -volname "$" -megabytes `expr 5 + $ / 1000` -type SPARSE -fs HFS+ > /dev/null 2>&1 || error +hdid $.sparseimage > /dev/null 2>&1 || error +ditto -rsrcFork $ "/Volumes/$/$" > /dev/null 2>&1 || error +hdiutil detach `mount | grep "Volumes/$" | awk '{print $}'` > /dev/null 2>&1 || error +hdiutil convert "$.sparseimage" -format UDZO -o $ -imagekey zlib-devel=9 > /dev/null 2>&1 || error +echo "Disk image $ ready" +rm -rf $ + diff --git a/Scripts/publish_xiaofrog.sh b/Scripts/publish_xiaofrog.sh new file mode 100755 index 0000000..43888b2 --- /dev/null +++ b/Scripts/publish_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: publish.sh +# +# USAGE: ./publish.sh +# +# DESCRIPTION: Prepare and then upload the web content to the website +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 19:30:43 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com /home/jryland/publish.sh + diff --git a/Scripts/renameTitle.pl b/Scripts/renameTitle.pl new file mode 100755 index 0000000..e6595a8 --- /dev/null +++ b/Scripts/renameTitle.pl @@ -0,0 +1,4 @@ +#!/usr/bin/perl +#dcop $KONSOLE_DCOP_SESSION renameSession "$@" +print "\033]30;".join(" ",@ARGV)."\007"; + diff --git a/Scripts/s60make.sh b/Scripts/s60make.sh new file mode 100755 index 0000000..846fdae --- /dev/null +++ b/Scripts/s60make.sh @@ -0,0 +1,31 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: s60make.sh +# +# USAGE: ./s60make.sh +# +# DESCRIPTION: Does all the steps to build a S60 app project +# Just uses a self signed certificate +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 07/05/08 22:41:18 CST +# REVISION: --- +#=============================================================================== +export EPOCROOT=~/opt/symbian-sdks/s60_32/ +export PATH=~/opt/symbian-eka2/bin/:$EPOCROOT/epoc32/tools:$PATH +cd group +bldmake bldfiles +abld build gcce urel +cd ../sis +makesis *_gcce.pkg test.sis +# makekeys -cert -expdays 3650 -password mykey.key mycert.cer +signsis test.sis test.sisx +/Applications/Utilities/Bluetooth\ File\ Exchange.app/Contents/MacOS/Bluetooth\ File\ Exchange ./test.sisx +cd .. + diff --git a/Scripts/scriptify.sh b/Scripts/scriptify.sh new file mode 100755 index 0000000..1c1a7f4 --- /dev/null +++ b/Scripts/scriptify.sh @@ -0,0 +1,26 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: scriptify.sh +# +# USAGE: ./scriptify.sh filename +# +# DESCRIPTION: Turns a file into bash script code for embedding in a script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: Filename can't have any slashs or funny characters in it +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 14:05:38 CST +# REVISION: --- +#=============================================================================== +cp $1 $1.sh +sed -i "" -e 's/\\/\\\\/g' $1.sh +sed -i "" -e 's/\$/\\\$/g' $1.sh +sed -i "" -e 's/"/\\"/g' $1.sh +sed -i "" -e 's/^/echo "/g' $1.sh +sed -i "" -e "s/\$/\" >> $1/g" $1.sh + diff --git a/Scripts/setup_profile.sh b/Scripts/setup_profile.sh new file mode 100755 index 0000000..0e3bfac --- /dev/null +++ b/Scripts/setup_profile.sh @@ -0,0 +1,250 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_profile.sh +# +# USAGE: ./setup_profile.sh +# +# DESCRIPTION: This is run from .profile and is a way to keep the settings +# and scripts together with the other scripts by calling it here +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (JR), (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 01/03/2008 00:46:55 JST +# REVISION: --- +#=============================================================================== + +export USER_NAME="John Ryland" +export USER_REF="JR" +export USER_EMAIL="(jryland@invertedlogic.com)" +export USER_COMPANY="InvertedLogic" +export PS1='\u@\h:$PWD \$ ' +export SVN_EDITOR=vi +export PATH=~/Code/Scripts/:~/usr/local/bin/:$PATH +export BASEDIR=~/Code/research/signals-slots + +# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH +# umask 002 + + +# JR - Make safe versions of rm, rmdir, unlink, mv etc +############################################################################## +# Make our environment safer from overwriting/deleting files by mistake # +############################################################################## + +# Used by safe versions of rm, rmdir and unlink +# Add to this function checks for any directories you don't want deleted so easily by mistake +function check_args() +{ + while [ $# -ne 0 ] + do + [ "$1" == "~" ] && return 0 + [ "$1" == "/" ] && return 0 + [ "$1" == "/Users" ] && return 0 + [ "$1" == "/Users/" ] && return 0 + [ "$1" == "/Users/jryland" ] && return 0 + [ "$1" == "/Users/jryland/" ] && return 0 + [ "$1" == "/Users/jryland/Code" ] && return 0 + [ "$1" == "/Users/jryland/Code/" ] && return 0 + [ "$1" == "/home" ] && return 0 + [ "$1" == "/home/" ] && return 0 + [ "$1" == "/home/jryland" ] && return 0 + [ "$1" == "/home/jryland/" ] && return 0 + [ "$1" == "/test/test" ] && return 0 + shift + done + return 1 +} + + +# +# I don't think I need to explain how the rm command can be dangerous +# +# Pretty obvious that "rm -rf /" can be a pretty devistating command to execute +# Or "rm -rf ~" is not very nice either. Guess what, before making this safe +# function, I had by mistake executed these 2 example commands before. +# Real dumb I know, but it really can happen. +# +# Senerio might be working on a +# remote system such as an embedded development device thats being tested +# and need a fresh home directory for running a test, wiping out the home +# directory on the target is easy with "rm -rf ~" if nothing valuable there. +# I've worked a lot on embedded targets with a telnet session from my PC. +# But if accidently type it in to the wrong terminal and disaster. When it +# most recently happened to me, the senario was another one. It was late at +# night and a little tired, and I had some poo files I was cleaning up after +# executing some commands that left behind some temporary files and also I +# saw a file named "~". When cleaning up these files I typed: +# +# "rm -rf blah.tmp ~ foo" +# +# I hit enter and a moment later when I thought that this is taking a bit +# longer than I expected, I realised, "oh crap"! and immediately hit ctrl-c. +# I was pretty lucky, mainly some .foo directories with thumbnails and cached +# data and unimportant stuff was erased, but this made me realise really how +# dangerous some commands are and I didn't want to make this same mistake +# again if it could be prevented easily which is what these functions are for. +# +# Yes, you should have backups too, but it doesn't hurt to have +# a safer working environment. +# +function rm() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/rm "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function unlink() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/unlink "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function rmdir() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/rmdir "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function check_not_overwrite_file_in_directory() +{ + dir=$1 + shift + while [ $# -ne 1 ] + do + # XXX need to check $1 doesn't start with '-' + [ -f "$dir/`basename $1`" ] && return 0 + shift + done + return 1 +} + + +# +# mv can be quite dangerous, imagine you type "mv *" and accidently hit +# enter before entering the directory to put the files to. It will mv +# all the files in to the last file name in the list which will mean +# that all files in the directory will be lost except the 2nd last one. +# Or just as bad, "mv * somename" where somename is the name of a +# directory but is mis-spelt, then all files except the last in the +# directory will be lost. +# +# Even you think you got it right, and the last argument is a directory +# name, what happens when you mv a file with a name that already exists +# in the destination directory? Yep, you guest it, puff, gone. +# +# And nearly always if moving multiple files and last argument is a filename +# or doesn't exist then it probably is not what is intented unless it +# is being used as a fancy way to delete some files while renaming another +# file at the same time, but I think that's a really really bad side +# effect to take advantage of and a pretty dumb idea in general. +# +function mv() +{ + last="echo \$$#" + last=`eval $last` + + if [ -d "$last" ] + then + check_not_overwrite_file_in_directory "$last" "$@" + if [ $? -eq 1 ] + then + /bin/mv "$@" + else + echo "Safe-mv by John Ryland" + echo "Looks like one of the files will overwrite a file in the destination directory" + echo "Bailing out just in case to save your arse \(files\)" + fi + return + fi + + if [ $# -gt 2 ] + then + echo "Safe-mv by John Ryland" + echo "Looks like you are wanting to move several files, but" + echo "NO NO NO... last argument is NOT a directory!!!" + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + if [ -f "$last" ] + then + echo "Safe-mv by John Ryland" + echo "NO NO NO... new name is an existing file, you will overwrite it!!!" + echo "I suggest better to explicity delete the other file first." + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + /bin/mv "$@" + return + fi + fi +} + + +# +# Similar problems occur for the cp command as mv, easily overwriting destination, +# if last argument is directory and file exists in destination directory, +# even if not explicitly given, overwrites the file of the same name as the +# source acting the same as the mv command. This might catch you out at +# some time, but can sometimes be useful. Perhaps better to try to be save +# than sorry. +# +function cp() +{ + last="echo \$$#" + last=`eval $last` + + if [ -d "$last" ] + then + check_not_overwrite_file_in_directory "$last" "$@" + if [ $? -eq 1 ] + then + /bin/cp "$@" + else + echo "Safe-cp by John Ryland" + echo "Looks like one of the files will overwrite a file in the destination directory" + echo "Bailing out just in case to save your arse \(files\)" + fi + return + fi + + if [ -f "$last" ] + then + echo "Safe-cp by John Ryland" + echo "NO NO NO... destination name is an existing file, you will overwrite it!!!" + echo "I suggest better to explicity delete the other file first." + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + /bin/cp "$@" + return + fi +} + + diff --git a/Scripts/setup_sites.sh b/Scripts/setup_sites.sh new file mode 100755 index 0000000..e9bd07c --- /dev/null +++ b/Scripts/setup_sites.sh @@ -0,0 +1,29 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_sites.sh +# +# USAGE: ./setup_sites.sh +# +# DESCRIPTION: Begin web development for invertedlogic on a new machine +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 15:18:21 CST +# REVISION: --- +#=============================================================================== + +if [ -e ./Sites ] +then + echo "Directory \"./Sites\" already exists, aborting" + echo "(try to rename the existing ./Sites dir to a new name first)" +else + # svn co --username web http://internal.invertedlogic.com/dev/web Sites + svn co svn+ssh://invertedlogic_internal@internal.invertedlogic.com/home/invertedlogic_internal/svn/web Sites +fi + diff --git a/Scripts/setup_ssh.sh b/Scripts/setup_ssh.sh new file mode 100755 index 0000000..5cc6e2c --- /dev/null +++ b/Scripts/setup_ssh.sh @@ -0,0 +1,35 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_ssh.sh +# +# USAGE: ./setup_ssh.sh server-address +# +# DESCRIPTION: Sets up password-less ssh login to another machine +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 31/07/2008 22:53:01 JST +# REVISION: --- +#=============================================================================== + +if [ "$1" == "" ] +then + echo "Usage $0 server-address" + exit 0 +fi + +if [ ! -f ~/.ssh/id_rsa.pub ] +then + echo | ssh-keygen -t rsa +fi + +scp ~/.ssh/id_rsa.pub $1:tmp.pub +ssh $1 'mkdir -p ~/.ssh ; chmod 700 ~/.ssh ; cat tmp.pub >> ~/.ssh/authorized_keys ; chmod 600 ~/.ssh/authorized_keys ; rm tmp.pub' + + diff --git a/Scripts/setup_vim.sh b/Scripts/setup_vim.sh new file mode 100755 index 0000000..fef5b76 --- /dev/null +++ b/Scripts/setup_vim.sh @@ -0,0 +1,65 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_vim.sh +# +# USAGE: ./setup_vim.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 19/08/2008 12:02:36 JST +# REVISION: --- +#=============================================================================== + +mkdir -p ~/Applications +# Current preference for this one over MacVim because it is faster to load and colors are better +curl http://macvim.org/OSX/files/binaries/OSX10.4/vim7.0.224.tar.bz2 > ./vim7.0.224.tar.bz2 + +# curl "http://repo.or.cz/w/MacVim.git?a=snapshot;h=bf2ed5675e67b37b748edfb86c9273adcba815b8;sf=tgz" > ./MacVim-src-1.2.tar.gz +# echo "MacVim Homepage at: http://code.google.com/p/macvim/" +# tar zxf ./MacVim-src-1.2.tar.gz +# cd MacVim/src +# touch auto/<###>.sh +# ./configure --enable-gui=MacVim +# make +# cd MacVim +# xcodebuild + +mkdir -p ~/.vim/.cache +cd ~/.vim/.cache +curl http://www.vim.org/scripts/download_script.php?src_id=7701 > ./taglist_45.zip +curl http://www.vim.org/scripts/download_script.php?src_id=9123 > ./bash-support.zip +curl http://www.vim.org/scripts/download_script.php?src_id=9141 > ./chlordane.vim +curl http://www.vim.org/scripts/download_script.php?src_id=7675 > ./headerguard-0.1.0.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7722 > ./omnicppcomplete-0.41.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7384 > ./code_complete.vim +curl http://www.vim.org/scripts/download_script.php?src_id=7461 > ./vimExplorer.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8830 > ./autoinclude.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8341 > ./renamec.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8029 > ./refactor.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8483 > ./doxygen-support.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7289 > ./rectcut.vim +curl http://www.vim.org/scripts/download_script.php?src_id=7877 > ./lusty-explorer.vim +curl http://www.vim.org/scripts/download_script.php?src_id=6878 > ./hints_man3.vba.gz +curl http://www.vim.org/scripts/download_script.php?src_id=8087 > ./echofunc.vim +curl http://www.vim.org/scripts/download_script.php?src_id=6682 > ./SnippetsMgr.zip +curl http://www.vim.org/scripts/download_script.php?src_id=8976 > ./NERD_tree.zip +curl http://www.vim.org/scripts/download_script.php?src_id=6181 > ./c_function_plugin.vim +curl http://www.vim.org/scripts/download_script.php?src_id=9145 > ./trinity.zip +curl http://www.vim.org/scripts/download_script.php?src_id=9144 > ./srcexpl.vim +curl http://www.vim.org/scripts/download_script.php?src_id=9146 > ./cvim.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7837 > ./lusty-juggler.vim + +cd .. +# unzip .cache/taglist_45.zip +# unzip .cache/bash-support.zip + + + diff --git a/Scripts/setup_www_svn/domain.sh b/Scripts/setup_www_svn/domain.sh new file mode 100755 index 0000000..d954544 --- /dev/null +++ b/Scripts/setup_www_svn/domain.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +DOMAIN=internal.invertedlogic.com + diff --git a/Scripts/setup_www_svn/publish.sh b/Scripts/setup_www_svn/publish.sh new file mode 100755 index 0000000..0737877 --- /dev/null +++ b/Scripts/setup_www_svn/publish.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +. ./domain.sh + +cd $DOMAIN +echo "Updating server" +svn up +echo "Updated server" + diff --git a/Scripts/setup_www_svn/setup.sh b/Scripts/setup_www_svn/setup.sh new file mode 100755 index 0000000..aa7bd9a --- /dev/null +++ b/Scripts/setup_www_svn/setup.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +. ./domain.sh + +if ! [ -d "$DOMAIN" ] +then + echo "Error, expecting directory to be here first from dreamhost setup" + echo "Go to dreamhost panel first and setup the sub-domain in this account" + echo -1 +fi + +cd "$DOMAIN" + +svn co --username web "http://internal.invertedlogic.com/dev/web/$DOMAIN" ./ + diff --git a/Scripts/sync.sh b/Scripts/sync.sh new file mode 100755 index 0000000..785b790 --- /dev/null +++ b/Scripts/sync.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: sync.sh +# +# USAGE: ./sync.sh +# +# DESCRIPTION: Syncs local files with the webserver +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 14:05:38 CST +# REVISION: --- +#=============================================================================== + +### rsync -avz ~/Sites/ kratos.dreamhost.com:~/sync/ + +# Deprecated using rsync for this... using SVN instead which has version control... it's a better way +#rsync -avz ~/Sites/xiaofrog.com/ xiaofrog.com:~/xiaofrog.com/ + diff --git a/Scripts/total_linked_size.sh b/Scripts/total_linked_size.sh new file mode 100755 index 0000000..0861f9f --- /dev/null +++ b/Scripts/total_linked_size.sh @@ -0,0 +1,40 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: total_linked_size.sh +# +# USAGE: ./total_linked_size.sh +# +# DESCRIPTION: (MacOSX only) This program tries to determine the +# total size of all the linked libraries that an +# executable uses. It requires that you first run +# the program through ktrace to get a ktrace.out file +# It doesn't add the size of the application binary itself +# to the total and it possibly includes system libraries +# in the total count +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 06/25/08 15:25:29 CST +# REVISION: --- +#=============================================================================== + +#echo buggy - needs to work out the column positions to cut from better +if [ -f ktrace.out ] +then + #APP=`kdump -f ktrace.out | grep dylib | grep NAMI | grep -v "System" | sort | uniq | xargs ls -la 2> /dev/null | cut -c 27-37 | sed 's/^/a ; a\+=/g' | bc | tail -n 1` + #TOTAL=`kdump -f ktrace.out | grep dylib | grep NAMI | sort | uniq | xargs ls -la 2> /dev/null | cut -c 27-37 | sed 's/^/a ; a\+=/g' | bc | tail -n 1` + APP=`kdump -f ktrace.out | grep dylib | grep NAMI | grep -v "System" | sort | uniq | xargs ls -la 2> /dev/null | cut -c 34-41 | sed 's/^/a ; a\+=/g' | bc | tail -n 1` + TOTAL=`kdump -f ktrace.out | grep dylib | grep NAMI | sort | uniq | xargs ls -la 2> /dev/null | cut -c 34-41 | sed 's/^/a ; a\+=/g' | bc | tail -n 1` + echo "Calculated the following:" + echo " Application links with a total of $TOTAL bytes of dynamic libraries" + echo " Application links with a total of $APP bytes of dynamic libraries (excluding system libraries)" +else + echo "Run the program with ktrace first to get a ktrace.out file" +fi + diff --git a/Scripts/_all.sh b/Scripts/_all.sh new file mode 100755 index 0000000..e0ab11e --- /dev/null +++ b/Scripts/_all.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _all.sh +# +# USAGE: ./_all.sh +# +# DESCRIPTION: Executes commands on remote machines listed in this script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/28/08 03:19:58 CST +# REVISION: --- +#=============================================================================== + +SERVERS="jryland@www.invertedlogic.com svn_cgi_user@svn.invertedlogic.com" + +for host in $SERVERS +do + echo Executing: host="$host" cmd="$@" + ssh $host $@ +done + diff --git a/Scripts/_invertedlogic.sh b/Scripts/_invertedlogic.sh new file mode 100755 index 0000000..b8bfb70 --- /dev/null +++ b/Scripts/_invertedlogic.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_internal@www.invertedlogic.com + diff --git a/Scripts/_svn.sh b/Scripts/_svn.sh new file mode 100755 index 0000000..3463f42 --- /dev/null +++ b/Scripts/_svn.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _svn.sh +# +# USAGE: _svn.sh +# +# DESCRIPTION: Log in to SVN server as user svn_cgi_user +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh svn_cgi_user@svn.invertedlogic.com + diff --git a/Scripts/_willow.sh b/Scripts/_willow.sh new file mode 100755 index 0000000..b985008 --- /dev/null +++ b/Scripts/_willow.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _willow.sh +# +# USAGE: _willow.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@192.168.0.4 + diff --git a/Scripts/_www.sh b/Scripts/_www.sh new file mode 100755 index 0000000..c296acd --- /dev/null +++ b/Scripts/_www.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _invertedlogic.sh +# +# USAGE: _invertedlogic.sh +# +# DESCRIPTION: Log in to WWW server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh invertedlogic_public@www.invertedlogic.com + diff --git a/Scripts/_xiaofrog.sh b/Scripts/_xiaofrog.sh new file mode 100755 index 0000000..68e7f13 --- /dev/null +++ b/Scripts/_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: _xiaofrog.sh +# +# USAGE: _xiaofrog.sh +# +# DESCRIPTION: Log in to local server as user jryland +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/16/08 12:23:23 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com + diff --git a/Scripts/automailer.txt b/Scripts/automailer.txt new file mode 100644 index 0000000..6e6cee6 --- /dev/null +++ b/Scripts/automailer.txt @@ -0,0 +1,37 @@ +Howto do auto-mailing +--------------------- + +make file like this: + +/root/automailer/weekly.sh + +#!/bin/bash + +TO_ADDRESS=list@domain.com +FROM_ADDRESS=sender@blah.com + +/usr/bin/mail $TO_ADDRESS << EOF +~s Auto-generated reminder +~R $FROM_ADDRESS + +Hi Guys, + +Message + +-- +Regards +Sender + +EOF + +Then edit your crontab with: + +crontab -e + +An editor should appear, for weekly running of the script on fridays, do something like this: + +0 0 * * 5 /bin/sh /root/automailer/weekly.sh + +And there you have it + + diff --git a/Scripts/backup.sh b/Scripts/backup.sh new file mode 100755 index 0000000..2b09cfa --- /dev/null +++ b/Scripts/backup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/usr/bin/osascript -e 'tell application "Address Book" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Select All" of menu "Edit" of menu bar item "Edit" of menu bar 1' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Address Book" to click menu item "Export vCard..." of menu "File" of menu bar item "File" of menu bar 1' + + + diff --git a/Scripts/checkbookmarks.sh b/Scripts/checkbookmarks.sh new file mode 100755 index 0000000..3299b9e --- /dev/null +++ b/Scripts/checkbookmarks.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: checkbookmarks.sh +# +# USAGE: ./checkbookmarks.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/21/08 12:39:19 CST +# REVISION: --- +#=============================================================================== + +plutil -convert xml1 -o /tmp/.safari_bookmarks.xml ~/Library/Safari/Bookmarks.plist + +# need to convert the xml to html for the purposes of wget to understand it + +wget --spider --force-html -i /tmp/.safari_bookmarks.xml +#wget --spider --force-html -i bookmarks.html + + diff --git a/Scripts/clean_exit.sh b/Scripts/clean_exit.sh new file mode 100755 index 0000000..f219da8 --- /dev/null +++ b/Scripts/clean_exit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Exit and wipe the entire bash history including removing that we did this command +# +rm ~/.bash_history ; kill -9 $PPID + + diff --git a/Scripts/code2pdf.sh b/Scripts/code2pdf.sh new file mode 100755 index 0000000..bc9b3d8 --- /dev/null +++ b/Scripts/code2pdf.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: code2pdf.sh +# +# USAGE: ./code2pdf.sh +# +# DESCRIPTION: Formats and converts a source code file to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 19/07/2008 19:31:39 CST +# REVISION: --- +#=============================================================================== + +vgrind $1 | pstopdf -i -o $1.pdf + diff --git a/Scripts/convertToPDF.sh b/Scripts/convertToPDF.sh new file mode 100755 index 0000000..e8ac44a --- /dev/null +++ b/Scripts/convertToPDF.sh @@ -0,0 +1,27 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: convertToPDF.sh +# +# USAGE: ./convertToPDF.sh +# +# DESCRIPTION: Converts any file the OpenOffice can open to a PDF file +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/25/08 17:26:25 CST +# REVISION: --- +#=============================================================================== +if [ -f "$1" ] +then + echo "Converting \"$1\" to PDF" + /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\) +else + echo "Usage: $0 filename" +fi + diff --git a/Scripts/dos2unix.sh b/Scripts/dos2unix.sh new file mode 100755 index 0000000..653749b --- /dev/null +++ b/Scripts/dos2unix.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +################################################################## +# Based on d2u from http://www.geocities.com/usmbish/scripts.html +# (C) 2003 USM Bish +# Released under GNU GPL v2 - http://www.gnu.org/copyleft/gpl.html +################################################################## + +if [ $# -ne 2 ] +then + echo 1>&2 Usage: dos2unix [dosfile] [unixfile] + exit 1 +else + if ! [ -e $1 ] + then + echo "Error: $1 not found." + exit 1 + fi + if [ -e $2 ] + then + echo "Error: $2 already exists." + exit 1 + fi +fi + +cat $1 | tr -d '\015' > $2 + + diff --git a/Scripts/list.sh b/Scripts/list.sh new file mode 100755 index 0000000..d564162 --- /dev/null +++ b/Scripts/list.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: list.sh +# +# USAGE: ./list.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 06/21/08 10:11:00 CST +# REVISION: --- +#=============================================================================== + +for (( a=0 ; a != $1 ; a+=1 )) +do + echo 0000$a | sed "s/.*\([0-9][0-9][0-9]$\)/\1/" +done + diff --git a/Scripts/man.sh b/Scripts/man.sh new file mode 100755 index 0000000..35c2f28 --- /dev/null +++ b/Scripts/man.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +# http://www.macosxhints.com/article.php?story=200412080923108 +# +/usr/bin/osascript -e 'tell application "Safari" to activate' +/usr/bin/osascript -e 'tell application "System Events" to tell application process "Safari" to click menu item "New Tab" of menu "File" of menu bar item "File" of menu bar 1' +/usr/bin/open 'man:'$(/usr/bin/man -w $1 | /usr/bin/sed 's/\/.*\///') + diff --git a/Scripts/mkdmg.sh b/Scripts/mkdmg.sh new file mode 100755 index 0000000..c8d7e4c --- /dev/null +++ b/Scripts/mkdmg.sh @@ -0,0 +1,49 @@ +#!/bin/zsh +#=============================================================================== +# +# FILE: mkdmg.sh +# +# USAGE: ./mkdmg.sh +# +# DESCRIPTION: Script to take a Mac app and turn it in to a DMG package +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 16:54:36 CST +# REVISION: --- +#=============================================================================== +# +# Original script of this useful tool from here: +# http://www.kernelthread.com/mac/apme/archive/ +# +PATH=/bin:/sbin:/usr/bin:/usr/sbin +SCRATCH=./.mkdmg.$$$$ +error() +{ + echo "Error" + rm -rf $ + exit 1 +} +[ $ -ne 1 ] && echo "usage: mkdmg " && exit 1 +[ ! -e $ ] && echo "*** $ does not exist." && exit 1 +NAME=`basename $` +NAME="$" +ARCH="$ Archive" +IMAGE=$/$.dmg +OUTPUT="./$.dmg" +mkdir $ +echo "Creating disk image $..." +SIZE=`du -s -k $ | awk '{print $}'` || error +hdiutil create "$" -volname "$" -megabytes `expr 5 + $ / 1000` -type SPARSE -fs HFS+ > /dev/null 2>&1 || error +hdid $.sparseimage > /dev/null 2>&1 || error +ditto -rsrcFork $ "/Volumes/$/$" > /dev/null 2>&1 || error +hdiutil detach `mount | grep "Volumes/$" | awk '{print $}'` > /dev/null 2>&1 || error +hdiutil convert "$.sparseimage" -format UDZO -o $ -imagekey zlib-devel=9 > /dev/null 2>&1 || error +echo "Disk image $ ready" +rm -rf $ + diff --git a/Scripts/publish_xiaofrog.sh b/Scripts/publish_xiaofrog.sh new file mode 100755 index 0000000..43888b2 --- /dev/null +++ b/Scripts/publish_xiaofrog.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: publish.sh +# +# USAGE: ./publish.sh +# +# DESCRIPTION: Prepare and then upload the web content to the website +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 19:30:43 CST +# REVISION: --- +#=============================================================================== + +ssh jryland@www.xiaofrog.com /home/jryland/publish.sh + diff --git a/Scripts/renameTitle.pl b/Scripts/renameTitle.pl new file mode 100755 index 0000000..e6595a8 --- /dev/null +++ b/Scripts/renameTitle.pl @@ -0,0 +1,4 @@ +#!/usr/bin/perl +#dcop $KONSOLE_DCOP_SESSION renameSession "$@" +print "\033]30;".join(" ",@ARGV)."\007"; + diff --git a/Scripts/s60make.sh b/Scripts/s60make.sh new file mode 100755 index 0000000..846fdae --- /dev/null +++ b/Scripts/s60make.sh @@ -0,0 +1,31 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: s60make.sh +# +# USAGE: ./s60make.sh +# +# DESCRIPTION: Does all the steps to build a S60 app project +# Just uses a self signed certificate +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 07/05/08 22:41:18 CST +# REVISION: --- +#=============================================================================== +export EPOCROOT=~/opt/symbian-sdks/s60_32/ +export PATH=~/opt/symbian-eka2/bin/:$EPOCROOT/epoc32/tools:$PATH +cd group +bldmake bldfiles +abld build gcce urel +cd ../sis +makesis *_gcce.pkg test.sis +# makekeys -cert -expdays 3650 -password mykey.key mycert.cer +signsis test.sis test.sisx +/Applications/Utilities/Bluetooth\ File\ Exchange.app/Contents/MacOS/Bluetooth\ File\ Exchange ./test.sisx +cd .. + diff --git a/Scripts/scriptify.sh b/Scripts/scriptify.sh new file mode 100755 index 0000000..1c1a7f4 --- /dev/null +++ b/Scripts/scriptify.sh @@ -0,0 +1,26 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: scriptify.sh +# +# USAGE: ./scriptify.sh filename +# +# DESCRIPTION: Turns a file into bash script code for embedding in a script +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: Filename can't have any slashs or funny characters in it +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 14:05:38 CST +# REVISION: --- +#=============================================================================== +cp $1 $1.sh +sed -i "" -e 's/\\/\\\\/g' $1.sh +sed -i "" -e 's/\$/\\\$/g' $1.sh +sed -i "" -e 's/"/\\"/g' $1.sh +sed -i "" -e 's/^/echo "/g' $1.sh +sed -i "" -e "s/\$/\" >> $1/g" $1.sh + diff --git a/Scripts/setup_profile.sh b/Scripts/setup_profile.sh new file mode 100755 index 0000000..0e3bfac --- /dev/null +++ b/Scripts/setup_profile.sh @@ -0,0 +1,250 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_profile.sh +# +# USAGE: ./setup_profile.sh +# +# DESCRIPTION: This is run from .profile and is a way to keep the settings +# and scripts together with the other scripts by calling it here +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (JR), (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 01/03/2008 00:46:55 JST +# REVISION: --- +#=============================================================================== + +export USER_NAME="John Ryland" +export USER_REF="JR" +export USER_EMAIL="(jryland@invertedlogic.com)" +export USER_COMPANY="InvertedLogic" +export PS1='\u@\h:$PWD \$ ' +export SVN_EDITOR=vi +export PATH=~/Code/Scripts/:~/usr/local/bin/:$PATH +export BASEDIR=~/Code/research/signals-slots + +# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH +# umask 002 + + +# JR - Make safe versions of rm, rmdir, unlink, mv etc +############################################################################## +# Make our environment safer from overwriting/deleting files by mistake # +############################################################################## + +# Used by safe versions of rm, rmdir and unlink +# Add to this function checks for any directories you don't want deleted so easily by mistake +function check_args() +{ + while [ $# -ne 0 ] + do + [ "$1" == "~" ] && return 0 + [ "$1" == "/" ] && return 0 + [ "$1" == "/Users" ] && return 0 + [ "$1" == "/Users/" ] && return 0 + [ "$1" == "/Users/jryland" ] && return 0 + [ "$1" == "/Users/jryland/" ] && return 0 + [ "$1" == "/Users/jryland/Code" ] && return 0 + [ "$1" == "/Users/jryland/Code/" ] && return 0 + [ "$1" == "/home" ] && return 0 + [ "$1" == "/home/" ] && return 0 + [ "$1" == "/home/jryland" ] && return 0 + [ "$1" == "/home/jryland/" ] && return 0 + [ "$1" == "/test/test" ] && return 0 + shift + done + return 1 +} + + +# +# I don't think I need to explain how the rm command can be dangerous +# +# Pretty obvious that "rm -rf /" can be a pretty devistating command to execute +# Or "rm -rf ~" is not very nice either. Guess what, before making this safe +# function, I had by mistake executed these 2 example commands before. +# Real dumb I know, but it really can happen. +# +# Senerio might be working on a +# remote system such as an embedded development device thats being tested +# and need a fresh home directory for running a test, wiping out the home +# directory on the target is easy with "rm -rf ~" if nothing valuable there. +# I've worked a lot on embedded targets with a telnet session from my PC. +# But if accidently type it in to the wrong terminal and disaster. When it +# most recently happened to me, the senario was another one. It was late at +# night and a little tired, and I had some poo files I was cleaning up after +# executing some commands that left behind some temporary files and also I +# saw a file named "~". When cleaning up these files I typed: +# +# "rm -rf blah.tmp ~ foo" +# +# I hit enter and a moment later when I thought that this is taking a bit +# longer than I expected, I realised, "oh crap"! and immediately hit ctrl-c. +# I was pretty lucky, mainly some .foo directories with thumbnails and cached +# data and unimportant stuff was erased, but this made me realise really how +# dangerous some commands are and I didn't want to make this same mistake +# again if it could be prevented easily which is what these functions are for. +# +# Yes, you should have backups too, but it doesn't hurt to have +# a safer working environment. +# +function rm() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/rm "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function unlink() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/unlink "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function rmdir() +{ + check_args "$@" + if [ $? -eq 1 ] + then + /bin/rmdir "$@" + else + echo "Bailing out - Contains an unsafe argument" + fi +} + + +function check_not_overwrite_file_in_directory() +{ + dir=$1 + shift + while [ $# -ne 1 ] + do + # XXX need to check $1 doesn't start with '-' + [ -f "$dir/`basename $1`" ] && return 0 + shift + done + return 1 +} + + +# +# mv can be quite dangerous, imagine you type "mv *" and accidently hit +# enter before entering the directory to put the files to. It will mv +# all the files in to the last file name in the list which will mean +# that all files in the directory will be lost except the 2nd last one. +# Or just as bad, "mv * somename" where somename is the name of a +# directory but is mis-spelt, then all files except the last in the +# directory will be lost. +# +# Even you think you got it right, and the last argument is a directory +# name, what happens when you mv a file with a name that already exists +# in the destination directory? Yep, you guest it, puff, gone. +# +# And nearly always if moving multiple files and last argument is a filename +# or doesn't exist then it probably is not what is intented unless it +# is being used as a fancy way to delete some files while renaming another +# file at the same time, but I think that's a really really bad side +# effect to take advantage of and a pretty dumb idea in general. +# +function mv() +{ + last="echo \$$#" + last=`eval $last` + + if [ -d "$last" ] + then + check_not_overwrite_file_in_directory "$last" "$@" + if [ $? -eq 1 ] + then + /bin/mv "$@" + else + echo "Safe-mv by John Ryland" + echo "Looks like one of the files will overwrite a file in the destination directory" + echo "Bailing out just in case to save your arse \(files\)" + fi + return + fi + + if [ $# -gt 2 ] + then + echo "Safe-mv by John Ryland" + echo "Looks like you are wanting to move several files, but" + echo "NO NO NO... last argument is NOT a directory!!!" + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + if [ -f "$last" ] + then + echo "Safe-mv by John Ryland" + echo "NO NO NO... new name is an existing file, you will overwrite it!!!" + echo "I suggest better to explicity delete the other file first." + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + /bin/mv "$@" + return + fi + fi +} + + +# +# Similar problems occur for the cp command as mv, easily overwriting destination, +# if last argument is directory and file exists in destination directory, +# even if not explicitly given, overwrites the file of the same name as the +# source acting the same as the mv command. This might catch you out at +# some time, but can sometimes be useful. Perhaps better to try to be save +# than sorry. +# +function cp() +{ + last="echo \$$#" + last=`eval $last` + + if [ -d "$last" ] + then + check_not_overwrite_file_in_directory "$last" "$@" + if [ $? -eq 1 ] + then + /bin/cp "$@" + else + echo "Safe-cp by John Ryland" + echo "Looks like one of the files will overwrite a file in the destination directory" + echo "Bailing out just in case to save your arse \(files\)" + fi + return + fi + + if [ -f "$last" ] + then + echo "Safe-cp by John Ryland" + echo "NO NO NO... destination name is an existing file, you will overwrite it!!!" + echo "I suggest better to explicity delete the other file first." + echo "Bailing out just in case to save your arse \(files\)" + echo "Send your donations to .... \$-)" + return + else + /bin/cp "$@" + return + fi +} + + diff --git a/Scripts/setup_sites.sh b/Scripts/setup_sites.sh new file mode 100755 index 0000000..e9bd07c --- /dev/null +++ b/Scripts/setup_sites.sh @@ -0,0 +1,29 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_sites.sh +# +# USAGE: ./setup_sites.sh +# +# DESCRIPTION: Begin web development for invertedlogic on a new machine +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 06/29/08 15:18:21 CST +# REVISION: --- +#=============================================================================== + +if [ -e ./Sites ] +then + echo "Directory \"./Sites\" already exists, aborting" + echo "(try to rename the existing ./Sites dir to a new name first)" +else + # svn co --username web http://internal.invertedlogic.com/dev/web Sites + svn co svn+ssh://invertedlogic_internal@internal.invertedlogic.com/home/invertedlogic_internal/svn/web Sites +fi + diff --git a/Scripts/setup_ssh.sh b/Scripts/setup_ssh.sh new file mode 100755 index 0000000..5cc6e2c --- /dev/null +++ b/Scripts/setup_ssh.sh @@ -0,0 +1,35 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_ssh.sh +# +# USAGE: ./setup_ssh.sh server-address +# +# DESCRIPTION: Sets up password-less ssh login to another machine +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 31/07/2008 22:53:01 JST +# REVISION: --- +#=============================================================================== + +if [ "$1" == "" ] +then + echo "Usage $0 server-address" + exit 0 +fi + +if [ ! -f ~/.ssh/id_rsa.pub ] +then + echo | ssh-keygen -t rsa +fi + +scp ~/.ssh/id_rsa.pub $1:tmp.pub +ssh $1 'mkdir -p ~/.ssh ; chmod 700 ~/.ssh ; cat tmp.pub >> ~/.ssh/authorized_keys ; chmod 600 ~/.ssh/authorized_keys ; rm tmp.pub' + + diff --git a/Scripts/setup_vim.sh b/Scripts/setup_vim.sh new file mode 100755 index 0000000..fef5b76 --- /dev/null +++ b/Scripts/setup_vim.sh @@ -0,0 +1,65 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: setup_vim.sh +# +# USAGE: ./setup_vim.sh +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 19/08/2008 12:02:36 JST +# REVISION: --- +#=============================================================================== + +mkdir -p ~/Applications +# Current preference for this one over MacVim because it is faster to load and colors are better +curl http://macvim.org/OSX/files/binaries/OSX10.4/vim7.0.224.tar.bz2 > ./vim7.0.224.tar.bz2 + +# curl "http://repo.or.cz/w/MacVim.git?a=snapshot;h=bf2ed5675e67b37b748edfb86c9273adcba815b8;sf=tgz" > ./MacVim-src-1.2.tar.gz +# echo "MacVim Homepage at: http://code.google.com/p/macvim/" +# tar zxf ./MacVim-src-1.2.tar.gz +# cd MacVim/src +# touch auto/<###>.sh +# ./configure --enable-gui=MacVim +# make +# cd MacVim +# xcodebuild + +mkdir -p ~/.vim/.cache +cd ~/.vim/.cache +curl http://www.vim.org/scripts/download_script.php?src_id=7701 > ./taglist_45.zip +curl http://www.vim.org/scripts/download_script.php?src_id=9123 > ./bash-support.zip +curl http://www.vim.org/scripts/download_script.php?src_id=9141 > ./chlordane.vim +curl http://www.vim.org/scripts/download_script.php?src_id=7675 > ./headerguard-0.1.0.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7722 > ./omnicppcomplete-0.41.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7384 > ./code_complete.vim +curl http://www.vim.org/scripts/download_script.php?src_id=7461 > ./vimExplorer.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8830 > ./autoinclude.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8341 > ./renamec.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8029 > ./refactor.vim +curl http://www.vim.org/scripts/download_script.php?src_id=8483 > ./doxygen-support.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7289 > ./rectcut.vim +curl http://www.vim.org/scripts/download_script.php?src_id=7877 > ./lusty-explorer.vim +curl http://www.vim.org/scripts/download_script.php?src_id=6878 > ./hints_man3.vba.gz +curl http://www.vim.org/scripts/download_script.php?src_id=8087 > ./echofunc.vim +curl http://www.vim.org/scripts/download_script.php?src_id=6682 > ./SnippetsMgr.zip +curl http://www.vim.org/scripts/download_script.php?src_id=8976 > ./NERD_tree.zip +curl http://www.vim.org/scripts/download_script.php?src_id=6181 > ./c_function_plugin.vim +curl http://www.vim.org/scripts/download_script.php?src_id=9145 > ./trinity.zip +curl http://www.vim.org/scripts/download_script.php?src_id=9144 > ./srcexpl.vim +curl http://www.vim.org/scripts/download_script.php?src_id=9146 > ./cvim.zip +curl http://www.vim.org/scripts/download_script.php?src_id=7837 > ./lusty-juggler.vim + +cd .. +# unzip .cache/taglist_45.zip +# unzip .cache/bash-support.zip + + + diff --git a/Scripts/setup_www_svn/domain.sh b/Scripts/setup_www_svn/domain.sh new file mode 100755 index 0000000..d954544 --- /dev/null +++ b/Scripts/setup_www_svn/domain.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +DOMAIN=internal.invertedlogic.com + diff --git a/Scripts/setup_www_svn/publish.sh b/Scripts/setup_www_svn/publish.sh new file mode 100755 index 0000000..0737877 --- /dev/null +++ b/Scripts/setup_www_svn/publish.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +. ./domain.sh + +cd $DOMAIN +echo "Updating server" +svn up +echo "Updated server" + diff --git a/Scripts/setup_www_svn/setup.sh b/Scripts/setup_www_svn/setup.sh new file mode 100755 index 0000000..aa7bd9a --- /dev/null +++ b/Scripts/setup_www_svn/setup.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +. ./domain.sh + +if ! [ -d "$DOMAIN" ] +then + echo "Error, expecting directory to be here first from dreamhost setup" + echo "Go to dreamhost panel first and setup the sub-domain in this account" + echo -1 +fi + +cd "$DOMAIN" + +svn co --username web "http://internal.invertedlogic.com/dev/web/$DOMAIN" ./ + diff --git a/Scripts/sync.sh b/Scripts/sync.sh new file mode 100755 index 0000000..785b790 --- /dev/null +++ b/Scripts/sync.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: sync.sh +# +# USAGE: ./sync.sh +# +# DESCRIPTION: Syncs local files with the webserver +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: John Ryland (jryland@xiaofrog.com) +# COMPANY: InvertedLogic +# VERSION: 1.0 +# CREATED: 12/26/07 14:05:38 CST +# REVISION: --- +#=============================================================================== + +### rsync -avz ~/Sites/ kratos.dreamhost.com:~/sync/ + +# Deprecated using rsync for this... using SVN instead which has version control... it's a better way +#rsync -avz ~/Sites/xiaofrog.com/ xiaofrog.com:~/xiaofrog.com/ + diff --git a/Scripts/total_linked_size.sh b/Scripts/total_linked_size.sh new file mode 100755 index 0000000..0861f9f --- /dev/null +++ b/Scripts/total_linked_size.sh @@ -0,0 +1,40 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: total_linked_size.sh +# +# USAGE: ./total_linked_size.sh +# +# DESCRIPTION: (MacOSX only) This program tries to determine the +# total size of all the linked libraries that an +# executable uses. It requires that you first run +# the program through ktrace to get a ktrace.out file +# It doesn't add the size of the application binary itself +# to the total and it possibly includes system libraries +# in the total count +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), +# COMPANY: +# VERSION: 1.0 +# CREATED: 06/25/08 15:25:29 CST +# REVISION: --- +#=============================================================================== + +#echo buggy - needs to work out the column positions to cut from better +if [ -f ktrace.out ] +then + #APP=`kdump -f ktrace.out | grep dylib | grep NAMI | grep -v "System" | sort | uniq | xargs ls -la 2> /dev/null | cut -c 27-37 | sed 's/^/a ; a\+=/g' | bc | tail -n 1` + #TOTAL=`kdump -f ktrace.out | grep dylib | grep NAMI | sort | uniq | xargs ls -la 2> /dev/null | cut -c 27-37 | sed 's/^/a ; a\+=/g' | bc | tail -n 1` + APP=`kdump -f ktrace.out | grep dylib | grep NAMI | grep -v "System" | sort | uniq | xargs ls -la 2> /dev/null | cut -c 34-41 | sed 's/^/a ; a\+=/g' | bc | tail -n 1` + TOTAL=`kdump -f ktrace.out | grep dylib | grep NAMI | sort | uniq | xargs ls -la 2> /dev/null | cut -c 34-41 | sed 's/^/a ; a\+=/g' | bc | tail -n 1` + echo "Calculated the following:" + echo " Application links with a total of $TOTAL bytes of dynamic libraries" + echo " Application links with a total of $APP bytes of dynamic libraries (excluding system libraries)" +else + echo "Run the program with ktrace first to get a ktrace.out file" +fi + diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..e7e9e99 --- /dev/null +++ b/setup.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +svn co --username code "http://internal.invertedlogic.com/dev/code/" ./ +