<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="https://www.w3.org/2005/Atom">
  <channel>
    <title>Roque Pinel</title>
    <description>Developer - Foodie - Traveler</description>
    <link>https://www.pinel.cc/</link>
    <atom:link href="https://www.pinel.cc/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Mon, 20 Mar 2023 01:55:15 +0000</pubDate>
    <lastBuildDate>Mon, 20 Mar 2023 01:55:15 +0000</lastBuildDate>
    <generator>Jekyll v3.9.3</generator>
    
      <item>
        <title>Using GitHub Actions from private repositories</title>
        <description>&lt;p&gt;&lt;strong&gt;Updated on 06/18/2020:&lt;/strong&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;actions/checkout@v2&lt;/code&gt; can now handle private repositories. &lt;a href=&quot;#updated-on-06182020&quot;&gt;See the updated solution&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/features/actions&quot;&gt;GitHub Actions&lt;/a&gt; are awesome. The ability of build workflows
nicely coupled to source code and backed by cloud computing is truly
awesome. No wonder the feature will be moving to general availability on
November 13.&lt;/p&gt;

&lt;p&gt;I was surprised to noticed this week that you cannot use a GitHub action defined
in a private repository like you would normally do with a public action.&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;My workflow&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;push&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;jobs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;do-something&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;runs-on&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;steps&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;uses&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;actions/checkout@v1&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;uses&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;my-organization/awesome-action@master&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Last step&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The workflow above will raise a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;404&lt;/code&gt; error when trying to use
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;my-organization/awesome-action@master&lt;/code&gt; if &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;my-organization/awesome-action&lt;/code&gt; is a
private repository, even if the workflow’s repository is part of the same
organization (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;my-organization&lt;/code&gt;). Okay, let’s try checking out the
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;awesome-action&lt;/code&gt; and point the step to its local path in the container.&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;My workflow&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;push&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;jobs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;do-something&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;runs-on&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;steps&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;uses&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;actions/checkout@v1&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;uses&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;actions/checkout@v1&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;with&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;repository&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;my-organization/awesome-action&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;ref&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;refs/heads/master&lt;/span&gt;
          &lt;span class=&quot;c1&quot;&gt;# GitHub's personal access token with access to `my-organization/awesome-action`&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;token&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;$&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;./.github/actions/awesome-action&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;uses&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;./.github/actions/awesome-action&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Last step&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;actions/checkout@v1&lt;/code&gt; is able to checkout &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;my-organization/awesome-action&lt;/code&gt;,
but the path provided won’t be defined in the next step that tries to use the
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;awesome-action&lt;/code&gt;. Someone had reported a similar &lt;a href=&quot;https://github.com/actions/checkout/issues/57&quot;&gt;issue&lt;/a&gt;
but no one from the GitHub team has reached out. How about a more manual approach?&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;My workflow&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;push&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;jobs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;do-something&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;runs-on&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;steps&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;uses&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;actions/checkout@v1&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;uses&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Checkout my-organization/awesome-action&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;git clone --single-branch --no-tags --depth 1 -b master https://$:$@github.com/my-organization/awesome-action ./.github/actions/awesome-action&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;uses&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;./.github/actions/awesome-action&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Last step&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Success! The private repository &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;my-organization/awesome-action&lt;/code&gt; is correctly
cloned to the provided path and the next step is able to use the
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;awesome-action&lt;/code&gt;. The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git&lt;/code&gt; command uses &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;secrets.GIT_USER&lt;/code&gt; and
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;secrets.GIT_TOKEN&lt;/code&gt; to be able to access the repository. They were definied in
the workflow’s repository settings. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;secrets.GIT_TOKEN&lt;/code&gt; is the GitHub’s personal
access token with access to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;my-organization/awesome-action&lt;/code&gt; and
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;secrets.GIT_USER&lt;/code&gt; its owner.&lt;/p&gt;

&lt;h2 id=&quot;updated-on-06182020&quot;&gt;Updated on 06/18/2020&lt;/h2&gt;
&lt;p&gt;You can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;actions/checkout@v2&lt;/code&gt; to checkout private repositories as first attempted above. The cleaner solution would be:&lt;/p&gt;
&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;My workflow&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;push&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;jobs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;do-something&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;runs-on&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;steps&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;uses&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;actions/checkout@v2&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Checkout my-organization/awesome-action&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;uses&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;actions/checkout@v2&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;with&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;repository&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;my-organization/awesome-action&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;ref&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;refs/heads/master&lt;/span&gt;
          &lt;span class=&quot;c1&quot;&gt;# GitHub's personal access token with access to `my-organization/awesome-action`&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;token&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;$&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;persist-credentials&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;false&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;./.github/actions/awesome-action&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;uses&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;./.github/actions/awesome-action&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Last step&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</description>
        <pubDate>Sat, 02 Nov 2019 13:03:00 +0000</pubDate>
        <link>https://www.pinel.cc/blog/2019/11/02/private-github-actions</link>
        <guid isPermaLink="true">https://www.pinel.cc/blog/2019/11/02/private-github-actions</guid>
        
        
        <category>blog</category>
        
        <category>github</category>
        
        <category>actions</category>
        
        <category>workflow</category>
        
        <category>private</category>
        
      </item>
    
      <item>
        <title>Including AWS Step Functions definitions in AWS SAM templates</title>
        <description>&lt;p&gt;When defining &lt;a href=&quot;https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html&quot;&gt;AWS Step Function&lt;/a&gt; in
