<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Cpe on galvanist</title>
    <link>/tags/cpe/</link>
    <description>Recent content in Cpe on galvanist</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Sat, 28 Mar 2020 18:28:48 +0100</lastBuildDate>
    <atom:link href="/tags/cpe/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>macOS JavaScript for Automation (JXA) Notes</title>
      <link>/posts/2020-03-28-jxa_notes/</link>
      <pubDate>Sat, 28 Mar 2020 18:28:48 +0100</pubDate>
      <guid>/posts/2020-03-28-jxa_notes/</guid>
      <description>&lt;h1 id=&#34;overview&#34;&gt;Overview&lt;/h1&gt;&#xA;&lt;p&gt;There is a macOS feature called the &lt;a href=&#34;https://en.wikipedia.org/wiki/AppleScript#Open_Scripting_Architecture&#34;&gt;Open Scripting Architecture&lt;/a&gt; (OSA) which provides an infrastructure for intercommunication and automation of macOS software. One of the officially supported OSA languages is JavaScript and its use in this context is called &amp;ldquo;JavaScript for Automation&amp;rdquo; which is often abbreviated to &amp;ldquo;&lt;strong&gt;JXA&lt;/strong&gt;&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;The idea is that instead of using &lt;a href=&#34;https://en.wikipedia.org/wiki/AppleScript&#34;&gt;AppleScript&lt;/a&gt;, you can program &amp;amp; automate macOS using a more modern language like &lt;a href=&#34;https://en.wikipedia.org/wiki/JavaScript&#34;&gt;JavaScript&lt;/a&gt;. This gives the programmer access to the enormous ecosystem of javascript libraries and tools in addition to all the modern optimizations and language features of ES6-ish JavaScript. JXA also provides access to a built-in Objective-C bridge that enables access to the file system and the ability to call into the Cocoa frameworks and plain C functions. JXA can basically do anything native code can. It&amp;rsquo;s a bit like &lt;a href=&#34;https://en.wikipedia.org/wiki/Node.js&#34;&gt;node&lt;/a&gt; without needing to install node.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Your Mac&#39;s Serial Number via the Command Line</title>
      <link>/posts/2014-02-20-your-macs-serial-number-via-the-command-line/</link>
      <pubDate>Thu, 20 Feb 2014 23:54:40 +0000</pubDate>
      <guid>/posts/2014-02-20-your-macs-serial-number-via-the-command-line/</guid>
      <description>&lt;p&gt;Here&amp;rsquo;s my first (admittedly ugly) attempt:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;system_profiler SPHardwareDataType &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; grep &lt;span class=&#34;s1&#34;&gt;&amp;#39;Serial&amp;#39;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; sed &lt;span class=&#34;s1&#34;&gt;&amp;#39;s/^.*\:\ //&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Here&amp;rsquo;s a &lt;a href=&#34;http://apple.stackexchange.com/questions/40243/how-can-i-find-the-serial-number-on-a-mac-programmatically-from-the-terminal&#34;&gt;better one from stack exchange&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;system_profiler SPHardwareDataType &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; awk &lt;span class=&#34;s1&#34;&gt;&amp;#39;/Serial/ {print $4}&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Check your warranty status:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update: Within a year or two of this post, Apple disabled direct URL links to hardware warranty checks, so the following no-longer works.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;open &lt;span class=&#34;s2&#34;&gt;&amp;#34;https://selfsolve.apple.com/agreementWarrantyDynamic.do?sn=&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;$(&lt;/span&gt;system_profiler SPHardwareDataType &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; awk &lt;span class=&#34;s1&#34;&gt;&amp;#39;/Serial/ {print $4}&amp;#39;&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;amp;locale=en_US&amp;amp;caller=sp&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
  </channel>
</rss>
