TAG: Administration

List of my must-have Alfred Workflows

Use a mac? You’ll want to grab Alfred App. I’m finding it an invaluable replacement for spotlight and the workflows allow me to supercharge my workflows. It’s so useful that I’ve purchased the Powerpack lifetime license.

In addition to the standard features, here are a list of the most useful workflows for dev/tech:

Kill process – by Nathan Greenstein (@ngreenstein)
I use it as an activity monitor for CPU usage, and from there I can easily force quit any process if needed. It’s easier to see all processes on the Alfred UI instead of opening Activity Monitor on your mac. There’s also the workflow Kill Application – by Sebastian Hallum Clarke (and also on his site you can find other cool workflows).

Timer – by Daniel Bader
I use this one a lot. It’s super simple and by writing “Timer” and the number of minutes, you can easily set a reminder. It’s great for anyone using the Pomodoro technique or even if you leave something on the stove and want to go back to work.

Copy SSH Public Key – By oldcai
This one saves me time when I need to deploy my SSH key on a new server. Type ‘pk [ssh key file name]’ and it’ll copy the ssh key to the clipboard.

Incognito – by Nedwood
I find myself using this when I need to test a page and bypass the cache. Type ‘incog [url]’ and it’ll launch a new chrome window in incognito mode.

Find Folder by Samvlu
Finds a folder by name. I find this is faster than spotlight in just about every search.

Smart Folders by Deanishe
List all the Smart Folders/Saved Searches (same thing) on your system and drill down into their contents. Works in much the same way as Alfred’s File Filter, but Smart Folders are also available outside Alfred and are a bit more flexible.

For example, you can configure a Smart Folder to show all video/audio/image files without having to specify each different filetype individually. If you already use Smart Folders, this workflow can save you the work of re-implementing them as File Filters.

What’s more, you can exclude specific filetypes with a Smart Folder, which Alfred cannot do.

Advanced Google Maps Search by stuartcryan
This workflow gives you some quick and dirty shortcuts into Google Maps:

Commands:

To Configure:

mapsethome <home address including street number, name, postcode> (i.e. what you would type into Google Maps)
mapsetwork <work address including street number, name, postcode> (i.e. what you would type into Google Maps)
Commands for Use:

maps <query> – Search Google maps for an address
dir <query> to <query> to <query> etc (seperate multiple addresses with ” to ” minus the quotes, and you will get a multiple location search)
dirfw Show directions from Work to address
dirfh Show directions from Home to address
dirtw <query> Show directions from query to Work address
dirth <query> Show directions from query to Home address
trafficw – Show traffic from Home to Work
traffich – Show traffic from Work to Home

StackOverflow Search by deanishe
If you use stackoverflow as much as I do, this is a must-have.

Date Calculator
I find myself needing to calculate differences between dates in my personal life a lot lately. This workflow saves me a lot of time to do that. Want to know how far Christmas is away in days? ‘dcalc 12-25-16 – now d’ returns the number of days (assuming you’re using the US short format like I am).

Wifi Control by miroman
All my Macbooks periodically have issues with wifi. I’ve never been able to figure out what’s causing it but I use Wifi Control to restart the wifi which allows me to connect successfully.

Bugnot by vitor
If you use bugmenot at all, this is a useful extension to get logins without loading a new tab. Type ‘bn domain.com’ and you’ll get a list of matching passwords to use.

 

 

How to Fix ‘Converter Failed to Save File’ with Excel 2016

I recently upgraded to Office 2016 on my Windows 10 desktop and was getting the error “Converter failed to save file” when double clicking on the file along with an “There was a problem sending the command to the program error” every time. I finally had enough with the annoyance to troubleshoot it and figured out a solve.

If you have the same issue, here’s how to fix it:

  1. Open your Default Programs configuration from the Control Panel. On Windows 10, you can hit start, type Default Programs, and it’ll open the app.
  2. Scroll down the list until you get to the Excel formats (XLS):
    Default Programs
  3. If you see anything other than Excel as the default, you’ll need to change the default to Excel. For me, the issue was the Open XML Converter not being installed anymore after upgrading to 2016. To change the default, select the format, click the “Change Program” button and select Excel 2016 from the list of apps that pops up and click OK to set the association:
    App Select
  4. You’ll need to do this for each format in the list to correct it. The most common formats you’ll use are XLS, XLSX, & XLT.