&lt;a href=&quot;https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-template-basics.html&quot;&gt;AWS Serverless Application Model (SAM)&lt;/a&gt;, it’s common to have a
template like:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# sam.yaml&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# ...&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;MyStepFunctionsStateMachine&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;AWS::StepFunctions::StateMachine&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;Properties&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;RoleArn&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;!GetAtt&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;MyStepFunctionsRole.Arn&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;DefinitionString&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;!Sub&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;|-&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&quot;StartAt&quot;: &quot;HelloWorld&quot;,&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&quot;Comment&quot;: &quot;Say hello world&quot;,&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&quot;States&quot;: {&lt;/span&gt;
          &lt;span class=&quot;s&quot;&gt;&quot;HelloWorld&quot;: {&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;&quot;Type&quot;: &quot;Task&quot;,&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;&quot;Resource&quot;: &quot;${HelloWorldFunction.Arn}&quot;,&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;&quot;Comment&quot;: &quot;Run the HelloWorld Lambda function&quot;,&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;&quot;End&quot;: true&lt;/span&gt;
          &lt;span class=&quot;s&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# ...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The JSON provided to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DefinitionString&lt;/code&gt; inline can easily get long and make it
harder to maintain the CloudFormation template. Thankfully, as described in
&lt;a href=&quot;https://github.com/awslabs/serverless-application-model/issues/531&quot;&gt;this GitHub issue&lt;/a&gt;, it’s possible to use the macro &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AWS::Include&lt;/code&gt;
to include an external template file as the definition of Step Functions.&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# sam.yaml&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# ...&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;MyStepFunctionsStateMachine&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;AWS::StepFunctions::StateMachine&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;Properties&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;RoleArn&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;!GetAtt&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;MyStepFunctionsRole.Arn&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;Fn::Transform:&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;AWS::Include&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;Parameters&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;Location&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
          &lt;span class=&quot;s&quot;&gt;Fn::Sub: s3://${BucketName}/state-functions-definition.yaml&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# ...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# state-functions-definition.yaml&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;DefinitionString&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;Fn::Sub: |-&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;&quot;StartAt&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;HelloWorld&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Comment&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Say&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;hello&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;world&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;States&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;HelloWorld&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Type&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Task&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;,&lt;/span&gt;
          &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Resource&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;${HelloWorldFunction.Arn}&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;,&lt;/span&gt;
          &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Comment&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;the&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;HelloWorld&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Lambda&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;function&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;,&lt;/span&gt;
          &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;End&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;true&lt;/span&gt;
        &lt;span class=&quot;pi&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;  }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Please note that the template file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;state-functions-definition.yaml&lt;/code&gt; would have
to be copied to the S3 bucket refered by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BucketName&lt;/code&gt; in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sam.yaml&lt;/code&gt; pior to
creating/updating the CloudFormation stack.&lt;/p&gt;

</description>
        <pubDate>Thu, 06 Jun 2019 22:10:00 +0000</pubDate>
        <link>https://www.pinel.cc/blog/2019/06/06/organizing-aws-step-functions-in-serverless-application-model</link>
        <guid isPermaLink="true">https://www.pinel.cc/blog/2019/06/06/organizing-aws-step-functions-in-serverless-application-model</guid>
        
        
        <category>blog</category>
        
        <category>aws</category>
        
        <category>cloudformation</category>
        
      </item>
    
      <item>
        <title>Supported functions in Fn::Transform</title>
        <description>&lt;p&gt;This is a note-to-self about &lt;a href=&quot;https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-transform.html&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn:Transform&lt;/code&gt;&lt;/a&gt; in AWS CloudFormation.
When combined with the macro &lt;a href=&quot;https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/create-reusable-transform-function-snippets-and-add-to-your-template-with-aws-include-transform.html&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AWS::Include&lt;/code&gt;&lt;/a&gt;, as of today, the
included template is limit to these functions:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn::Base64&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn::GetAtt&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn::GetAZs&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn::ImportValue&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn::Join&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn::Split&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn::FindInMap&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn::Select&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ref&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn::Equals&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn::If&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn::Not&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Condition&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn::And&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn::Or&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn::Contains&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn::EachMemberEquals&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn::EachMemberIn&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn::ValueOf&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn::ValueOfAll&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn::RefAll&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn::Sub&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn::Cidr&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By the way, isn’t it amazing that only &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ref&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Condition&lt;/code&gt; are available in short
form? Where’s the consistency, AWS?&lt;/p&gt;

</description>
        <pubDate>Thu, 06 Jun 2019 21:25:00 +0000</pubDate>
        <link>https://www.pinel.cc/blog/2019/06/06/aws-fn-transform-functions</link>
        <guid isPermaLink="true">https://www.pinel.cc/blog/2019/06/06/aws-fn-transform-functions</guid>
        
        
        <category>blog</category>
        
        <category>aws</category>
        
        <category>cloudformation</category>
        
      </item>
    
      <item>
        <title>Seeding databases using more complex Rails fixtures</title>
        <description>&lt;p&gt;Ruby on Rails applications can be easily tested using fixtures to load the initial data. Each fixture filename would normally match the model name, and any exception to that rule would use the &lt;a href=&quot;https://api.rubyonrails.org/v5.2.3/classes/ActiveRecord/TestFixtures/ClassMethods.html#method-i-set_fixture_class&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;set_fixture_class&lt;/code&gt;&lt;/a&gt; method to map the
