wget and then clean up links in php website

genie

I am helping a friend set up a wordpress website. She found a website that she like the structure and look of. I wanted to capture the site including links and each individual page as a reference for what she likes and how to build the site for her.

I won’t copy it, but I will find the layout and colors and content a good guide to what we want to end up with.

The first step was to download the site…

wget -rk -np http://www.webaddress.com/

Once I had downloaded the site, I found that the links grabbed by wget were largely .php pages – not ending in .html, but in .php. To make the site usable takes two steps.

First, rename the *.php files to .php.html…

for i in *.php 
do 
  mv $i $i.html
done

Then correct the links to point to the new pages…

grep -rl .php *.html | xargs perl -pi~ -e 's/.php/.php.html/'

This gave us a working reference copy of the website locally.

 

—doug

 

vi(m) tricks

vim

I had copied a section of text from a pdf.

When I pasted it into an email I got:

insurance	against	loss	or
damage	 by	 fire,	 including	 an	 extended	 coverage	 endorsement, for	 all	 buildings	 and	
personal	 property	 which	 comprise	 the	 Property.	 	 Owner	 agrees	 to	 maintain	 property	
liability	 insurance	 in	 full	 force	 and	 effect	 during	 the	 term	 of	 this	 Agreement in	 an	
amount	 no	 less	 than	 Two	 Million	 Dollars	 ($2,000,000.00),	 covering the	 Property,	 the	
rental	 thereof, injury	 to	 persons, and damage	 of any	 property resulting	 from	 such	
operation and/or use.	 	

I started to remove spaces and reformat, and then stopped and pasted it into a vi session.

I ran “shift-J” to join all the lines into a single line, and had:

insurance       against loss    or damage        by      fire,   including       an      extended        coverage        endorsement, for        all     buildings       and    personal         property        which   comprise        the     Property.               Owner   agrees  to      maintain        property       liability        insurance       in      full    force   and     effect  during  the     term    of      this    Agreement in    an     amount   no      less    than    Two     Million         Dollars         ($2,000,000.00),        covering the    Property,       the    rental   thereof, injury         to      persons, and damage     of any  property resulting      from    such   operation and/or use.

Screen Shot 2013 04 18 at 4.42.53 PM 300x207 vi(m) tricks

Then I used:

:g/\s\+/s// /g

and we have, ready to cut and paste into the email:

insurance against loss or damage by fire, including an extended coverage endorsement, for all buildings and personal property which comprise the Property. Owner agrees to maintain property liability insurance in full force and effect during the term of this Agreement in an amount no less than Two Million Dollars ($2,000,000.00), covering the Property, the rental thereof, injury to persons, and damage of any property resulting from such operation and/or use.

vi rules.

 

—doug

 

updating iLO, HP’s Integrated Lights Out Connection

iLo Web Interface

I was handed an HP server to rebuild. The server had rebooted for no logged reason. Two other servers bought at the same time and built with the same OS and firmware had also experienced this spontaneous reboot. These had been rebuilt and the rebuild at updated firmware and updated Ubuntu version had resolved the [...]

Continue reading...

monitor mongodb from nagios

I was asked to find a way to alert if the PRIMARY server in our mongodb replicaset changed… I found check_mongodb.py from the mongodb documentation and google search. Grab the check_mongodb.py file from https://github.com/mzupan/nagios-plugin-mongodb. Also here are the install instructions and the nagios configurations. I installed the check_mongodb.py file and tried it: ./check_mongodb.py No module [...]

Continue reading...

finding mongodb primary server

I found a monitor for when the PRIMARY of a mongodb replica set changes – but how to determine which server actually is primary? Well, this can be done on the command line… root@server:/opt/mongodb/bin# ./mongo 192.168.1.1 –eval “printjson(rs.status())” MongoDB shell version: 2.0.4 connecting to: 192.168.108.161/test { “set” : “px_mongo”, “date” : ISODate(“2013-04-01T21:13:56Z”), “myState” : 2, [...]

Continue reading...

Two Instances of Dropbox on OSX

Dropbox

  I have a joint dropbox I share with my wife, and a personal dropbox account for professional docs. These articles, followed, allowed running two separate, easily identifiable instances of Dropbox on a MAC. Article from LifeHacker The Terran I used the preferences to set one icon as black and white, leaving the second colored [...]

Continue reading...

faillog and PAM…

pam

I just spent a couple of hours discovering faillog integration into PAM… The original ticket was to reset a user password from the ubuntu root recovery session at the console. The ticket was old-ish. The server involved was DR (Disaster Recovery). No disaster, no urgency, therefore not a priority immediately. Once the password was reset, [...]

Continue reading...

networking in command line, Ubuntu 12.04 server

I created a virtual machine in vSphere to become a syslog server. I got the virtual machine created, the Ubuntu 12.04 Server iso attached and the OS installed. The next step was to created a network interface, attach it to the virtual switch and get networking (route, dns) to come up and function… I tested [...]

Continue reading...

upgrade mediawiki, lose image upload, recover

I upgraded mediawiki to latest stable. This was several months ago, and all seemed to be well. Today I uploaded a screenshot – no actually, I tried to upload and screenshot and couldn’t figure out why I could not find the link or place to upload the image… I put [[image:screenshot.png]] and the mediawiki code [...]

Continue reading...

Mountain Lion and “Save As…”

Screen Shot 2012-09-25 at 10.45.48 AM

Sigh. OS X Mountain Lion is so good in so many ways, and yet loses. One gain was the return of "Save As…". To access this in a menu you hold down the option key and mouse over the menu. Under File, Save As… magically reappears. But the leyboard shortcut is NOT Command+Shift+S. Instead it [...]

Continue reading...