teleren/devto huggingface dataset:
ClickHouse Server in 1 minute with Docker
Tags: docker, clickhouse, dbms
Published: 2021-03-04 15:41:26

ClickHouse is an open-source column-oriented DBMS (developed by Yandex). ClickHouse works 100-1000x faster than traditional approaches. It's good for Big Data, business analytics and time series data. ClickHouse is the first open source SQL data warehouse to match the performance, maturity, and scalability of proprietary databases like Sybase IQ, Vertica, and Snowflake.

In this little tutorial, I will show you how to install ClickHouse with minimal settings.

For this tutorial, we will need Docker and docker-compose to be installed.

First, you need to create a directory in which to create the necessary files and directories.

```
cd /home/username
mkdir my-clickhouse
cd my-clickhouse
```

Then you need to create a directory in which ClickHouse data will be stored.
<code>
mkdir db
</code>

The final step is to create the docker-compose.yml file.
<code>
version: '3'

services:
  ch_server:
    image: yandex/clickhouse-server
    ports:
      - "8123:8123"
    volumes:
      - ./db:/var/lib/clickhouse
    networks:
        - ch_ntw

  ch_client:
    image: yandex/clickhouse-client
    entrypoint:
      - /bin/sleep
    command:
      - infinity
    networks:
        - ch_ntw

networks:
  ch_ntw:
    driver: bridge
    ipam:
      config:
        - subnet: 10.222.1.0/24
</code>

Let's check what we did. One file (docker-compose.yml) and one directory (db).

<code>
ls -la

drwxr-xr-x 3 user user 4096 Mar  4 07:44 .
drwxr-xr-x 4 user user 4096 Mar  4 07:43 ..
drwxr-xr-x 3 user user 4096 Mar  4 07:45 db
-rw-r--r-- 1 user user  435 Mar  4 07:46 docker-compose.yml
</code>

That's it!

Now let's start our Clickhouse Server. The ClickHouse image will download itself and the process will start.
<code>
sudo docker-compose up -d
</code>

Now let's open the command line.
<code>
sudo docker-compose exec ch_server clickhouse-client
</code>

We should see the result of running ClickHouse.
<code>
ClickHouse client version 21.2.5.5 (official build).
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 21.2.5 revision 54447.

5175e561dffd :)
</code>

Congratulations, ClickHouse is installed successfully.

This is a very simple guide to playing with ClickHouse DB. I will probably write a more serious guide on how to configure ClickHouse later.

Original post: https://twiwoo.com/docker/clickhouse-server-in-1-minute-with-docker/
I've Joined Forem as a Principal SRE
Tags: meta, personalnews, news, career
Published: 2021-03-04 15:35:36

---
title: I've Joined Forem as a Principal SRE
published: true
description: I've decided to join Forem, the company behind the DEV community, CodeNewbie, the DevDiscuss podcast, and the Forem platform
tags: meta, personalnews, news, career
//cover_image: https://direct_url_to_image.jpg
---