ReportCrash High CPU & How to Disable reportcrash in Mac OSX

For a while now, all of my MacBooks have run extremely hot and the fans have gone nuts. While troubleshooting the issue, Activity Monitor showed that an app named reportcrash has run very high on the CPU and has killed my battery life. Force quitting the app didn’t help as it would start right back up in a few seconds and climb back to 80-100% usage of the CPU.

What is CrashReporter?

CrashReporter runs in any time an application crashes and it’s designed to saves the application state to aid developers in working out why the app crashed. Basically a process is launching, crashing (and invoking CrashReporter) and then re-launching, repeating this cycle never ending.

How to Identify What’s Crashing

To show which process is triggering this cycle and stop it, CrashReporter is pretty verbose in its logging which makes finding the problem app somewhat easier. Open up the console.app (/Applications/Utilities/Console.app) and look towards the end of your system.log to see what app is crashing.

Unfortunately for me, the problem is a driver by some company called EFI and getting the latest drivers didn’t resolve the issue. The next obvious solution was to disable reportcrash.

How to Disable ReportCrash

Fire up terminal and run the following commands to disable reportcrash:

How to Enable ReportCrash

If you need to reenable crash report, run the following commands in terminal:

How to repair permissions on Linux Apache /var/www/html folder

I recently ran into an issue where I could no longer FTP files to my Linux droplet when multiple users were uploading to the server. The server kept the user as the owner despite me adding them to the www-data group. This fix comes from my ex-boss, James Tomasino who was kind enough to provide some help since I was stumped. I’m sharing in case anyone else runs into the same issue and finds it useful.

You’ll need to fire up terminal, ssh to the server, and then execute these commands:

+s makes permissions sticky so that all files will inherit from the parent directory. This was the setting I was missing.

Open up /etc/ssh/sshd_config. I use nano so:

Hit CTRL+W and look for “subsystem” which is typically located near the bottom of the file. Change

to

If you already have files in the HTML folder, you’ll want to run these commands to reset the permissions:

 

Copy File Context to Clipboard via Command Line, Git Bash (Mingw64), or Terminal

I’ve been spending more time switching from SVN to Git and learning the command line options. I’m finding a lot of the Mac Git terminal commands I run aren’t the same in Git Bash (Mingw64). One of the commands I use is the pbcopy command to copy the ssh key to the clipboard to paste into Github and Bitbucket accounts. I’m starting to use it more as I am learning managing Linux servers and adding my key to login. I’m adding it here as a cheatsheet for myself but I thought others may find it useful.

On Windows, you can run this command to copy your ssh key to the clipboard:

On Mac:

or if you want to view it in the terminal window:

How to Copy and Paste into the Digital Ocean VNC Console

I recently signed up for Digital Ocean to test droplets for my development and linux management testing. I was securing the server and setup fail2ban, disabled the root login, and created a user account but forgot to change the user name from root to the user name I selected in my SSH client profile. I ended up locking myself out of the server and had to resort to logging into the admin panel on Digital Ocean’s website and use their browser embedded VNC client to restore my access. I quickly discovered that one of the downsides of using this panel is that you can’t copy and paste commands. Luckily there’s a workaround and you can use the browser console to do sendkeys through Javascript.

Bring up the console in the browser developer tools. Here’s a cheat sheet for keyboard shortcuts:

BrowserDescriptionWindowsMac
ChromeOpen Developer Tools and bring focus to the consoleCtrl + Shift + JCmd + Opt + J
FirefoxOpen ConsoleCtrl + Shift + KCmd + Opt + K
Internet ExplorerAfter hitting F12, you have to click the console tab.
There’s no direct shortcut to the console tab.
F12N/A

Paste this snippet into the textbox in the console window:

Chrome console

 

Update 9-21-16

Ruden and Sebastiaan’s pointed out there was a bug in the code above. This updated snippet has support for characters when using shift characters like !@#$%^&*()_+

You’ll receive a dialog prompt to enter the copy to paste in. Please note that you need to click on the VNC console and hit enter to execute the command.