fixture and the model.&lt;/p&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;set_fixture_class&lt;/code&gt; solution works fine for testings, but it fails when seeding databases with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rails db:fixtures:load&lt;/code&gt; (a.k.a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rake db:fixtures:load&lt;/code&gt;). The mapping created by the method is only available to tests because it is defined directly into the tests Ruby code. Therefore the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;db:fixtures:load&lt;/code&gt; task cannot use it to load the fixtures.&lt;/p&gt;

&lt;p&gt;A solution has recently been &lt;a href=&quot;https://github.com/rails/rails/pull/20574&quot;&gt;introduced to the Rails 5&lt;/a&gt; and will allow the mapping to be done from the fixture file itself. The following case loads the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;User&lt;/code&gt; model from the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;accounts&lt;/code&gt; table:&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# schema.rb&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;create_table&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;accounts&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;force: :cascade&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt;   &lt;span class=&quot;s2&quot;&gt;&quot;name&quot;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;datetime&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;created_at&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;null: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;datetime&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;updated_at&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;null: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# user.rb&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;User&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ActiveRecord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Base&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;table_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'accounts'&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;model_class&lt;/code&gt; property from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_fixture&lt;/code&gt; in the YAML file, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;accounts&lt;/code&gt; fixtures can now instantiate &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;User&lt;/code&gt; records:&lt;/p&gt;

&lt;div class=&quot;language-yml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# accounts.yml&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;_fixture&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;model_class&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;User&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;admin&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Foo'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That allows &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;db:fixtures:load&lt;/code&gt; to recognize the model and to seed the records. The setting is also transparent to the model associations. So if there is a scenario where a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user&lt;/code&gt; can have many &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;roles&lt;/code&gt;, it can be described in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;roles&lt;/code&gt; fixture without any mention to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;accounts&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# schema.rb&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;create_table&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;roles&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;force: :cascade&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt;   &lt;span class=&quot;s2&quot;&gt;&quot;name&quot;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;integer&lt;/span&gt;  &lt;span class=&quot;s2&quot;&gt;&quot;user_id&quot;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;datetime&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;created_at&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;null: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;datetime&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;updated_at&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;null: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# role.rb&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Role&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ApplicationRecord&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;belongs_to&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;inverse_of: :roles&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# user.rb&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;User&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ActiveRecord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Base&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;table_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'accounts'&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;has_many&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:roles&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;inverse_of: :user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;dependent: :destroy&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And for the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;roles&lt;/code&gt; fixtures:&lt;/p&gt;

&lt;div class=&quot;language-yml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# roles.yml&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;admin_role&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;admin'&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;admin&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Back to the tests, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;set_fixture_class&lt;/code&gt; method will overwrite any &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;model_class&lt;/code&gt; setting in fixtures for a more refined control.&lt;/p&gt;

</description>
        <pubDate>Mon, 25 Apr 2016 23:00:00 +0000</pubDate>
        <link>https://www.pinel.cc/blog/2016/04/25/fixtures-and-model-class</link>
        <guid isPermaLink="true">https://www.pinel.cc/blog/2016/04/25/fixtures-and-model-class</guid>
        
        
        <category>blog</category>
        
        <category>rails</category>
        
        <category>ruby</category>
        
      </item>
    
      <item>
        <title>Gerando plugins NPAPI no Windows</title>
        <description>&lt;p&gt;Muitas das extensões para Firefox e Chromium, que são limitadas pelo suporte da API, acabam recorrendo a plugins &lt;a href=&quot;https://en.wikipedia.org/wiki/NPAPI&quot;&gt;NPAPI&lt;/a&gt; para solucionar seus problemas. Plugins NPAPI são programas capazes de serem acessador via JavaScript, e podem ser escritos em linguagens como C++, que facilita em muito certos trabalhos.&lt;/p&gt;

