[HowTo] Replace ip address using sed

Following one-liner will search for a ip address pattern in the specified file and replace it with the one provided :

 sed 's/[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}/IPADDRESS-COMES-HERE/g' /SourceFilename > /DestinationFilename

Disable services in Solaris 10

To disable a service you have to be root or have a sudo, for example, i want to disable puppet:

# svcs | grep puppet
online          9:51:57 svc:/network/cswpuppetd:default

I will disable the nfs server:

# svcadm disable network/cswpuppetd:default

Release Engineering 101 – Build Script

Each software platform will provide a way to write a script and invoke a sequence of build steps Unix shell scripts, make files, windows batch files etc can be used to define a build script.

A framework / tool like ANT, helps in abstracting the script from a platform dependency and use simple XML file to define the build script.
Interestingly ANT itself is only a XML notation, that defines the sequence of steps. The steps themselves rely on the code base, framework binaries, SDK binaries etc.
In summary using any suitable syntax a build script should be defined. The script itself should automate the sequence of steps that needs to be executed to create a single unit of software.

How To Get The Current Epoch Time (Unix Timestamp)


Perl time
PHP time()
Ruby Time.now (or Time.new). To display the epoch: Time.now.to_i
Python import time first, then int(time.time())
Java long epoch = System.currentTimeMillis()/1000;
Microsoft .NET C# epoch = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000;
VBScript/ASP DateDiff("s", "01/01/1970 00:00:00", Now())
Erlang calendar:datetime_to_gregorian_seconds(calendar:now_to_universal_time( now()))-719528*24*3600.
element(1, now()) * 10000 + element(2, now()).
MySQL SELECT unix_timestamp(now())
PostgreSQL SELECT extract(epoch FROM now());
Oracle PL/SQL SELECT (SYSDATE - TO_DATE('01-01-1970 00:00:00', 'DD-MM-YYYY HH24:MI:SS')) *
24 * 60 * 60 FROM DUAL
SQL Server SELECT DATEDIFF(s, '1970-01-01 00:00:00', GETUTCDATE())
JavaScript Math.round(new Date().getTime()/1000.0) getTime() returns time in milliseconds.
Unix/Linux Shell date +%s
PowerShell Get-Date -UFormat "%s" Produces: 1279152364.63599
Actionscript (new Date()).time
Other OS’s Command line: perl -e "print time" (If Perl is installed on your system)
ColdFusion (CFML) MX 6.1+ #int( getTickCount() / 1000 )#
Bash Command Line: date +%s