Using The WordPress API

Wordpress has an app. That means there’s an API to normalize communication using a predictable programmatic interface. In this case, as with many others, that’s done using a standard REST interface to communicate. The easiest way to interact with any API is to just read some stuff from the server via curl. You can feed curl the URL to the API by using your URL followed by /wp-json – as follows, assuming a URL of curl To view header information: curl -s -D - -o /dev/null In the below example we’ll ask for a list of posts by adding /wp/v2/posts to the URL: curl You’ll see a list of some posts in the output along with a little metadata about the posts. You can then grab an ID and ask for just that post, using a post ID of 48390: curl You can also see revisions that have been made to a post by appending the URL with /revisions curl You can see comments with the comments route: curl Or pages with the pages route: curl Or users with the users route: curl Or media that has been uploaded with the media route: curl And the output of each can be constrained to a single item in that route by providing the ID of the item, which shows additional metadata about the specified item. And there are routes for categories, tags, etc. There’s also some good stuff at such as which is a plugin that allows you to auth against the API. curl --user admin:krypted Not only can you look at user information, you can also add and remove posts. You would add by doing a -X followed by a POST and then feeding a file with the –data option curl --user admin:password -X POST --data @post.json The output would then include the ID of your new post to wordpress. In the following example, we’ll get rid of the post we were looking at earlier using -X and DELETE in the URL, assuming a username of admin, a password of krypted, and a post ID of 48390: curl --user admin:krypted -X DELETE If successfully deleted the response would be as follows:
{ “message”:”Deleted post” }
To dig in deeper, check out where the whole schema is documented. You can also use the GitHub site to access a command called wp (as well as PHP, node, and java clients) that can be run at the command line for simple scripting interfaces. This could allow you to, for example, simply backup posts to json files, etc. Also, it’s worth noting that various plugins will require their own interface (note there’s no themes or plugins route), such as woocommerce, interfacing with or

Install the Command Line Tools For Apple Configurator 2

A great new feature of Apple Configurator 2 is the command line interface for Apple Configurator: cfgutil. Go ahead and click on the Apple Configurator 2 menu and select Install Automation Tools from the menu. Screen Shot 2015-10-01 at 2.55.05 PM When prompted, Screen Shot 2015-10-01 at 2.55.09 PM Once installed, you’ll find cfgutil at /usr/local/bin/cfgutil.

Hello angularjs

When I was just getting started with AngularJS, I found, a site that allows you to enter some code and run it straight from a browser. So, what do you do first: Hello World of course. This one with a little input twist… <!DOCTYPE html> <html ng-app> <head> <script type="text/javascript" src="//"></script> </head> <body> Enter Your Name: <input type="text" ng-model="name" /> <h1>Hello {{ name }}</h1> </body> </html> Screen Shot 2015-09-08 at 1.58.35 PM

Unix Signals

When you run a kill command to stop a process from bash or the javax.realtime.POSIXSignalHandler class, you’re sending what’s known as a POSIX signal to the process. These signals can be called via their numeric representations or the signal (e.g. with the -s option of the kill command). Signals include the following:
  • 1: SIGHUP – Close the controlling terminal when the controlling process dies
  • 2: SIGINT – Send a keyboard interrupt
  • 3: SIGQUIT – Quit from a keyboard/terminal
  • 4: SIGILL – Terminate illegal instruction with a core dump and don’t restart
  • 5: SIGTRAP – Send a trace/break trap (with core dump)
  • 6: SIGABRT – Process an abort signal
  • 7: SIGEMT – Send the signal when emulator traps happen
  • 8:SIGFPE – Terminate floating point errors (erroneous arithmetic operations) with a core dump
  • 9: SIGKILL – Kill a signal outright (kill cannot be ignored)
  • 10: SIGBUS – Terminate access (some portion of a memory object) with a core dump
  • 11: SIGSEGV – Terminate with a core dump – Invalid memory reference
  • 12: SIGSYS – Bad system call
  • 13: SIGPIPE – Terminate and write on the pipe
  • 14: SIGALRM – Timed kill of a signal
  • 15: SIGTERM – Software termination of a signal
  • 16: SIGUSR1 – User defined signal 1, with SIGUSR2 as user defined signal 2
  • 17: SIGTERM – Software termination of a signal
  • 18: SIGCHLD – Child status change
  • 19: SIGPWR – Send the signal when the system encounters a power failure
  • 20: SIGWINCH – Send the signal to a process when the window changes
  • 21: SIGURG – Ignore signal, high bandwidth data
  • 22: SIGIO – Terminate pollable event
  • 23: SIGSTOP – Stop executing (cannot be ignored or caught by an exception)
  • 24: SIGTSTP – Terminate a stop signal.
  • 25: SIGCONT – If stopped, continue executing a process
  • 26: SIGTTIN – Background process is attempting to read
  • 27: SIGTTOU – Background process is attempting to write
  • 28: SIGVTALTM – Expired virtual timer
  • 29: SIGPROF – Terminate Profiling timer
  • 30: SIGXCPU – Past the CPU time limit, terminate with a core dump
  • 31: SIGXFSZ – Past the file size limit, terminate with a core dump
  • 32: SIGWAITING – Suspend execution of the process until a defined signal is sent
  • 33: SIGLWP – Send when the implementing threading requires a signal
  • 34: SIGFREEZE – Deprecated
  • 35: SIGTHAW – Deprecated
  • 36: SIGCANCEL – Deprecated
  • 37: SIGLOST – Send the signal when encountering a lost file lock