&lt;p&gt;Contudo, a maioria dos plugins possui um núcleo comum, que consiste de sua integração com o navegador. Assim, por que não escrever apenas as funcionalidades que efetivamente caracterizam o plugin? Isso pode ser obtido com o uso de &lt;em&gt;frameworks&lt;/em&gt;, como &lt;a href=&quot;https://code.google.com/archive/p/nixysa/&quot;&gt;Nixysa&lt;/a&gt; e &lt;a href=&quot;https://code.google.com/archive/p/firebreath/&quot;&gt;Firebreath&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Apesar do &lt;em&gt;framework&lt;/em&gt; Nixysa ser mais simples, a pouca documentação torna o trabalho um pouco mais complicado, principalmente para criação de plugins NPAPI em ambientes Windows, as conhecidas DLLs. Assim, descreverei como gerar o plugin a partir do projeto exemplo &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Complex&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Primeiramente, precisaremos instalar algumas dependências:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Um cliente do Subversion, recomendo o &lt;a href=&quot;https://sourceforge.net/projects/win32svn/&quot;&gt;Win32Svn&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;Python &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2.7.1&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://sourceforge.net/projects/pywin32/&quot;&gt;PyWin32-216&lt;/a&gt; para Python &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2.7&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;Se seu sistema for o Windows XP, instale o Service Pack 3.&lt;/li&gt;
  &lt;li&gt;Microsoft Visual C++ 2005 Express Edition.&lt;/li&gt;
  &lt;li&gt;Microsoft Platform SDK.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Após a instalação das dependências, seguindo as opções padrão, adicione alguns diretório ao &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PATH&lt;/code&gt; do ambiente. Verifique se os caminhos utilizados são compatíveis com seu Windows.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:\Python27&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:\Program Files\Subversion\bin&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Abra o Prompt de Comando, pressione &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Win+E&lt;/code&gt; e digite &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cmd&lt;/code&gt;. Digite os seguintes comandos no terminal:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd \
mkdir Sources
cd Soruces
git clone https://github.com/google/nixysa.git nixysa-read-only
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Descrição dos comandos por linha:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Abre a raiz do seu sistema.&lt;/li&gt;
  &lt;li&gt;Cria o diretório &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Sources&lt;/code&gt;, onde o projeto será baixado. Você pode alterar o nome do diretório, mas ele não deve conter espaços ou qualquer caracter especial.&lt;/li&gt;
  &lt;li&gt;Entra no diretório recém criado.&lt;/li&gt;
  &lt;li&gt;Baixa a última versão do repositório do Nixysa, atualmente a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;versão 75&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Utilizando o comando &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dir&lt;/code&gt;, é possível verificar que o &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nixysa-read-only&lt;/code&gt; foi criado. Depois abra o Microsoft Visual Solution (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;complex.sln&lt;/code&gt;) do projeto exemplo.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd nixysa-read-only\examples\complex
start complex.sln
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;/blog/assets/visual-cpp.png&quot;&gt;&lt;img src=&quot;/blog/assets/visual-cpp.png&quot; alt=&quot;Visual C++&quot; height=&quot;154&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Configure o VC++ para trabalhar com o Microsoft Platform SDK. Entre em &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Tools -&amp;gt; Options -&amp;gt; Project and Solutions -&amp;gt; VC++ Directories&lt;/code&gt; e adicione os seguintes diretórios:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Executable files: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:\Program Files\Microsoft Platform SDK\Bin&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Include files: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:\Program Files\Microsoft Platform SDK\Include&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Library files: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:\Program Files\Microsoft Platform SDK\Lib&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href=&quot;/blog/assets/visual-cpp-options.png&quot;&gt;&lt;img src=&quot;/blog/assets/visual-cpp-options.png&quot; alt=&quot;Visual C++ Options&quot; height=&quot;173&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Agore adicione algumas definições para o preprocessador. Entre em &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Project -&amp;gt; Configuration -&amp;gt; C/C++ -&amp;gt; Preprocessor&lt;/code&gt; e adicione &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_X86_;X86&lt;/code&gt; a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Preprocessor Definitions&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/blog/assets/complex-property.png&quot;&gt;&lt;img src=&quot;/blog/assets/complex-property.png&quot; alt=&quot;Complex Property&quot; height=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Abra o arquivo &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;complex.rc&lt;/code&gt; e substitua a linha &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#include &quot;afxres.h&quot;&lt;/code&gt; por &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#include &quot;windows.h&quot;&lt;/code&gt;. Agora bastar pressionar &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;F7&lt;/code&gt; para realizar o &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;build&lt;/code&gt; do projeto. A DLL &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npcomplex.dll&lt;/code&gt; poderá ser encontrada no diretório &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nixysa-read-only\examples\complex\DEBUG&lt;/code&gt;. O plugin também será automaticamente copiado para o diretório &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;%USERPROFILE%\Application Data\Mozilla\Plugins&lt;/code&gt;, em que &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;%USERPROFILE%&lt;/code&gt; representa o diretório do usuário.&lt;/p&gt;

&lt;p&gt;Para testar o plugin, basta abrir o arquivo &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nixysa-read-only\examples\complex\test.html&lt;/code&gt; no Firefox. Lembrando que para testar em navegadores Chromium, a linha &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;object type='application/complex' id='plugin' width='0' height='0'&amp;gt; &amp;lt;/object&amp;gt;&lt;/code&gt; deve ser substituída por &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;embed type=&quot;application/complex&quot; id=&quot;plugin&quot; width='0' height='0'/&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Recomendo também verificar os &lt;a href=&quot;https://github.com/firebreath/FireBreath&quot;&gt;vídeos do Firebreath&lt;/a&gt;, a documentação é bem mais completa que o Nixysa.&lt;/p&gt;

