<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: katydidknot</title>
    <description>The latest articles on DEV Community by katydidknot (@katydidknot).</description>
    <link>https://dev.to/katydidknot</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F432808%2F12b8eaef-0d3a-4184-bc98-5cb9fd287efa.png</url>
      <title>DEV Community: katydidknot</title>
      <link>https://dev.to/katydidknot</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/katydidknot"/>
    <language>en</language>
    <item>
      <title>How to quickly delete multiple jobs in kubernetes</title>
      <dc:creator>katydidknot</dc:creator>
      <pubDate>Thu, 21 Jan 2021 19:11:04 +0000</pubDate>
      <link>https://dev.to/focused_dot_io/how-to-quickly-delete-multiple-failed-jobs-in-kubernetes-387b</link>
      <guid>https://dev.to/focused_dot_io/how-to-quickly-delete-multiple-failed-jobs-in-kubernetes-387b</guid>
      <description>&lt;p&gt;Kube jobs running wild?&lt;/p&gt;

&lt;p&gt;To delete successful jobs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;kubectl&lt;/span&gt; &lt;span class="k"&gt;delete&lt;/span&gt; &lt;span class="nx"&gt;jobs&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;field&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;selector&lt;/span&gt; &lt;span class="nx"&gt;status&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;successful&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To delete failed or long running jobs&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;kubectl&lt;/span&gt; &lt;span class="k"&gt;delete&lt;/span&gt; &lt;span class="nx"&gt;jobs&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;field&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;selector&lt;/span&gt; &lt;span class="nx"&gt;status&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;successful&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Get rid of them all!&lt;/p&gt;

</description>
      <category>devops</category>
      <category>womenintech</category>
      <category>kubernetes</category>
    </item>
    <item>
      <title>Cancelling a stripe subscription on 'period end'</title>
      <dc:creator>katydidknot</dc:creator>
      <pubDate>Sun, 17 Jan 2021 19:11:01 +0000</pubDate>
      <link>https://dev.to/focused_dot_io/cancelling-a-stripe-subscription-on-period-end-5app</link>
      <guid>https://dev.to/focused_dot_io/cancelling-a-stripe-subscription-on-period-end-5app</guid>
      <description>&lt;p&gt;Stripe's documentation on cancelling a subscription at the end of a period isn't entirely up to date.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://stripe.com/docs/billing/subscriptions/cancel" rel="noopener noreferrer"&gt;https://stripe.com/docs/billing/subscriptions/cancel&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For cancelling at end of period, the docs say to do the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;Stripe&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nx"&gt;Subscription&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sub_&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;cancel_at_period_end&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Easy enough, right? &lt;/p&gt;

&lt;p&gt;WRONG.&lt;/p&gt;