Javascript Prompt

 

 

 

 

 

If you need to enter more than one command, just hit the up arrow on your keyboard in the console to get the script again for easy reuse.

Sitecore 8 Install Error: “The name you entered is not unique.”

Stecore Installer Error - The name you entered is not unique.I was working on my business partner’s computer to help him fix errors with his Sitecore instance for his certification class. He experienced multiple issues with the Sitecore 8 installer on Windows 8 and we went the manual route of deleting Sitecore to install clean and start from scratch. In the process, we:

  • Deleted the IIS website instance in the IIS Manager
  • Deleted the databases used by the instance
  • Deleted the root folder in the filesystem

After launching the installer again, it kept returning the error “The name you entered is not unique.” when naming the Sitecore instance to one previously used. After checking the IIS metabase and a few other typical locations, couldn’t figure out where the Sitecore installer was finding the name since we deleted everything manually. It turns out that the Sitecore executable installer creates a registry entry under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Sitecore CMS which is used to display information in Windows Programs and Features. This registry key is also checked during the installation process and if a child key with the same name as the one being installed is found, the above error message is shown.

To fix this:

  1. Start -> Run (or Windows Key + R)
  2. Type regedit
  3. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Sitecore CMS.
  4. Delete the registry keys containing the information about the previously installed instance.

NOTE: You’ll need to relaunch the installer as it apparently caches the key information.

 

How to fix “hacked by Moroccanwolf” WordPress site

A client of mine had their wordpress hacked and when you would load the site, it would simply display a message that said “hacked by Moroccanwolf”. I did some digging and luckily it wasn’t a major hack and they didn’t mess with the posts or other settings as a lot of the hacks do.

Quick Fix

  1. To fix it, you’ll need to connect to your database using an editor of some sort, such as PHPmyadmin.
  2. Once logged in, expand your database on the left.
  3. Click on ‘wp_options’.
  4. On the top right, click the ‘Browse’ tab.
  5. Look for ‘widget_text’ in the option_name field. (For my client, it was at row 90). You should see something similar to this:

Delete the entire tag and this  should restore your website. Now remember to change your logins and update wordpress.

How I Figured it Out

Most of the hacks I’ve seen are done through injecting javascript into the database somewhere which either force a redirect or something along those lines. Here’s the steps I followed to find it:

  1. To fix it, you’ll need to connect to your database using an editor of some sort, such as PHPmyadmin.
  2. Once logged in, click on your database on the left. Ensure you’re on the database and not a table.
  3. Click Export.
  4. Leave it to quick and click go.
  5. You should now see a textbox with a mess of SQL commands.
  6. Copy and paste into your favorite editor,
  7. Search for <script> and you should find something that doesn’t belong.  In this instance, that was the only thing I found of note.
  8. You’ll want to scan the rest of the database for things that don’t belong. Additionally, you’ll want to replace all the wordpress files and confirm no .htaccess files were created that give hackers write access.

 

When updating Office 2011 for Mac, you are prompted that you must close “Microsoft Database Daemon” and “SyncServicesAgent”

If you’re trying to update your install of Microsoft Office 2011 for Mac, you may get the following message:

“These applications must be closed before the software can be installed:

Microsoft Database Daemon
SyncServicesAgent

Close these applications and try again”

If you try to kill the apps using activity monitor, you’ll find they keep getting restarted. The only way I found that worked to stop them is by following the instructions below.

  1. Open a terminal window and enter the following command:
    launchctl unload ~/Library/LaunchAgents/com.microsoft.LaunchAgent.SyncServicesAgent.plist

This will unload the SyncServicesAgent. Unfortunately the Daemon kept running for me after the latest update. To stop that, do the following:

  1. Open activity monitor
  2. Scroll down until you find Microsoft Database Daemon in the list of active applications.
  3. Click on Microsoft Database Daemon and click on the Quit Process button in the toolbar

Go back to the install utility and you should now be able to proceed with the install. Once the install is finished, you’ll want to restart the Sync Services Agent, so do the following:

  1. Go back to the terminal window and enter this command:
    launchctl load ~/Library/LaunchAgents/com.microsoft.LaunchAgent.SyncServicesAgent.plist

Now you should be all set with updates and can close terminal.