</description>
        <pubDate>Wed, 16 Mar 2011 01:10:00 +0000</pubDate>
        <link>https://www.pinel.cc/blog/2011/03/16/gerando-plugins-npapi-no-windows</link>
        <guid isPermaLink="true">https://www.pinel.cc/blog/2011/03/16/gerando-plugins-npapi-no-windows</guid>
        
        
        <category>blog</category>
        
        <category>web</category>
        
        <category>windows</category>
        
      </item>
    
      <item>
        <title>Acessando partições Ext4 no Mac OS X</title>
        <description>&lt;p&gt;Há algum tempo estive procurando por uma solução eficiente para acessar os dados da partição Ext4 do Ubuntu no Mac OS X (veja &lt;a href=&quot;/blog/2011/03/04/instalando-o-ubuntu-minimal-no-macbook&quot;&gt;Instalando o Ubuntu Minimal no MacBook&lt;/a&gt;). O objetivo era encontrar algo semelhante ao projeto &lt;a href=&quot;https://github.com/alperakcan/fuse-ext2&quot;&gt;fuse-ext2&lt;/a&gt;, que além de facilitar a configuração do ambiente, permite montar automaticamente tanto HD internos e externos.&lt;/p&gt;

&lt;p&gt;Acabei encontrando o projeto &lt;a href=&quot;https://github.com/gerard/ext4fuse&quot;&gt;ext4fuse&lt;/a&gt;, criado e mantido por Gerard Lledó. O ext4fuse é normalmente disponibilizado como código fonte, diretamente do GitHub, e depende do MacFUSE devidamente compilado para ser compilado. Contudo, não consegui compilar as dependências utilizando a última versão do Xcode do Mac OS X Leopard :-(&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ ./core/macfuse_buildtool.sh -t smalldist
failed to determine Xcode version.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Não tendo como resolver a situação, entrei em contato com o Gerard e obtive o &lt;a href=&quot;https://github.com/downloads/gerard/ext4fuse/ext4fuse-24810919&quot;&gt;binário do ext4fuse&lt;/a&gt;. Com ele consegui habilitar corretamente a leitura de partições Ext4. Para configuração do ambiente, baixe o binário e execute os seguintes comandos no diretório onde ele se encontra:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo cp &lt;/span&gt;ext4fuse-24810919 /usr/local/bin/ext4fuse
&lt;span class=&quot;nb&quot;&gt;sudo ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /usr/local/bin/ext4fuse /sbin/mount_fuse-ext4
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Dessa forma, querendo montar, por exemplo, a partição &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/dev/disk0s2&lt;/code&gt; em &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/tmp/discoExt4&lt;/code&gt;, pode-se utilizar os seguintes comandos:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo mkdir&lt;/span&gt; /tmp/discoExt4
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;mount &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; fuse-ext4 /dev/disk0s2 /tmp/discoExt4
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;O mesmo pode ser automatizado criando-se um &lt;em&gt;script&lt;/em&gt; com os comandos e executando-o ao iniciar o sistema.&lt;/p&gt;

</description>
        <pubDate>Sat, 05 Mar 2011 20:40:00 +0000</pubDate>
        <link>https://www.pinel.cc/blog/2011/03/05/acessando-particoes-ext4-no-mac-os-x</link>
        <guid isPermaLink="true">https://www.pinel.cc/blog/2011/03/05/acessando-particoes-ext4-no-mac-os-x</guid>
        
        
        <category>blog</category>
        
        <category>linux</category>
        
        <category>mac</category>
        
      </item>
    
      <item>
        <title>Configurando o Apple Remote Control no Ubuntu</title>
        <description>&lt;p&gt;Mais um artigo da série &lt;a href=&quot;/blog/2011/03/04/instalando-o-ubuntu-minimal-no-macbook&quot;&gt;Instalando o Ubuntu Minimal no MacBook&lt;/a&gt;. Agora apresentando os passos de configuração do controle remoto infravermelho do MacBook no Ubuntu.&lt;/p&gt;

&lt;p&gt;Para o reconhecimento do infravermelho e ativação dos comandos que deverão ser executados para cada tecla do controle, utilizaremos o pacote &lt;a href=&quot;http://www.lirc.org&quot;&gt;LIRC (Linux Infrared Remote Control)&lt;/a&gt;. No Ubuntu, ele pode ser instalado, juntamente com os utilitários, a partir dos comandos como super usuário:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;aptitude &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;lirc lirc-x xautomation
&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; /etc/lirc/lirc
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Após a instalação, basta criar o arquivo de configuração para começar a utilizar o controle de remoto. O arquivo de configuração fica localizado em &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/lirc/lirc/lircrc&lt;/code&gt; e contém o mapeamento dos comandos que serão executados para cada ação do controle. Meu arquivo pode ser baixado &lt;a href=&quot;https://gist.github.com/repinel/fe58ca5216af90eaebf8&quot;&gt;aqui&lt;/a&gt;. A seguir são exibidos dois blocos de configuração desse arquivo.&lt;/p&gt;

&lt;div class=&quot;language-config highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;begin&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;prog&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;irexec&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;button&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;PLAY&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;xte&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'key XF86AudioPlay'&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;begin&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;prog&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;irxevent&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;button&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;PLAY&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;Key&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;F5&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CurrentWindow&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;repeat&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;O primeiro bloco é ativado quando o &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;daemon irexec&lt;/code&gt; está executando, já o segundo é ativado quando o &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;irxevent&lt;/code&gt; está executando. Ambos representam ações que deve ser executadas quando botão PLAY for utilizado. Sendo o primeiro bloco responsável por simular a tecla &lt;em&gt;play&lt;/em&gt; do teclado, e o segundo a tecla F5.&lt;/p&gt;