&lt;p&gt;When actually doing this we were getting the following error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;error&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;The subscription is managed by the subscription schedule `sub_sched_`, and updating any cancelation behavior directly is not allowed. Please update the schedule instead.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;type&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;invalid_request_error&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After contacting stripe support, if you wish to cancel at the period end you need to do the following:  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Update phases on subscription schedule object to pass only current phase.&lt;/li&gt;
&lt;li&gt;Set end_behavior to 'cancel'
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;Stripe&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nx"&gt;SubscriptionSchedule&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sub_sched_&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;end_behavior&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cancel&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Links: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://stripe.com/docs/billing/subscriptions/subscription-schedules#updating" rel="noopener noreferrer"&gt;https://stripe.com/docs/billing/subscriptions/subscription-schedules#updating&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://stripe.com/docs/api/subscription_schedules/update?lang=ruby" rel="noopener noreferrer"&gt;https://stripe.com/docs/api/subscription_schedules/update?lang=ruby&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>ruby</category>
      <category>rails</category>
      <category>todayilearned</category>
    </item>
    <item>
      <title>Echo Cancellation with Web Audio Api and Chromium</title>
      <dc:creator>katydidknot</dc:creator>
      <pubDate>Tue, 17 Nov 2020 19:49:10 +0000</pubDate>
      <link>https://dev.to/focused_dot_io/echo-cancellation-with-web-audio-api-and-chromium-1f8m</link>
      <guid>https://dev.to/focused_dot_io/echo-cancellation-with-web-audio-api-and-chromium-1f8m</guid>
      <description>&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;Recently, I ran into a doozy of a bug in Chromium. My pair and I were working on an application that was taking advantage of audio processing using the WebAudio Api. Part of the processing in question was the ability to spatially interact with noise based on the user's position in the application. We were building this application on top of a conferencing api stream that already had it's own processing built in. This added more complexity to the problem, as we had to yank the media stream coming through that api to apply the spatial processing, and then feed it back to the user all tidied up and ready to blow their minds.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;However, then came Chromium… The spatial awesomeness was working, and pretty neat, but the minute you took your headphones off- BAM, a sound only fit to be heard at experimental electronic basement shows came wallowing through our speakers. An extensive google search revealed an open bug lurking in the &lt;a href="https://bugs.chromium.org/p/chromium/issues/detail?id=687574" rel="noopener noreferrer"&gt;issues log.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It seems Chromium does not apply echo cancellation to any remote streams- including WebAudio Api streams. To save others the trouble in working with the WebAudio Api in Chromium, we wanted to collect and share our findings from the community, and ultimately what worked for us. &lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1:
&lt;/h2&gt;

&lt;p&gt;Create your audio processing and apply it to your stream&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;audioContext&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;AudioContext&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;destinationNode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;audioContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createMediaStreamDestination&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;audioContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createMediaStreamSource&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;MediaStream&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nx"&gt;audioStream&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getAudioTracks&lt;/span&gt;&lt;span class="p"&gt;()[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]]))&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;createDistortion&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;audioContext&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;destinationNode&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Note: audioStream is our current media stream that we want to apply audio processing to.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Be careful, as there are two destination nodes as part of Web Audio API. One is the audioContext.destination, and the other is audioContext.createMediaStreamDestination(); &lt;strong&gt;&lt;em&gt;---&amp;gt; use this one.&lt;/em&gt;&lt;/strong&gt;  &lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2:
&lt;/h2&gt;

&lt;p&gt;Create your audio loopback stream&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;loopbackStream&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;createLoopbackConnection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;destinationNode&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The function createLoopbackConnection is setting up a local webRTC loopback connection. Chromium then picks this up and applies echo cancellation. Voila! Here's a helpful gist in the Chromium issue log we found to see &lt;a href="https://gist.github.com/alexciarlillo/4b9f75516f93c10d7b39282d10cd17bc" rel="noopener noreferrer"&gt;how to do this.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: One important hiccup that tripped us up in the creation of a local loopback connection, was trying to use addStream which is deprecated- use addTrack to circumvent this.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3:
&lt;/h2&gt;

&lt;p&gt;Feed the loopback stream into your audio element. &lt;/p&gt;

&lt;p&gt;In our case we had an existing audio element that was backed by the conferencing api we were using. We did not have to create one, but rather feed the processed stream into the existing audio element.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;audioElement&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`audio-element`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;audioElement&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;srcObject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;loopbackStream&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4:
&lt;/h2&gt;

&lt;p&gt;Rejoice in the fact that your ears no longer hear feedback! &lt;br&gt;
You no longer need to use headphones after applying audio processing in Chromium! &lt;/p&gt;

&lt;h2&gt;
  
  
  Lessons learned:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Debugging audio feedback with a pair is really hard.&lt;/li&gt;
&lt;li&gt;Debugging audio feedback without a pair is even harder.&lt;/li&gt;
&lt;li&gt;Always check issues logs.&lt;/li&gt;
&lt;li&gt;Take care of your ears!
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>webrtc</category>
      <category>webdev</category>
      <category>womenintech</category>
    </item>
  </channel>
</rss>
