I would like to share with you a small VBA macro which basic functionality is just replace order of two-member string for example :
John Travolta -> Travolta John
Short manual of macro :
1. Select cells you want to replace the order of their content
2. Run macro
Macro code :
Public Function StrRange(ByVal nRow As Single, ByVal nCol As Single) As String
Dim sC As String
Dim nC, nRest, nDivRes As Integer
sC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
nC = Len(sC)
nRest = nCol Mod nC
nDivRes = (nCol - nRest) / nC
If nDivRes > 0 Then StrRange = Mid(sC, nDivRes, 1)
StrRange = StrRange & Mid(sC, nRest, 1) & Format(nRow)
End Function
Sub ChangeString()
Dim range As String
range = Selection.Address(ReferenceStyle:=xlA1, _
RowAbsolute:=False, ColumnAbsolute:=False)
If range = "" Then
MsgBox ("The range of cells was not definedcells. Ending the macro")
Exit Sub
End If
Dim Start
Dim Last
intPos = InStr(1, range, ":")
If intPos > 0 Then
split_string = Split(range, ":")
If UBound(split_string) = 1 Then
Start = split_string(0)
Last = split_string(1)
End If
Else
Start = range
Last = Start
End If
Dim SheetName
SheetName = ActiveSheet.Name
If SheetName = "" Then
MsgBox ("Cannot read sheet name. Ending the macro")
Exit Sub
End If
Dim CellAddress
For Each c In Range("" & CStr(Start) & ":" & "" & CStr(Last))
If c.Value <> "" Then
CellContent = Split(c.Value, " ")
CellAddress = StrRange(c.Row, c.Column)
Dim wb As Workbook
Dim ws As Worksheet
Dim TxtRng As Range
Set wb = ActiveWorkbook
Set ws = wb.Sheets(SheetName)
Set TxtRng = ws.Range("" & CStr(CellAddress))
TxtRng.Value = CStr(CellContent(1)) & " " & CStr(CellContent(0))
End If
Next c
End Sub
Reference :
[1] Pastebin GarciaPL VBA Replace string order
If you would like to verify Nagios configuration just run this command :
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Of course in your case the path to nagios.cfg may be different ;)
Reference :
[1] Nagios Verify Configuration
Quick and very simple piece of code in LaTeX which I suppose help you to create very ordinary own business card ;)
\documentclass[11pt]{article}
\usepackage[english]{babel}
\usepackage{polski}
\usepackage[cp1250]{inputenc}
\usepackage[none]{hyphenat}
\usepackage{graphicx}
\begin{document}
\begin{titlepage}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} % Defines a new command for the horizontal lines, change thickness here
\center % Center everything on the page
%----------------------------------------------------------------------------------------
% HEADING SECTIONS
%----------------------------------------------------------------------------------------
%\textsc{\LARGE Dane rachunku bankowego}\\[1.5cm] % Name of your university/college
%\textsc{\Large Major Heading}\\[0.5cm] % Major heading such as course name
%\textsc{\large Minor Heading}\\[0.5cm] % Minor heading such as course title
%----------------------------------------------------------------------------------------
% TITLE SECTION
%----------------------------------------------------------------------------------------
\HRule \\[0.7cm]
{ \huge \bfseries Company Name}\\[0.4cm]
\HRule \\[0.9cm]
%----------------------------------------------------------------------------------------
% AUTHOR SECTION
%----------------------------------------------------------------------------------------
\large\emph{Details About Company}\\\vspace{0.5cm}
\large\emph{Facebook.com/CompanyPage }\\\vspace{0.5cm}
\large\emph{Twitter.com/CompanyPage}\\\vspace{0.5cm}
%----------------------------------------------------------------------------------------
\vfill % Fill the rest of the page with whitespace
\end{titlepage}
\end{document}
Reference :
[1] Business Card GarciaPL Pastebin.com
I would like to share with you a small script written in Perl which simply send an email. You can use it in your other scripts when you want to indicate an error while something goes wrong. Of course this small piece of code can be also used in Nagios scripts ;) Only imagination is the limit where this sending email function can be used.
sub sendEmail {
my ($to, $from, $subject, $message) = @_;
my $sendmail = '/usr/lib/sendmail';
open(MAIL, "|$sendmail -oi -t");
print MAIL "From: $from\n";
print MAIL "To: $to\n";
print MAIL "Subject: $subject\n\n";
print MAIL "$message\n";
close(MAIL);
}
sendEmail("receiveremail\@domain.com", "myemail\@domain.com", "Nagios Error", "Cannot receive NRPE output from host 10.100.5.6");
Reference :
[1] Pastebin GarciaPL Send email in Perl