&lt;p&gt;No meu caso, eu sempre ativo o &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;irexec&lt;/code&gt; para funções multimídias e o &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;irxevent&lt;/code&gt; para apresentações. Contudo, como ativar e desativar os &lt;em&gt;daemons&lt;/em&gt; não era uma tarefa prática, resolvi criar o um GNOME Applet específico para trabalhar com o LIRC, o &lt;a href=&quot;https://github.com/repinel/ir-switcher&quot;&gt;ir-switcher&lt;/a&gt;. Para instalá-lo, basta executar os comandos como super usuário:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;wget &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; ir_switcher.deb https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/ir-switcher/ir_switcher_0.1_all.deb
dpkg &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; ir_switcher.deb
&lt;span class=&quot;nb&quot;&gt;rm &lt;/span&gt;ir_switcher.deb
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Depois é preciso adicioná-lo em um painel do seu ambiente, conforme a imagem.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/ir-switcher-panel.png&quot; alt=&quot;ir-switcher Panel&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Clicando com o botão direito do mouse sobre o ícone é possível escolher qual &lt;em&gt;daemon&lt;/em&gt; executar: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;irexec&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;irxevent&lt;/code&gt; ou os dois. Para iniciar a execução do &lt;em&gt;daemon&lt;/em&gt; selecionado, clique com o botão esquerdo do mouse sobre o ícone e mesmo mudará, indicando a ativação.&lt;/p&gt;

&lt;p&gt;Um artigo mais completo sobre as diferentes configurações do LIRC pode ser achado no &lt;a href=&quot;https://www.vivaolinux.com.br/artigo/LIRC-Linux-Infrared-Remote-Control&quot;&gt;Viva o Linux&lt;/a&gt;. Qualquer dúvida sobre a utilização do ir-switcher, não deixem de entrar em contato.&lt;/p&gt;

</description>
        <pubDate>Sat, 05 Mar 2011 19:56:00 +0000</pubDate>
        <link>https://www.pinel.cc/blog/2011/03/05/configurando-o-apple-remote-control-no-ubuntu</link>
        <guid isPermaLink="true">https://www.pinel.cc/blog/2011/03/05/configurando-o-apple-remote-control-no-ubuntu</guid>
        
        
        <category>blog</category>
        
        <category>linux</category>
        
        <category>mac</category>
        
      </item>
    
      <item>
        <title>Configurando a webcam iSight no Ubuntu</title>
        <description>&lt;p&gt;Continuando o artigo &lt;a href=&quot;/blog/2011/03/04/instalando-o-ubuntu-minimal-no-macbook&quot;&gt;Instalando o Ubuntu Minimal no MacBook&lt;/a&gt;, descreverei como configurar a &lt;em&gt;webcam&lt;/em&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/ISight&quot;&gt;iSight&lt;/a&gt; do MacBook no Ubuntu.&lt;/p&gt;

&lt;p&gt;O driver utilizado pelo &lt;a href=&quot;https://www.kernel.org&quot;&gt;Kernel&lt;/a&gt; para se conectar a câmera é proprietário, mas pode ser obtido a partir do sistema MacOS instalado no próprio MacBook. Considerando, por exemplo, que o MacOS está instalado em &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/dev/sda1&lt;/code&gt;, podemos utilizar os seguintes comandos como super usuário:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;cd
mkdir&lt;/span&gt; /mnt/macosx
mount /dev/sda1 /mnt/macosx
&lt;span class=&quot;nb&quot;&gt;cp&lt;/span&gt; /mnt/macosx/System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBVideoSupport.kext/Contents/MacOS/AppleUSBVideoSupport &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
umount /mnt/macosx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Dessa forma, teremos uma cópia do arquivo &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AppleUSBVideoSupport&lt;/code&gt; na &lt;em&gt;home&lt;/em&gt; do super usuário. Agora precisaremos extrair o &lt;em&gt;firmware&lt;/em&gt; do driver e instalá-lo.&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;add-apt-repository ppa:mactel-support/ppa
aptitude update
aptitude upgrade
aptitude &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;isight-firmware-tools
&lt;span class=&quot;nb&quot;&gt;cp &lt;/span&gt;AppleUSBVideoSupport /lib/firmware/
ift-extract &lt;span class=&quot;nt&quot;&gt;--apple-driver&lt;/span&gt; /lib/firmware/AppleUSBVideoSupport
&lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; /lib/firmware/AppleUSBVideoSupport
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Tendo executado esses comandos o &lt;em&gt;firmware&lt;/em&gt; da webcam já deve estar disponível para ser carregar na próxima vez em que o sistema iniciar. Para testar a captura da imagem, uma boa dica é o programa &lt;a href=&quot;https://wiki.gnome.org/Apps/Cheese&quot;&gt;Cheese&lt;/a&gt;. Ele pode ser instalado diretamente pelo próprio terminal.&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;aptitude &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;cheese
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Lembrando que ao atualizar a versão atual do Kernel, o &lt;em&gt;firmware&lt;/em&gt; deve ser novamente instalado.&lt;/p&gt;

