teleren/devto huggingface dataset:
Configuring your mac to display the wifi name on the menu bar
Tags: productivity, tutorial, mac, codenewbie
Published: 2019-04-13 19:33:53

---
title: Configuring your mac to display the wifi name on the menu bar
published: true
description: Utilizing an application called hammerspoon, we write a lua script which displays the name of your wifi network.
tags: productivity, tutorial, mac, codenewbie
---


<img src="https://thepracticaldev.s3.amazonaws.com/i/2mlam08hguywxrpwo8kx.png" alt="a picture of a mac menu bar with network name attached"/>

If you find yourself wondering how to have the name of the network you're connected to on your menu bar, then follow these instructions.

We'll be using an application called [hammerspoon](https://www.hammerspoon.org/), which allows your computer to run lua scripts in the background!

- [Go to hammerspoon's github releases](https://github.com/Hammerspoon/hammerspoon/releases) and install the latest one.
You'll find something like this:

<img src="https://thepracticaldev.s3.amazonaws.com/i/wsmoo6ds5ca4sigmbq1s.png" alt="picture of the hammerspoon releases on github"/>


- Click the first choice, `Hammerspoon-0.9.73.zip`
- Once downloaded, unarchive the zip to your Downloads
<img src="https://thepracticaldev.s3.amazonaws.com/i/oufu8gn6b3p2ogoka7im.jpg" alt="a picture of mac finder showing the downloads of hammerspoon"/>

- Drag the Hammerspoon application to your Applications
- Once in applications, open Hammerspoon with spotlight (press command and space, and type in Hammerspoon, then press enter)
- Once Hammerspoon has been opened for the first time, you should see a security prompt:
<img src="https://thepracticaldev.s3.amazonaws.com/i/fdagv6jgbmie1nml2qd1.jpg" alt="image of accepting hammerspoon security prompt"/>

- Click Open
- Check `Launch Hammerspoon at login`
- Great, now we can add our init script!
- Open your terminal and enter, `touch ~/.hammerspoon/init.lua`,
- Now open init.lua, (located at `~/.hammerspoon/init.lua`)
- Paste in the following code:
```lua
wifiMenu = hs.menubar.newWithPriority(2147483645)
wifiMenu:setTitle(hs.wifi.currentNetwork())

wifiWatcher = nil

function ssidChanged()
    local wifiName = hs.wifi.currentNetwork()
    if wifiName then
        wifiMenu:setTitle(wifiName)
    else
        wifiMenu:setTitle("Wifi OFF")
    end
end

wifiWatcher = hs.wifi.watcher.new(ssidChanged):start()
```
- Quit hammerspoon using `cmd+q`, (not just pressing the red x)
- Reopen hammerspoon

And voila! We now have the name of our network on our menu bar!
Gutenberg - love or hate it, it's here to stay
Tags: wordpress
Published: 2019-04-13 18:21:30

---
title: Gutenberg - love or hate it, it's here to stay
published: true
description: WordPress adopted Gutenberg to mass hatred from developers but love from real users, but should developers start adopting it?
tags: wordpress
---

## What is Gutenberg?

Gutenberg is the new post editor for WordPress websites released in V5, it totally replaced the old editing experience with a brand new, drag and drop editor.

## Why do developers seem to hate it?

There can be a couple of reasons for this and the most obvious is the feeling among developers is the new editor was forced on them, some developers felt the old editor was perfect and didn't need replacing. Gutenberg also uses react, which means a lot of WordPress developers needed to learn a whole new code base to customise the new editor.

## Why was Gutenberg introduced?

Gutenberg was created to make editing your WordPress content easier, the old editor was based on TinyMCE which had a limited editing experience for users. WordPress competitors such as Medium and Wix had much better editing experiences, WordPress was lagging behind massively.

## My thoughts

As a developer, it was scary to learn a new language, a new editor and having to teach my clients a whole new editing experience but overall the editor has massively improved my clients editing experience with WP, they now have an easy to use editor which has it's faults but overall they enjoy using Gutenberg far more than the old editor. They rely on me less to help them update their website content and they have much more control on how their content looks.

## The future

Gutenberg will continue to grow, the editing experience will get better and more users will begin to use it. More developers will get on board with it to expand it's functionality and ultimately both users and developers will wonder why it took so long for WP to replace the old editor.

## What do you think?

Have you used Gutenberg? Did you enjoy the experience? What would you like to see from Gutenberg in the near future?
Automated tests - BDD for your Express backend
Tags: express, testing, automation
Published: 2019-04-13 18:03:18

---
title: Automated tests - BDD for your Express backend
published: true
description: I love BDD.  It made my life as a developer 1000x better. Just because I can fix and create tests way before the product reaches QA time
tags: express, testing, automation
---

I love BDD.  It made my life as a developer 1000x better. Just because I can fix and create tests way before the product reaches QA time. Here are three of the most common types of automated tests:

- Unit tests: A single piece of code (usually an object or a function) is tested, isolated from other pieces
- Integration tests: Multiple sections are examined together, for example, testing database access code against a test database
- Acceptance tests: (also called Functional tests): Automatic testing of the entire application, for example using a tool like Selenium to run a browser automatically.

BDD is TDD on steroids

Let's see first how you can do TDD - Test Driven Development; you need to change the way you develop. Here are the steps you start coding a feature:

- Start by writing a test
- Run the test and any other tests. At this point, your newly added test should - fail. If it doesn’t fail here, it might not be testing the right thing and thus has a bug in it.
- Here you start working at the feature: write the minimum amount of code required to make the test pass.
- Run the tests to check the new test passes
- Optionally refactor your code
- Go back to the first step

It can take some effort to learn well, but spending the time can pay off big. TDD projects often get a code-coverage of 90-100%.


Read the full article on my [blog](https://blog.appseed.us/automated-tests-bdd-adding-tests-with-lab-in-your-project-with-express/). Thank you!


Code less. Live more!
Post update
Tags: career, coding, developer, writing
Published: 2019-04-13 17:01:25

---
title: Post update
published: true
description: My post "Coding as a hobby? For me, non-work coding is a regimen, like going to the gym" has been updated from version 1.1 to 1.2
tags: #career, #coding, #developer, #writing
---

My post [Coding as a hobby? For me, non-work coding is a regimen, like going to the gym](https://dev.to/pskirko/coding-as-a-hobby-for-me-non-work-coding-is-a-regimen-like-going-to-the-gym-4o8m) has been updated from version 1.1 to 1.2.

The new version is shorter, snappier and more to the point. The older versions can be found on GitHub ([see the commit history](https://github.com/pskirko/pskirko-website-writing/commits/master/2019/02/02/coding-as-a-hobby.md)).

Rewriting posts is like refactoring code. You get better at writing by rewriting, and the end result is better and more useful to others.

I also like to version my writing. With dead tree books, you need to print a new edition. With the Web, you just edit and publish the update! The version numbers and Github history help tell a better narrative about how the piece has evolved.
Develop a JS lib these days
Tags: javascript, lib, es6, rollup
Published: 2019-04-13 16:51:31

---
title: Develop a JS lib these days
published: true
description: my attempt to wrap my head on writing a js lib these days
tags: javascript, lib, es6, rollup
---

I wrote about my attempt to wrap my head on writing a js lib these days [on my blog](https://fabiofranchino.com/blog/develop-a-js-lib-these-days/) using Rollup.js and Babel.js of course, making a proof-of-concept in the hope it might be useful to someone.

I'd love to see other attempts from others.
InfluxDB 2.0.0 Alpha 8
Tags: influxdb
Published: 2019-04-13 16:44:06

A new release of InfluxDB 2.0 Alpha is [available now](https://portal.influxdata.com/downloads). As described in our CTO Paul Dix’s [original release announcement for InfluxDB 2.0](https://www.influxdata.com/blog/influxdb-2-0-alpha-release-and-the-road-ahead/), we will be shipping regular updates as we add new features and fix issues. Please keep in mind that these alpha builds are not meant for testing performance or production usage, but more for giving feedback on the functionality, user experience, [and APIs](https://github.com/influxdata/influxdb/blob/master/http/swagger.yml).

*   **InfluxDB 2.0.0 Alpha 8** — [release notes](https://github.com/influxdata/influxdb/blob/v2.0.0-alpha.8/CHANGELOG.md)

This release of InfluxDB 2.0 Alpha includes the following enhancements:

*   Redesigned the navigation to make it easier to find the information you are looking for. In addition, users can quickly create new Organizations and switch between them.
*   We have added the ability to import from a Template for Dashboards and added a new "Getting Started with Flux" Template to help with learning the new language.
*   We've added the ability to give feedback and opt in to user testing sessions from the application. We want to hear what you think!
*   Updated Flux library to version 0.25.0\. Check out the [Flux library release](https://github.com/influxdata/flux/releases/tag/v0.25.0) for the latest updates.

Please download and explore our latest iteration. If you find issues or have questions, please post them in our [InfluxDB Github Repo](https://github.com/influxdata/influxdb/issues) or our [Community Site](https://community.influxdata.com/c/influxdb2) and we will take a look. Thank you for all the interest and positive feedback so far. The latest release of InfluxDB 2.0 Alpha can be [downloaded here](https://portal.influxdata.com/downloads).
Don't be the Executor
Tags: testing, regression
Published: 2019-04-13 16:27:18

---
title: Don't be the Executor
published: true 
description: Off load execution to the machines, it will create visibility and documentation on how. 
tags: testing, regression
---

This is a post for testers, equally applies to devs but they already do this. 

Don't be the guy who opens up the test tool, loads in the test data and clicks the run button on your tests. (feel free to mentally replace test with check) 

It is pretty standard for developers to stand up a build box and have their code compiled and unit tested on a remote server. It is also common to only accept builds from this server, never sending a package off the developer computer to production. 

But in testing this is the norm. Results are produced from a tester machine, their settings and their test data, many times the test results are fixed up after manual testing before anyone else sees it.

Instead look at having tests executed by a different system. If that means setting up Jenkins separate from the devs do it.

I decided to write this after seeing 

{% link https://dev.to/dowenb/two-simple-tests-you-should-be-using-with-postman-53hj %}

And if you're going to us postman you will need [Newman] (https://github.com/postmanlabs/Newman).

# Promotion

Concider following me if you liked the article. Check out my profile to see if you enjoy my other writings. I cover git, testing, D, and more.
Configure security policies by using Azure Security Center 
Tags: azure, security
Published: 2019-04-13 16:01:31

---
title: Configure security policies by using Azure Security Center 
published: true
description: Manage security operations 
tags: #Azure, #Security
---
**Configure endpoint protection**
- The information under Endpoint protection issues can help you create a plan to address any issues identified
- Security Center reports the following endpoint protection issues:
    - Endpoint protection not installed on Azure VMs
    - Endpoint protection not installed on non-Azure computers
    - Endpoint protection health issues
- Security Center presents the endpoint protection issues as a recommendation
![Alt text of image](https://thepracticaldev.s3.amazonaws.com/i/idl12nnsd91y0fs95el5.png)

**Configure centralized policy management by using Azure Security Center**
- By default, all prevention policies are turned on
- Enabling a prevention policy, such as OS vulnerabilities, enables recommendations for that policy
- You can enable or disable recommendations for:
    - System updates
    - OS vulnerabilities
    - Endpoint protection
    - Disk encryption
    - Network security groups
    - Web application firewall
    - Vulnerability Assessment
    - NGFW
    - SQL auditing & Threat detection
    - SQL Encryption
![Alt text of image](https://thepracticaldev.s3.amazonaws.com/i/t0ctl5lybxootl5o7n1o.png)

**Configure vulnerability scanning and policies**
- Azure Security Center provides you with a centralized view of your Azure resources and their active security state
- It provides integrated security monitoring and policy management across your Azure subscriptions, and works with a broad ecosystem of security solutions
- Security Center delivers these solutions through the following capabilities:
    - Prevention
    - Detection
    - Response
- A security policy defines the set of controls that are recommended for resources within the specified subscription or resource group
- In Azure Security Center, you define policies for your Azure subscriptions or resource groups 
- Enabling Security Center and data collection enables all the security policies by default
- Three policy components include:
    - Prevention policy
    - Email notifications
    - Pricing tier
![Alt text of image](https://thepracticaldev.s3.amazonaws.com/i/4e9f1r4egebkq5l28gqi.png)

**Configure JIT VM access by using Azure Security Center**
- RDP brute-force attacks are the attack method most commonly used to access Azure VMs
- To blunt RDP brute-force attacks, you can:
    - Disable the public IP address and use a connection method such as P2S VPN, S2S VPN, or Azure ExpressRoute 
    - Require two-factor authentication
    - Use complex passwords
    - Limit the time that the ports are open 
- Azure Security Center implements the last method by using JIT VM access
- By enabling JIT VM access for your VMs, you can create a policy that determines the ports to help protect, the time ports should remain open, and the approved IP addresses that can access these ports
GitHub Actionsを使って自動でPullRequestを送るものを作った
Tags: github, githubactions
Published: 2019-04-13 14:58:51

---
title: GitHub Actionsを使って自動でPullRequestを送るものを作った
published: true
tags: GitHub,GitHub Actions,
---

こんにちは、.ごっちです。

タイトルの通り、[GitHub Actions](https://developer.github.com/actions/)を使って、自動でPullRequestを送れる仕組みを作りました。

## 試したリポジトリ

{% github YutaGoto/salmon_run %}

### PullRequest

[https://github.com/YutaGoto/salmon_run/pull/383](https://github.com/YutaGoto/salmon_run/pull/383)

### コード

```plain
# .github/main.workflow
workflow "create Master <- develop Pull Request" {
  on = "push"
  resolves = ["Create Pull Request"]
}

action "Filter develop branch only" {
  uses = "actions/bin/filter@master"
  args = "branch develop"
}

action "Create Pull Request" {
  uses = "./.github/actions"
  needs = ["Filter develop branch only"]
  secrets = [
    "GITHUB_TOKEN"
  ]
  env = {
    PULL_REQUEST_TITLE = "Actions sync master <- develop"
    PULL_REQUEST_BODY = "From GitHub Actions"
    BASE_BRANCH = "master"
    HEAD_BRANCH = "develop"
  }
}

```

#### 図解

![workflow](https://thepracticaldev.s3.amazonaws.com/i/4i5sacrt0gzce1vg00qr.png)


## ちょっと解説

```plain
workflow "create Master <- develop Pull Request" {
  on = "push"
  resolves = ["Create Pull Request"]
}
```

workflowそのものを定義します。このworkflowはなにかしらリポジトリに `push` されたタイミングで実行されます。 最初に `Create Pull Request` を実行します。

```plain
action "Create Pull Request" {
  uses = "./.github/actions"
  needs = ["Filter develop branch only"]
  secrets = [
    "GITHUB_TOKEN"
  ]
  env = {
    PULL_REQUEST_TITLE = "Actions sync master <- develop"
    PULL_REQUEST_BODY = "From GitHub Actions"
    BASE_BRANCH = "master"
    HEAD_BRANCH = "develop"
  }
}
```

actionを定義しています。ここで実際にPullRequestを作成する処理をします。
ただその前に `Filter develop branch only` を通過させる必要があります。
それが通過したら、 `.github/actions` のディレクトリ内にある `Dockerfile` に基づいて実行をします。 `Dockerfile` や `entrypoint.sh` の中身については別の記事で書きます。

```plain
action "Filter develop branch only" {
  uses = "actions/bin/filter@master"
  args = "branch develop"
}
```

下のリポジトリにあるものを参照します。このactionでpushされたブランチがdevelopかどうかを判定します。developブランチでなければそのあとのactionは実行しません。

{% github actions/bin %}

## 実行結果

![pr](https://thepracticaldev.s3.amazonaws.com/i/grbfheje0kj3634ekqxr.png)

## 所感

いままで、自分の手でdevelopブランチからmasterブランチにPullRequestを送っていたのですが、このあたりも自動化できることを知って試してみました。
これでわりと面倒な作業がひとつ減った感じでよいです。。
仮に業務で使える感じかなーという思いはあります。例えばdevelopブランチから作業ブランチを生やして、マージされたら自動でmasterやstaging用のブランチに対して自動でPullRequestを送る仕組みとかとかです。
masterやstagingブランチにmergeされたら自動でdeployまでいけると完璧です。（まだやれていません。
Async/Await easy cancellation in c#
Tags: csharp, dotnet, webdev, productivity
Published: 2019-04-13 14:01:16

---
title: Async/Await easy cancellation in c#
published: true
description: An easy way to cancel any type of Tasks after a timeout in c#
tags: csharp , dotnet , webdev , productivity
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/cds2j0zl1o30j6rimj41.jpeg
---
Using async/await is so fun but in the same time there are plenty of situations which the awaiting part can stuck forever, specially when there is any involvement of programming over the network. Other than that there are situations which the app must not wait more than a timeout for a response. 

Therefore, the ability to set a timeout for a asynchronous operation is a must, by using CancellationToken one can achieve this and this post will demonstrate an easier method of using these CancellationTokens by applying an extension method for the Task object type.

## Implementation 

{% gist https://gist.github.com/AliTabryzy/6db5105902508d2336b0a4294d9a9e8f %}

## [NuGet](https://www.nuget.org/packages/easyAsyncCancel) Installation

```
.Net CLI
dotnet add package easyAsyncCancel

Package Manager
Install-Package easyAsyncCancel

```

## Usage

Let's say there is a Task which it can take unknown amount of time to finish  

```c#
private async Task Task_NetworkBound()
{
    await new HttpClient().GetStringAsync("https://dotnetfoundation.org");
}
```
In order for the task to get canceled after 1 seconds 

```c#
await Task_NetworkBound().CancelAfter(1000);
OR
await Task_NetworkBound().CancelAfter(1000,"Custom OperationCanceledException message");
```

### Test it

```c#
[TestFixture]
public class TaskCancellationTest
{
    private async Task Task_NetworkBound()
    {
        await new HttpClient().GetStringAsync("https://dotnetfoundation.org");
    }

    private async Task<string> Task_NetworkBound_T()
    {
        return await new HttpClient().GetStringAsync("https://dotnetfoundation.org");
    }
    
    [Test]
    public void Test_CancelWithMilliseconds()
    {
        Assert.ThrowsAsync<OperationCanceledException>(
            async () => { await Task_NetworkBound().CancelAfter(1000); });
        
        Assert.ThrowsAsync<OperationCanceledException>(
            async () => { await Task_NetworkBound_T().CancelAfter(1000); });
    }
    
    
    [Test]
    public void Test_CancelWithToken()
    {
        Assert.ThrowsAsync<OperationCanceledException>(async () =>
        {
            var cts = new CancellationTokenSource();
            cts.CancelAfter(1000);
            await Task_NetworkBound().CancelAfter(cts.Token);
        });
        
        
        Assert.ThrowsAsync<OperationCanceledException>(async () =>
        {
            var cts = new CancellationTokenSource();
            cts.CancelAfter(1000);
            await Task_NetworkBound_T().CancelAfter(cts.Token);
        });
    }
}
```
>**Full source code [here](https://github.com/AliTabryzy/com.appelinda.nuget.easyAsyncCancellation)**

Happy coding :)
My First Website
Tags: webdeveloper, beginners, javascript, react
Published: 2019-04-13 12:45:28

---
title: My First Website
published: true
description: Built my own website in Gatsby
tags: webdeveloper, beginner,javascript, react
---

Okay! Here goes,  ¯\_(ツ)_/¯

That took me a while to design and develop a website for me from scratch using **gatsby**

What do I have there?

- Theme (dark / light)

- Responsiveness(mobile/tablet/desktop)

- Animations (A little)

- All my blogs, portfolio, blah, blah blah..



Last but not the Least, it is Fast 😄😅


Link to my Website:

https://www.dhilipkmr.dev


Do let me know your comments personally or in comments.



Github link for my website,

https://github.com/dhilipkmr/website
Elixir入門の連載を開始(Elixir入門もくじ)
Tags: elixir, webdev, news, programming
Published: 2018-10-02 07:45:15

---
title: Elixir入門の連載を開始(Elixir入門もくじ)
published: true
description: 
tags: #elixir, #webdev, #news, #programming
---

gumi TECH Blogでは「Elixir入門」の連載を始めます。

[![elixir_logo.png](https://thepracticaldev.s3.amazonaws.com/i/057beh87vjaz37ui9hg4.png)](https://elixir-lang.org/)

[Elixir](https://elixir-lang.org/)(エリクサー)は[gumi](https://gu3.co.jp/)も採用しているプログラミング言語で、たくさんのユーザーが同時プレイするリアルタイムオンラインゲームの開発に使われています。特徴は、並行処理ができる関数型言語だということです。関数型プログラミングは、状態を変化させません。かわりに新しい状態をつくるというアプローチにより、並行処理がシンプルに扱えるのです。

Elixirは[Erlang](http://www.erlang.org/)(アーラン)の仮想マシン上で動きます。Erlangは1980年代に生まれ、電話用アプリケーションの開発に使われた言語です。そのため分散アプリケーションがつくりやすく、障害に耐性をもちます([フォルトトレラント](https://ja.wikipedia.org/wiki/%E3%83%95%E3%82%A9%E3%83%BC%E3%83%AB%E3%83%88%E3%83%88%E3%83%AC%E3%83%A9%E3%83%B3%E3%83%88%E8%A8%AD%E8%A8%88))。信頼性の高いスケール可能なインターネットアプリケーションを運用するのにはうってつけです。

Elixirは[Plataformatec社](http://plataformatec.com.br/)の共同創設者[José Valim](https://twitter.com/josevalim)氏によって開発されました。Plataformatec社による[Elixirサイト](https://elixir-lang.org/)には、入門者向けに「[GETTING STARTED](https://elixir-lang.org/getting-started/introduction.html)」というガイドがあり、23章にわたって基本的な解説をしています。

「Elixir入門」はPlataformatec社の許諾を得て、全23章を日本語で解説する連載です。ただし、翻訳ではなく、内容を整理したり、説明やコードも補ったり、より理解しやすくなるように手を入れています。この連載が日本のElixirユーザーのお役に立てば幸いです。23章の日本語タイトルは、つぎのとおりです。公開された記事には、その都度リンクを加えてゆきます。

#### Elixir入門もくじ
- [Elixir入門 01: コードを書いて試してみる](https://dev.to/gumi/elixir-01--2585)
- [Elixir入門 02: 型の基本](https://dev.to/gumi/elixir-02--30n1)
- [Elixir入門 03: 演算子の基本](https://dev.to/gumi/elixir-03--33im)
- [Elixir入門 04: パターンマッチング](https://dev.to/gumi/elixir-04--1346)
- [Elixir入門 05: 条件 - case/cond/if](https://dev.to/gumi/elixir-05----casecondif-60o)
- [Elixir入門 06: バイナリと文字列および文字リスト](https://dev.to/gumi/elixir-06--35na)
- [Elixir入門 07: キーワードリストとマップ](https://dev.to/gumi/elixir-07--39hi)
- [Elixir入門 08: モジュールと関数](https://dev.to/gumi/elixir-08--1c4c)
- [Elixir入門 09: 再帰](https://dev.to/gumi/elixir-09--1a0p)
- [Elixir入門 10: EnumとStream](https://dev.to/gumi/elixir-10-enumstream-4fpb)
- [Elixir入門 11: プロセス](https://dev.to/gumi/elixir-11--2mia)
- [Elixir入門 12: 入出力とファイルシステム](https://dev.to/gumi/elixir-12--4og6)
- [Elixir入門 13: aliasとrequireおよびimport](https://dev.to/gumi/elixir-13-aliasrequireimport-55c1)
- [Elixir入門 14: モジュールの属性](https://dev.to/gumi/elixir-14--3511)
- [Elixir入門 15: 構造体](https://dev.to/gumi/elixir-15--4f43)
- [Elixir入門 16: プロトコル](https://dev.to/gumi/elixir-16--lif)
- [Elixir入門 17: 内包表記](https://dev.to/gumi/elixir-17--5gci)
- [Elixir入門 18: シギル](https://dev.to/gumi/elixir-18--5791)
- [Elixir入門 19: tryとcatchおよびrescue](https://dev.to/gumi/elixir-19-trycatchrescue-50i8)
- [Elixir入門 20: 型の仕様とビヘイビア](https://dev.to/gumi/elixir-20--j50)
- [Elixir入門 21: デバッグ](https://dev.to/gumi/elixir-21--21a1)
- [Elixir入門 22: Erlangライブラリ](https://dev.to/gumi/elixir-22-erlang-2492)
- [Elixir入門 23: つぎのステップ](https://dev.to/gumi/elixir-23--50ik)

##### 番外
- [Elixir入門: Plugを使うには](https://dev.to/gumi/elixir-plug-40lb)