A couple of months ago, [Molly](https://dev.to/molly) reached out to let me know that an SRE role had opened up at Forem and asked if it was something I was interested in. At the time, I was a technical lead at [Snapdocs](https://snapdocs.com), focusing on performance and stability of their service-oriented architecture. I was very much not ready to leave yet because there was still so much more work to do on that platform and so many things were really moving in a lot of the right directions. Why would I want to leave?

Well, I'd been keeping my eye on DEV as a company for the past couple of years now. My first interactions with folks on the team really showed their commitment to building a welcoming community, especially for folks who were new to software development. I mean, how awesome would it be to work with a team that was putting so much effort into building a tech-focused community that wants to build people up and actively works against people that would tear others down?

{% tweet 1095887827206893568 %}

And then DEV went open-source, the company rebranded into Forem, and grew from running a single website for a specific community into a platform to foster _many_ communities. I really wanted to be a part of this. And since I've done [a lot of open source for free](https://github.com/jgaskins) and always wanted to work on open source for a living, the idea was that much more enticing.

With all that in mind, I didn't want to pass on an opportunity like this without at least exploring the idea, so I agreed to chat with Molly about it. I asked her approximately 16 million questions and she had great answers for all of them[1]. This made it a really difficult decision (I had two choices, and they were both great for various reasons), but I decided to take the plunge and come work on the Forem platform.

I'm really excited to see what I'll be able to accomplish here. The community is fantastic, my colleagues are fantastic (they're way cooler than I am, though, so I've gotta step up my game a bit), and there are a lot of fantastic problems to solve.

![Everything's coming up Milhouse!](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tdigzgf5sincp802jm4g.gif)

---

[1] One of my favorite responses from her was actually "we're still figuring that out if you'd like to help guide that process". If you're a hiring manager, that's a great response to a candidate's more difficult questions! It shows a culture of collaboration and selects for people who really enjoy the thing that that unfinished process involves.
infinite print
Tags: python
Published: 2021-03-04 15:30:16

#Python
how to make an infinite print in python?
easy:
write in your python console this line of code:
```Python
while(true):
```
and into the loop insert the instruction:
```Python
print("ti amo Lucre")
```
the resul is:
```Python
while(true):
    print("ti amo Lucre")
```
👋 Emojipad with Alfred 🤵‍♂️
Tags: productivity
Published: 2021-03-04 15:30:13

I just like emoji. On Slack, Messages, everywhere. macOS helps us using it with its shortcut `⌘+⌃+Space`. But can we automate it? Let say shortcut `⌘+⌃+1` would type 👍? 
Yes, we can!

1. First you need Alfred with powerpack (paid version). https://www.alfredapp.com
2. [Download and open emoji collection](https://github.com/icanswiftabit/EmojiMacroPad/blob/main/Emoji.alfredsnippets). As Optional  you can create your collection in `Features`>`Snippets`. Snippet [tutorial](https://www.alfredapp.com/help/features/snippets/editing-snippets/).
3. **Important** In the same window opt-in option `Automatically expand snippets by keyword` and `A->`. As it says, this allows Alfred to replace `!et` 🤔 during typing.
![Screenshot 2021-03-04 at 08.12.25](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pm6rx3usqjgxyh7yr1z4.png)
3. [Download and open emoji workflow](https://github.com/icanswiftabit/EmojiMacroPad/blob/main/Emoji.alfredworkflow). As Optional in `Workflow` you can create your own workflow that will trigger `NSAppleScript`. Workflow [tutorial](https://www.alfredapp.com/help/workflows/).
4. Set correct hotkeys by double-clicking on each `Hotkey` node and press your shortcut.
![Screenshot 2021-03-04 at 08.39.09](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zggutxloa600oypry5hw.png)

# End Result
![end result](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7m9w5v9yxs1izbapetne.gif) 
If you have a QMK keyboard you could omit Alfred and send Unicode itself. Let me know if you want to read more about it.
Go Notes: Parsing Claims in Firebase JWT Token
Tags: go
Published: 2021-03-04 15:27:04

---
title: Go Notes: Parsing Claims in Firebase JWT Token
published: true
description: Converting []interface to []string
tags: go, golang
//cover_image: https://direct_url_to_image.jpg
---

I struggled to parse the Firebase JWT Claims. Because claims may contain strings, maps, and arrays, the claims field type is an []interface{}. In this example, one of the claims was a list of permissions. Permissions themselves were just an array of strings. Go does not know that it is an array string, and it is impossible to convert it directly. Instead, we need an intermediary conversion.

The Firebase Token struct is defined as:

```golang
// Token represents a decoded Firebase ID token.
//
// Token provides typed accessors to the common JWT fields such as Audience (aud) and Expiry (exp).
// Additionally it provides a UID field, which indicates the user ID of the account to which this token
// belongs. Any additional JWT claims can be accessed via the Claims map of Token.
type Token struct {
	AuthTime int64				   `json:"auth_time"`
	Issuer   string				   `json:"iss"`
	Audience string				   `json:"aud"`
	Expires  int64				   `json:"exp"`
	IssuedAt int64				   `json:"iat"`
	Subject  string				   `json:"sub,omitempty"`
	UID	  string				   `json:"uid,omitempty"`
	Firebase FirebaseInfo		    `json:"firebase"`
	Claims   map[string]interface{} `json:"-"`
}
```

The field we are concerned with is `Claims`. It is a map of interfaces. It will hold additional information that is added upstream when a user is created. We can assume that one of these pieces of data added is a `roles` field that consists of an array of strings. E.g.: `["role1", "role2", "role3"]`


After extracting the `claims`, and accessing the `roles` field, we need to convert the `interface` type to `[]interface{}`, because we can't convert directly from `interface` to `[]string`:

```golang
roles := claims["roles"]
var roles []string
for _, p := range claims["roles"].([]interface{}) {
   roles = append(roles, p.(string))
}
```

The takeaway for me was that `interface{}` can't be converted to `[]someType{}`. We can only convert from interface to another type if the shapes are similar.

Reference:
https://golang.org/ref/spec#Type_assertions
Do you have Python tips?
Published: 2021-03-04 15:21:55

Hi everyone, 

I'm pretty new in Python devs and I want to know which code structure are you using? Are there some tips to have a clean Python code?

Based on multiple GitHub projects, the one that I used looks like this.
- controllers
- models
- resources
- routes
- services
- static *(for webapps exposed by Flask)*
- templates *(for webapps exposed by Flask)*
- server.py

---

Do you have some other tips for Python projects?

---

Thanks for your help!
How do I make a ruby gem ?
Tags: easy, ruby, gem
Published: 2021-03-04 15:14:14

I am starting a new ruby gem creation project, as a challenge to actually be a software developer and not just someone who does apps, and also a chance to contribute to the open source community. Largely this article is looking at the dev ops approach. The purpose of the gem is for a future article.

Firstly, let's get started with a working gem. In a new Ruby file run bundler, hence, `gem install bundler`. Next run an existing gem, `bundle gem its-name`. 

However, building a gem will be different for everyone. I will be continually updating this thread as the gem progresses, in the meantime, comments are encouraged.

Here's what I have done so far ...

## Step 1
Create a new github repository for your gem and download the repo to your local computer:

```$ git clone https://github.com/your_github_name/your_gem_name_gem```

## Step 2
Create an account on `https://rubygems.org/sign_up`, `RubyGems.org`
Find the `curl` command RubyGems has generated, 
```curl -u your-ruby-gems-name...```
When you run the curl command in the bash terminal this command will connect the GitHub repo to RubyGems.


## Creation of the Gem

Don't forget the version: as part of http convention, you need a version.

## What about Gemfile.lock?

Gemfile.lock is a snapshot of the versions of all gems in the Gemfile at a single point of time. If you studied accounting, then this reference to a balance sheet might help.
It get's automatically generated by `bundle install` so it's advised not to alter it yourself.

More updates to follow ...
A Plea, an Apology, and a Passing Reference to Batman
Tags: wecoded
Published: 2021-03-04 15:04:20

I’m old, white, and male.

This has affected my life in a number of ways. I’ve experienced the birth of the personal computer and watched a few bulletin boards turn into this world-changing phenomenon called the Internet. And I can’t dance and refuse to ask for directions when I’m lost.

But I’ve been very, very privileged to be born as such at a time when to be born otherwise would have made a real difference to my career options: not just in tech, but in any field.

I’ll admit, it took decades for me to notice and appreciate how lucky I’ve been.

I never really thought about the lack of women and minorities in tech - I just assumed that those people had no interest in working in this field. I was never responsible for hiring, so I didn’t see who applied to whatever company I was working for at the time, just who ended up being on the team.

And, nine times out of ten, that was someone like me.

Fast forward a few years, and I find myself surrounded by a wonderful group of people of diverse genders and backgrounds, and I’ve never enjoyed my work as much as I do today. Every day, I’m inspired by something a woman on my team builds, says, or does.

Yet it’s only recently that I’ve thought “Where were these amazing, talented people ten years ago?” And I can only conclude that either they were put off the idea of working in the tech sector by the prevalence of people like me, or applied and were rejected for not fitting the stereotype.

**Well, more fool us**. How much more could we have achieved by being more open to ideas and less close-minded about where those ideas came from? What problems could we have solved or prevented with insights from a much broader perspective than we were open to back then?

The world is changing. Not all those changes are good. But I honestly believe that we’re starting to respect our commonalities more than our differences, especially in the tech sector. This gives me hope that we can make the world a better place for _all_ of us.

But we still need a much broader mix of people than we have now. So if you are a woman or non-binary person who has been put off joining us in the past, I plead you to reconsider now.

You’re not the heroes we deserve, but you are the heroes we need.
AI Fundamentals Series: a basic Artificial Intelligence definition
Tags: ai, machinelearning, python, writing
Published: 2021-03-04 14:59:56

###What is Artificial Intelligence? 🤖 

Below is a broad, high-level definition that actually breaks down into two definitions (it’s definitions all the way down 🐢).

The definition was constructed by Jeremy Kepner and Vijay Gadepally, course instructors at MIT (source below).


>Narrow AI: The theory and development of computer systems >that perform tasks that augment for human intelligence such >as perceiving, classifying, learning, abstracting, reasoning, >and/or acting.

>General AI: Covers the scope of narrow AI but is fully >autonomous.


Today this is possible because of the convergence of High Performance Computing, Big Data, and Computer Algorithms.




####AI ‘Series’ posts

Within this ecosystem (Infinite Waves) of Artificial Intelligence discovery and comprehension there will be off-shoots to explain some of the conceptual underpinnings of AI. Exploring different branches of AI in an attempt to produce the fullest possible picture of the Artificial Intelligence tree. History, companies, people, algorithms, new developments, and likely roots the field will take.

These off-shoots will be called series. The present series, AI Fundamentals, is about digging to the essence of AI, conceptually. Providing explanations, definitions, and general theoretical understanding.

The start here is but a simple seed, with the intention of growing increasingly more detailed and comprehensive in subsequent posts.

**Sources:**

[MIT RES.LL-005 Mathematics of Big Data and Machine Learning, IAP 2020](https://www.youtube.com/watch?v=t4K6lney7Zw&t=157s&ab_channel=MITOpenCourseWare)

[Instructors: Jeremy Kepner, Vijay Gadepally](https://www.youtube.com/watch?v=t4K6lney7Zw&t=157s&ab_channel=MITOpenCourseWare)

Reproduced from my AI newsletter post:

[AI Fundamentals Series: a basic Artificial Intelligence definition #2](https://infinitewaves.substack.com/p/ai-fundamentals-series-a-basic-artificial)
Day 66 Of 100DaysOfCode: Boolean Operators With Numpy
Tags: womenintech, codenewbie, beginners, 100daysofcode
Published: 2021-03-04 14:57:02

Today is my 66th day of #100daysofcode and #python learning. Today also continue to learned from Datacamp including the topic histogram customization using matplotlib, DataFrame from dictionary using pandas, comparison operator, boolean Operators with numpy.
Here is the code for boolean operator with numpy.
#Code
We all are familiar with boolean operators with early days of school. Operators and, or, and not are known as boolean operator. In numpy we can use these operator as np.logical_and(), np.logical_or() and np.logical_not()

```python
import numpy as np
my_house = np.array([18.0, 20.0, 10.75, 9.50])
your_house = np.array([14.0, 24.0, 14.25, 9.0])

# my_house greater than 18.5 or smaller than 10
print(np.logical_or(my_house > 18.5, my_house < 10))

# Both my_house and your_house smaller than 11
print(np.logical_and(my_house < 11, your_house < 11))
```
<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Day 66 Of <a href="https://twitter.com/hashtag/100DaysOfCode?src=hash&amp;ref_src=twsrc%5Etfw">#100DaysOfCode</a> and <a href="https://twitter.com/hashtag/Python?src=hash&amp;ref_src=twsrc%5Etfw">#Python</a> <br>Boolean operators with Numpy From [DataCamp](<a href="https://t.co/5PqrwUYvCB">https://t.co/5PqrwUYvCB</a>)<a href="https://twitter.com/hashtag/womenintech?src=hash&amp;ref_src=twsrc%5Etfw">#womenintech</a> <a href="https://twitter.com/hashtag/100DaysOfCode?src=hash&amp;ref_src=twsrc%5Etfw">#100DaysOfCode</a> <a href="https://twitter.com/hashtag/CodeNewbie?src=hash&amp;ref_src=twsrc%5Etfw">#CodeNewbie</a> <a href="https://twitter.com/hashtag/DEVCommunity?src=hash&amp;ref_src=twsrc%5Etfw">#DEVCommunity</a> <a href="https://twitter.com/hashtag/beginner?src=hash&amp;ref_src=twsrc%5Etfw">#beginner</a> <a href="https://t.co/TU9m891ZPx">pic.twitter.com/TU9m891ZPx</a></p>&mdash; Durga Pokharel (@mathdurga) <a href="https://twitter.com/mathdurga/status/1367485896044539907?ref_src=twsrc%5Etfw">March 4, 2021</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
Why does my winforms app close after a few seconds of loading?
Tags: csharp, dotnet, winforms, help
Published: 2021-03-04 14:55:19

All I do is start the window.
{%youtube 4ePBoCBZxXw%}

My code:
```csharp
using System.Collections.Generic;
using System.Windows.Forms;
using System.Drawing;
using System;



partial class Program {
	List<Control> Elements;
	Dictionary<String, Color> ClrSchm = ColorScheme.LIGHTS_OUT;
	readonly Form Window;
	String Page = "";


	/**
	* Make a new program object.
	*/
	private Program() {
		this.Elements = new List<Control>();



		this.Window = new Form();

		this.Window.ShowInTaskbar = true;
		this.Window.StartPosition = FormStartPosition.CenterScreen;
		this.Window.MinimumSize = new Size(500, 400);
		this.Window.Text = $"{Program.NAME} ({Program.VERSION})";

		this.Window.BackColor = this.ClrSchm["background"];
		this.Window.ForeColor = this.ClrSchm["foreground"];
		this.Window.Visible = true;



		this.Elements = Program.PAGES["."];
	}





	/**
	* Main method.
	*/
	static void Main() {
		Program p = new Program();
		try {
			p.Run();
		} catch(Exception EXC) {
			Program.WriteLog(EXC);
		}
	}



	/**
	* Run method.
	*/
	void Run() {
		//this.UpdateElements();
		Application.Run(this.Window);
	}
}
```
`PAGES`:
```csharp
/**
* Program class.
*/
partial class Program {
	private static readonly Dictionary<String, List<Control>> PAGES =
		new Dictionary<String, List<Control>>() {
			["."] = {
				Program.ProduceButton(10, 10, text:"Settings"),
				Program.ProduceButton(10, 76, text:"New Program")
			}
		};
}
```




The other part of this class isn't important, as I've commented out the call to the method `UpdateElements`. If it is important, let me know.

So, what am I doing wrong? Why does it just load, and then close? Because the program doesn't even leave behind an `EXCEPTION_LOG.txt`, like `Program.WriteLog` should be writing.
Create a loading spinner using pure CSS.
Tags: css, webdev, beginners, tutorial
Published: 2021-03-04 14:40:11

Hello everyone. In this quick tutorial, let's learn how to create a loading spinner using pure CSS in 3 easy steps!

# Step 1 - HTML
Create the HTML structure we need (which is just 1 line)

``` HTML
<div class="spinner"></div>
```
# Step 2 - Add basic styles.

```css
.spinner{
        width: 64px;
        height: 64px;
        border: 8px solid;
        border-color: #3d5af1 transparent #3d5af1 transparent;
        border-radius: 50%;
        animation: spin 1.2s linear infinite;
}
```
# Step 3 - Add the spin animation
```css
 @keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
```
That's it! we have created the loading spinner. Here is the final result.

![spinner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y0blgny0310vxi7q5y3d.gif)

Thank u😀
Simple-Logic-Behind-Jquery
Tags: javascript, jquery
Published: 2021-03-04 14:23:04

```
// make  function with make($)
const $ = (d) => {
// make object
  const self = {
      element:document.querySelector(d),
      html:()=> self.element,
      hide:()=> self.element.style.display="none",
      show:()=> self.element.style.display="",
      click:(event,callback)=>self.element.addEventListener(event,callback),
  };
// return object
  return self
};

// final result
$('body').click('click',()=>console.log('click'))
```