</description>
        <pubDate>Sat, 05 Mar 2011 19:03:00 +0000</pubDate>
        <link>https://www.pinel.cc/blog/2011/03/05/configurando-a-webcam-isight-no-ubuntu</link>
        <guid isPermaLink="true">https://www.pinel.cc/blog/2011/03/05/configurando-a-webcam-isight-no-ubuntu</guid>
        
        
        <category>blog</category>
        
        <category>linux</category>
        
        <category>mac</category>
        
      </item>
    
      <item>
        <title>Instalando o Ubuntu Minimal no MacBook</title>
        <description>&lt;p&gt;As máquinas da Apple não são apenas conhecidas pelo design clean e arrojado, elas também possuem ótima arquitetura computacional. Seus portáteis, como os MacBooks, são reconhecidos por serem mais leves que a maioria da categoria, o que justifica o grande sucesso.&lt;/p&gt;

&lt;p&gt;Mesmo aqueles que não são usuários exclusivos do sistema MacOS acabam optando por esses equipamentos. Mas como deixar seu sistema mais próximo do desempenho do MacOs em MacBooks? Como sugestão, volto ao artigo &lt;a href=&quot;/blog/2011/02/27/tirando-o-melhor-do-ubuntu&quot;&gt;Tirando o melhor do Ubuntu&lt;/a&gt;, que aborda as características do sistema &lt;a href=&quot;https://help.ubuntu.com/community/Installation/MinimalCD&quot;&gt;Ubuntu Minimal&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Algum tempo atrás nem todas as funcionalidades dos MacBooks podiam ser exploradas, como utilizar multi-touch no trackpad e controlar o brilho da tela. Mas hoje, além dessas funcionalides, já temos o aperfeiçoamento da duração bateria em sistemas Linux, devido a novas características do &lt;a href=&quot;https://www.kernel.org&quot;&gt;Kernel&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;O passo inicial para a instalação de um segundo sistema operacional em qualquer máquina é o particionamento, ou reparticionamento. No MacOS, isso pode ser feito através do programa &lt;a href=&quot;https://support.apple.com/boot-camp&quot;&gt;BootCamp&lt;/a&gt;, utilizado na instalação do Windows. O BootCamp pode ser encontrado na pasta Utilities, e como queremos instalar o Ubuntu, iremos utilizá-lo somente até o reparticionamento. Recomendo deixar pelo menos 5GB para o Ubuntu, conforme a imagem.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/boot-camp.png&quot; alt=&quot;Bootcamp&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Após ajeitar o espaço em disco, precisamos permitir o boot do novo sistema. Como a tabela de partições do MacBook não exatamente como a de PCs, não podemos utilizar diretamente o GRUB ou o LILO, assim instalaremos o &lt;a href=&quot;http://refit.sourceforge.net&quot;&gt;rEFit&lt;/a&gt;. Basta baixar o pacote &lt;a href=&quot;https://sourceforge.net/projects/refit/files/rEFIt/&quot;&gt;DMG&lt;/a&gt; da última versão, montá-lo e abrir o &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rEFit.mpkg&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/rEFIt-installer.png&quot; alt=&quot;rEFIt Installer&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Para que a instalação tenha efeito, desligue o MacBook, &lt;strong&gt;não reinicie&lt;/strong&gt;. Ao ligá-lo novamente, deverá aparecer uma tela semelhante a seguinte.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/boot-macos.png&quot; alt=&quot;Boot MacOS&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Com isso, já podemos continuar a instalação do Ubuntu. Baixe e grave a imagem do &lt;a href=&quot;https://help.ubuntu.com/community/Installation/MinimalCD&quot;&gt;Ubuntu Minimal&lt;/a&gt; em um CD. &lt;strong&gt;É importante lembrar que durante todo o processo de instalação seu computador deve estar conectado a internet&lt;/strong&gt;, pois os pacotes do sistema serão baixados sob demanda.&lt;/p&gt;

&lt;p&gt;Para realizar o boot do CD, pressione e segure a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tecla C&lt;/code&gt; ao ligar o MacBook. &lt;strong&gt;Para que o boot ocorra corretamente, sempre desligue a máquina antes de tentar entrar pelo CD, não apenas reinicie&lt;/strong&gt;. Dentre as opções, escolha Install.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/ubuntu-minimal-installer.png&quot; alt=&quot;Ubuntu Minimal Installer&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Durante o processo de instalação, certifique-se de escolhar o teclado correto. Utilizei o &lt;em&gt;USA Macintosh&lt;/em&gt; durante a instação, mas atualmente utilizo o &lt;em&gt;USA International (with dead keys)&lt;/em&gt; devido a acentuação.&lt;/p&gt;

