Linux tips, how-tos, tricks

<<< Show Posts >>>

Remaster a Linux install CD to allow installation on a Macbook

Turns out this was pretty easy to get going on my Macbook 2006 model to install Xubuntu.

On my fedora computer I installed isomaster (yum install isomaster), then opened the Xubuntu.iso I downloaded with isomaster.

glaw@fedora ~ $ isomaster xubuntu-14.04-desktop-amd64.iso 

Highlight the EFI folder, ad then click the icon 5th icon on the bottom (I think its supposed to be a trashcan.

Then file -> Save As and save a new copy of the ISO. 

You will end up with a slightly smaller iso:

glaw@fedora ~ $ ls -la x.iso xubuntu-14.04-desktop-amd64.iso 
-rw——- 1 glaw users 953790464 Jun  4 20:22 x.iso
-rw-r–r– 1 glaw users 957349888 May  6 10:21 xubuntu-14.04-desktop-amd64.iso

Now burn the x.iso with your favorite burner. 

glaw@fedora ~ $ basero x.iso

Once your have burned this off successfully, insert into your Macbook, boot up while pressing the alt/option key and select the “Windows” Icon (the mac thinks this is a boot camp install).

This other website will help in getting your Mac setup for the new OS : 

http://www.rodsbooks.com/ubuntu-efi/

 

WordPress – importing images from non-wordpress images directory

Working on a freelance site and somehow a bunch of images got uploaded to /images/2012/09/…  what the heck? I cannot even figure out how that happened.

Trying this new “smush.it” plugin and guess what, it only works off images inside the media manager.

After looking around for a couple hours, I finally figured it all out.  DISCLAIMER:  Before trying this, make sure you back up your database.  PHPMyAdmin has an “Export” option that will let you do this.

  1. First is a plug-in called “add from server” – http://wordpress.org/extend/plugins/add-from-server/.  This plugin gives you a file manager type interface to browser your website directories, so I pointed it at /images and let it import from there.  I wish it was recursive, but no such luck.  Lucky for me, I only had to drill down into /images/2012/09/ and import from there as well as my top level /images directory.  Importing gives you the option of using the original file date, so it copies the files to /wp-content/uploads/2012/09 and maintains that same date based hierarchy.  From the /images directory I just imported those ones with today’s date, so they ended up in /wp-content/uploads/2013/01/…
  2. After importing I had to refresh some of my MySQL skills.  The trick was to search the database for src=”/images/…” and update that to be src=”/wp-content/uploads/…”.  It took me a couple tries to get it right.  I started with a SELECT statement to get the syntax correct.
    SELECT post_content,replace(post_content,’src=”/images’,’src=”/wp-content/uploads’) FROM `wp_posts` WHERE post_content like ‘%src=”/images%’;
    This let me verify the substitution was happening the way I wanted it to, then it was just a matter of rewrite this as an UPDATE query (after I BACKED UP MY DATABASE!), this was the query:update wp_posts set post_content=replace(post_content,’src=”/images’,’src=”/wp-content/uploads’)  WHERE post_content like ‘%src=”/images%’;

 

Linux Mint Maya with Cinnamon 1.6 – Add additional media apps to the sound applet

I am a recent convert over to Linux Mint from Mac OSX.  After running OSX on my converted windows PC for 4 years, I got tired of not being able to update it so I figured I would take another run at Linux on the Desktop.

Linux Mint ships with their “cinnamon” desktop, which is a modified version of Gnome3.  After updating to the latest release of Cinnamon (1.6), I have been tweaking the GUI.  One of the “panel” applets Mint ships with is the Volume control applet, which also lets you launch different system media players.  Mint seems to ship with the basic media apps and uses Banshee as its default MP3 player.

My primary media apps are Pandora and Songbird at the moment.  I am a paid Pandora user, so they give you access to their “desktop app” which runs via Adobe Air.  Here is a little tutorial on adding these 2 apps to the “Launch” area of the sound applet.

First, you can install Sondbird using : sudo apt-get install songbird

Pandora is a little more difficult, see this link on Installing Adobe Air – once this is installed, you can double click on the Pandora.air file and it should install properly.

Adding these to the sound applet requires editing the javascript file that drives the applet, this is located at /usr/share/cinnamon/applets/sound@cinnamon.org.  In a terminal window,

First we need to figure out the name of the pandora launcher file, which I believe gets set up with a unique id for each user.

cd /usr/share/applications

glaw@mint : /usr/share/applications $ ls com.pandora*

com.pandora.desktop.fb9956fd96e03239939108614098ad95535ee674.1.desktop

cd /usr/share/cinnamon/applets/sound@cinnamon.org

sudo cp applet.js applet.js.orig
sudo vi applet.js

Look for the line:

let compatible_players = [ “clementine”, “mpd”, “exaile”, “banshee”, “rhythmbox”, “rhythmbox3”, “pragha”, “quodlibet”, “guayadeque”, “amarok”, “googlemusicframe”, “xbmc”, “xnoise”, “gmusicbrowser”, “spotify”, “audacious”, “vlc”, “beatbox” ]

and update it to look like this:

let compatible_players = [ “clementine”, “mpd”, “exaile”, “banshee”, “rhythmbox”, “rhythmbox3”, “pragha”, “quodlibet”, “guayadeque”, “amarok”, “googlemusicframe”, “xbmc”, “xnoise”, “gmusicbrowser”, “spotify”, “audacious”, “vlc”, “beatbox” , “songbird” , “com.pandora.desktop.fb9956fd96e03239939108614098ad95535ee674.1” ];

It looks like since the default launcher for songbird is simply called songbird.desktop, we do not need any special value here, but substitute your unique pandora launcher file name (minus the .desktop) above.
Save the file, and then logout or resart Cinnamon.  You should have Pandora and Songbird on the sound applet menu now 🙂

WordPress – using short codes within 404 page

Just a trick I just figured out – I installed a sitemap plugin for wordpress and wanted to drop the rendered sitemap into my 404 page.  The short code for the plug was [ slick-sitemap ].  So, in my 404.php page within my theme directory, I just added this :

<?php echo  apply_filters(‘the_content’,'[slick-sitemap]’);?>

 

that’s, well, slick 🙂

 

My top 5 wordpress plugins

404 Redirected – coupled with SEO Ultimate, allows you to catch 404 errors (ie – outdated bookmarks) and link them to the correct content.

Akismet – comes bundled with wordpress and for good reason.  Best anti-spam tool I have found for wordpress.

Better WordPress Minify  – awesome at reducing the number of HTTP requests your site generates.  combines all JS into 1 <javascript> tag, and all css into a single tag.

Contact Form 7 – simple contact form to email processing plugin

 SEO Ultimate – This one is helpful, not just for SEO but for general site management.  Has a 404 tracker as well as allows you to defined per page custom titles, meta descriptions, and keywords.

 

What CMS is a site running?

Ever find a neat website and wonder how that site was built and what CMS (content management system) was used?

 

Here are some useful links :

BuiltWith : http://builtwith.com/geolaw.com

WebmasterCoffee : http://webmastercoffee.com/en/site/geolaw.com?s=http

 

Midori Browser – Moving the New Tab button

I am running the Midori browser inside of Cygwin-X at work.  This allows me to browse and download within Cygwin easier, as well as bypass some of the security imposed on the network at work.

One thing I have found that I absolutely hate is the order Midori puts its task buttons in.  The first button on EVERY other browser is Back – Midori uses “New Tab”  – WTF?!  I find myself clicking “New Tab” meaning to go back.  This has got to go!

I found that the easy fix for this is by editing the configuration file.  On Cygwin this file is located in .config/midori/config

Make sure you exit out of Midori, then open the config file in vi.  The line to look for is toolbar-items=.  I moved TabNew from the first entry to the last.  Saved the file and then restarted Midori.

 

WordPress – Squash Spam Comments

A quick and easy way to squash the damn WordPress Spam bots.

 

First step is to turn off comments on all of your posts using the following SQL query:

UPDATE wp_posts p SET comment_status = ‘closed’, ping_status = ‘closed’ WHERE comment_status = ‘open’;

* Note you may have to adjust the wp_posts table name to suit your install.

Second step:

The default comment and ping status is open on all new posts – change the default to ‘closed’ with the following 2 queries:

alter table wp_posts change comment_status comment_status varchar(20) default ‘closed’;
alter table wp_posts change ping_status ping_status varchar(20) default ‘closed’;

Again, you may need to adjust the wp_posts table name to your install.

 

 

Postfix virtual SMTP server IP

Questgion:  Its easy to configure postfix to accept incoming email for multiple domains, but what happens if you have a client who wants their email SENT from a dedicated IP address?

Answer: Postfix 2.7.+ sender_dependent_default_transport_maps



Read the Rest…

Joomla – Editing “Advanced Attribs” from Front end

Originally for Joomla 1.5 – Not sure how outdated this may be since I no longer use Joomla.

I have run into a project that requires attaching some addition “Advanced” attributes to Joomla articles.

I have extended the “blog category” menu type to incorporate jQuery to display the blog category with the titles as vertical tabs, and the introtext displayed in a content div when each tab is clicked.

Articles selected for this vertical tabbed menu will also have an associated “menu image” and a “video file”.  The menu image will be a thumbnail that gets displayed in the tab, and the video file will be a flv video that is used to populate (using javascript) a fixed video player that will appear in another module position on the website.

Read the Rest…

Linux tips and tricks