To put these in practice, let’s use the kill command from bash, with the -s option followed by SIGTERM and then the pid number: sudo kill -s SIGTERM 20341

Mac DevOps Conference

There’s another new conference in town! Well, not my town, but Vancouver. MacDev Ops is a hot topic. One that will only increase in the coming years. Thanks to Mat X and Brian Warsing for bringing about a brilliant conference. Screen Shot 2015-03-23 at 10.43.50 PM The conference will be held on June 19, 2015 and is an easy $99 if you sign up soon. Also, submit a talk if DevOps is your thing. They’re looking to bring the following topics to the table:
  • Puppet, Chef and other automation from Desktop to Cloud and back
  • Software deployment with Munki and AutoPkg: the app ecosystem surrounding it
  • Cool tools: demo of awesome Mac Admin projects from GitHub
  • DevOps: How to adopt Automation and Best practices in IT operations
  • Dev skills: workshops on Ruby, Git, Python, Javascript for Mac Admins
  • MDM: Profiles and Mac configuration management in the cloud
This is sure to be a good one. Check it out here!

Happy Holidays

Merry Christmas and to all a good night!
<title>Merry Christmas</title>
<script type="text/javascript">
function MerryChristmas()
   alert ("Merry Christmas!");
<a href="javascript:MerryChristmas()">MerryChristmas</a>

Access Qlogic Switches & Other Java Apps From OS X

Qlogic fibre channel switches are about the most common I see in Xsan environments. A common frustration when managing a Qlogic switch is that the Java runtime used to manage the switch is blocked from most OS X systems by default. But it’s pretty easy to get into them with a couple of minor adjustments. To get started, first download and install the latest Java from here. Once installed, open System Preferences on your Mac and then open the Java Preferences. Here, click on the Security tab. Screen Shot 2014-03-17 at 10.43.11 AM Click Edit Site List… In the pop-up, click Add and enter http:// followed by the name or IP address of your switch. Screen Shot 2014-03-17 at 10.42.45 AM Click on OK to commit your changes. Then access the switch address from Firefox (what I use for these) or whatever browser you prefer. Because the switch has a self-signed certificate, you’ll be prompted with a  security warning. Here, click the checkbox for “I accept the risk and want to run this application” and then click on the Run button. Screen Shot 2014-03-17 at 10.40.21 AM You’ll then be prompted by another Security Warning dialog. This one is indicating that the Java applet is potentially unsafe. Because we somewhat trust Qlogic, click Don’t Block. You’ll have to click this one every time you access the switch. Screen Shot 2014-03-17 at 10.43.48 AM The switch interface then opens and you can manage your switch as needed. Screen Shot 2014-03-17 at 10.45.20 AM Enjoy.

Xsan Monitor Widget Released (kinda')

I am releasing the Xsan Monitor that I’ve mentioned as alpha code.  There are still some updates I may do but for now I’m putting it out there for those who feel this is the kind of thing they can take use of.  Basically, it’s a Dashboard Widget that can run on an Xsan client or metadata controller.  When running it will display the CPU and RAM statistics of the Xsan processes.  If it’s the kind of thing you could use then please feel free to give it a test drive and let me know what you think at or   Xsan Monitor is available on the Apps page of