&lt;p&gt;Outro ponto importante é a escolha de onde instalar o GRUB, o &lt;em&gt;boot loader&lt;/em&gt;. Ele deve ser instalado na mesma partição do Ubuntu. Se, por exemplo, o Ubuntu foi instalado em &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/dev/sda2&lt;/code&gt;, então o GRUB também deve ser instalado em &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/dev/sda2&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Seguindo esses passos, Ubuntu deve ser reconhecido pelo rEFit e essa tela aparecerá ao ligar o MacBook.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/boot-macos-linux.png&quot; alt=&quot;Boot MacOS and Linux&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Ao iniciar o Ubuntu, ele consistirá apenas do terminal, sem gerenciador de janelas. Nesse ponto, volto a sugerir o &lt;a href=&quot;https://github.com/AntonioPT/minimal-desktop-for-ubuntu/blob/e799996f02aba1947329cbd57ce343b3848a4431/script.sh&quot;&gt;&lt;em&gt;script&lt;/em&gt;&lt;/a&gt; do grupo &lt;a href=&quot;https://minimal-desktop.blogspot.com&quot;&gt;Minimal Desktop for Ubuntu&lt;/a&gt;. As configurações especiais para o MacBook serão abordadas em posts separados, devido ao aumento da complexidade. Contudo, deixo meu &lt;a href=&quot;https://gist.github.com/repinel/8f15e5acb4fe8a08ecdd&quot;&gt;&lt;em&gt;script&lt;/em&gt;&lt;/a&gt; disponível, visto que ele já possui algumas indicações interessantes.&lt;/p&gt;

</description>
        <pubDate>Fri, 04 Mar 2011 16:51:00 +0000</pubDate>
        <link>https://www.pinel.cc/blog/2011/03/04/instalando-o-ubuntu-minimal-no-macbook</link>
        <guid isPermaLink="true">https://www.pinel.cc/blog/2011/03/04/instalando-o-ubuntu-minimal-no-macbook</guid>
        
        
        <category>blog</category>
        
        <category>linux</category>
        
        <category>mac</category>
        
      </item>
    
      <item>
        <title>Tirando o melhor do Ubuntu</title>
        <description>&lt;p&gt;Há alguns anos sou usuário dedicado de sistemas Linux. Começando pelo famoso &lt;a href=&quot;http://www.slackware.com&quot;&gt;Slackware&lt;/a&gt;, passando pelo mal compreendido &lt;a href=&quot;http://www.linuxfromscratch.org&quot;&gt;Linux from Scratch (LFS)&lt;/a&gt;, o adorável &lt;a href=&quot;https://www.gentoo.org&quot;&gt;Gentoo&lt;/a&gt;, até chegar no prático &lt;a href=&quot;https://www.ubuntu.com&quot;&gt;Ubuntu&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Todas essas distribuições me renderam bom conhecimento e algumas boas práticas. Sempre afirmo que se você deseja conhecer melhor como ambientes Linux funcionam, uma sugestão seria se dedicar por um tempo ao LFS. Inclusive temos uma boa comunidade aqui no Brasil, o LFS-BR.&lt;/p&gt;

&lt;p&gt;Mas recentemente, por sugestão de um amigo, entrei em contato com a versão mínima do Ubuntu. O &lt;a href=&quot;https://help.ubuntu.com/community/Installation/MinimalCD&quot;&gt;Ubuntu Minimal&lt;/a&gt;, como é conhecido pela comunidade, representa a base comum do sistema, sem os adicionais, como o gerenciador de janelas. Como vantagens dessa versão, temos a redução dos serviços instalados, assim como a remoção de componentes que acabariam nunca sendo usados pelo usuário.&lt;/p&gt;

&lt;p&gt;Exatamente por não conter o ambiente gráfico de janelas, o usuário precisa fazer a instalação dos primeiros programas por linha de comando, o que acaba sendo um pouco assustador para alguns. Pensando nisso, e para deixar tudo mais prático, uma parte da comunidade tem se dedicado ao grupo &lt;a href=&quot;https://minimal-desktop.blogspot.com&quot;&gt;Minimal Desktop for Ubuntu&lt;/a&gt;. O grupo consiste de pessoas que documentaram fielmente os passos de instalação e ainda criaram um &lt;a href=&quot;https://github.com/AntonioPT/minimal-desktop-for-ubuntu/blob/e799996f02aba1947329cbd57ce343b3848a4431/script.sh&quot;&gt;&lt;em&gt;script&lt;/em&gt;&lt;/a&gt; interativo para a instalação dos aplicativos básicos, entre eles o ambiente gráfico de preferência.&lt;/p&gt;

&lt;p&gt;Fico feliz em ver que o Ubuntu tem satisfeito tanto os usuários iniciantes como os avançados. E nada melhor do que o comentário de &lt;a href=&quot;https://pt.wikipedia.org/wiki/Linus_Torvalds&quot;&gt;Linus Torvalds&lt;/a&gt; em &lt;a href=&quot;https://www.omgubuntu.co.uk/2011/01/our-exclusive-interview-with-linus-torvalds-lca2011/&quot;&gt;entrevista a OMG! Ubuntu!&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;I think that Ubuntu has done a really, really good job making Linux available to a wider and different audience.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
        <pubDate>Sun, 27 Feb 2011 23:39:00 +0000</pubDate>
        <link>https://www.pinel.cc/blog/2011/02/27/tirando-o-melhor-do-ubuntu</link>
        <guid isPermaLink="true">https://www.pinel.cc/blog/2011/02/27/tirando-o-melhor-do-ubuntu</guid>
        
        
        <category>blog</category>
        
        <category>linux</category>
        
      </item>
    
  </channel>
</rss>
