teleren/devto huggingface dataset:
LocalHackDay2021
Tags: mlh, majorleaguehacking, localhackday
Published: 2021-01-18 03:00:24

Local Hack Day has been a fun week with lots of creative challenges. It was a great opportunity to explore new things and learn them along the way. I came across highly skilled people who shared their vision which left me awestruck. This platform was a great kickstart for me in the Dev World.
Convert an old PC into a network-attached storage (NAS) using open-source software!
Tags: linux, systems
Published: 2021-01-18 02:56:55

https://openmediavault.readthedocs.io/en/5.x/

This is a fun experiment to try at home for building a media device, backup storage, or anything you'd like! E-waste can be mitigated by refurbishing old (but good) hardware as the DEV community already knows 🌱

The image is Debian 🐧  based with good support available online. Note the requirements above.

A few tips: you may need legacy BIOS available as an option, in order for the OS bootloader (grub) to install correctly.  Configuring remote network settings, IPv4 management, and software updates are further maintenance steps. Happy Monday! 🤜🤛
Zip Iterator in Typescript
Tags: typescript, webdev, python
Published: 2021-01-18 02:25:46

*The code in this article and an implementation of `zipLongest` are in [this gist](https://gist.github.com/chrismilson/e6549023bdca1fa9c263973b8f7a713b).*

The built-in `zip` function is ubiquitous in python. It allows highly readable iteration over multiple iterables:

```python
def naturals():
    n = 1
    while True:
        yield n
        n += 1

for n, c in zip(naturals(), "Hello!"):
    print(n, c)
# 1 H
# 2 e
# 3 l
# 4 l
# 5 o
# 6 !
```

Now, with [Mapped Types in typescript](https://github.com/Microsoft/TypeScript/pull/26063), we can do the same thing, all while keeping our lovely types too!

With mapped types, we can make an `Iterableify` type, which will take a type, and change it so that its members are of type Iterable:

```ts
type Iterableify<T> = { [K in keyof T]: Iterable<T[K]> }
```

For example

```ts
type T1 = Iterableify<string[]> // Iterable<string>[]
type T2 = Iterableify<{a: number, b: string}> // {a: Iterable<number>, b: Iterable<string>}
type T3 = Iterableify<[number, string][]> // Iterable<[number, string]>[]
```

We can then make a simple zip function like so:

```ts
function* zip<T extends Array<any>>(
    ...toZip: Iterableify<T>
): Generator<T> {
    // Get iterators for all of the iterables.
    const iterators = toZip.map(i => i[Symbol.iterator]())

    while (true) {
        // Advance all of the iterators.
        const results = iterators.map(i => i.next())

        // If any of the iterators are done, we should stop.
        if (results.some(({ done }) => done)) {
            break
        }

        // We can assert the yield type, since we know none
        // of the iterators are done.
        yield results.map(({ value }) => value) as T
    }
}
```

Since the mapped types affect typescript tuples as well, we can now do something like this:

```ts
for (const [a, b] of zip([1, 2, 3], "abc")) {
    // type of a is number!
    // type of b is string!

    // This has no compilation errors!
    console.log(b.repeat(a))
}
```
Which Websites are Developed Using Python?
Tags: python, startup, devops, programming
Published: 2021-01-18 02:22:42

We all know that the Python programming language is the most popular, and for web development, it is used mostly. Most of the most successful famous websites are developed using the Python language. In this blog, you can get some world's great famous websites created in Python; here the list is,

Instagram
Spotify
Youtube
Flipkart
Quora
Uber
Slack
Zenefits
Pinterest
Cloudera

Now let's move to the world's great organizations using Python Language,

##Organizations using Python:

Big organizations and startups, and small organizations are also using Python language to make their business more future-oriented to meet customers' requirements and improve their productivity.

To add more functionality and maintenance, governmental organizations are also using Python for their website. One of the best examples is the USA's Central intelligent Agency (CIA). 

Here I list down the world's largest organizations using Python continuously and deal with their chief areas of production its development frameworks.

Yahoo! Maps 
Google
NASA
Red Hat
Walt Disney Feature Animation
IBM
Nokia
AlphaGene, Inc.
SGI, Inc.

#Conclusion:

The world's most prominent organizations and websites are created in Python. This is Clear that Python Programming Language is now one of the most trending, popular, future-oriented languages with a wide scope. If you plan to hire Python programmer or [hire Python developer ](https://www.bacancytechnology.com/hire-python-developer) for your organizations or startups, you are making the best decision for your business success. Let me give you the best preferable [Python development company](https://www.bacancytechnology.com/python-development) that is Bacancy Technology. Thank you.
MLH Local hack day build
Tags: mlh, localhackday, build
Published: 2021-01-17 23:26:17

 Let me just start by saying these past 7 days in the MLH LHD Build 2021 have been a roller coaster of hard work and determination. I have learned so much and still learning from one of the best out there. On the first day, we were greeted by the most humble Ryan (Totally not Ryan) and Mary who introduced us to the wonderful world of MLH explaining each and every process down the line, holding our hands and guiding us through each problem while maintaining such a friendly and cooperative attitude. They did not allow us to feel for one second that we were not meant to be here.
After that the 7 days we spent was with the best people from the best of places. Jack's Blahaj was by far one of the most interesting and intriguing IKEA meatballs that I had seen :D.
All in all I've had the most wonderful time in the community. Everyone is super supportive and cooperative. No one is ignored. People are always out there to help. I would definitely recommend people who are looking for a jump in their IT career to attend these workshops.
Creating Shopify theme from scratch - Part 1
Tags: shopify, liquid, tutorial, themekit
Published: 2021-01-18 01:23:08

Ever want to start creating your own Shopify theme and not sure where to start?
This will assume you know HTML/CSS/JS basics and how Shopify works.

## Getting access to a Shopify store

The best way to get access to a development Shopify store is being a Shopify partner.
1. You can sign up at https://www.shopify.com/partners for free.

2. Create your development store
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/crpdnipb6ew6uq1kooa9.png)

3. Add collections and products.

4. Get API access for private apps. (Themekit will use the API credentials in the Part 2)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/q3axlo8avruluc0c5ktz.png)

5. Click **Create new private app**
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/vyvl8qb3vnmy2o7kuxwa.png)

6. Fill in the app name and your email.
Make sure to click **Show inactive Admin API permissions** and give *read and write* access for _**Themes**_
Leave the **Webhook API version** to the latest and the **Storefront API** box unchecked, then SAVE
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/frvvtqg6jehowposrx9o.png)

7. Copy down the API password. (Themekit will use the API password in the Part 2)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/lfd9ltsg27lmmklo0b0k.png)

You can always go back to the private apps section to get the API credentials.
สั่งรันโปรแกรม บน docker container ที่กำลังรันอยู่
Tags: docker, programming
Published: 2021-01-18 00:38:45

ถ้ามี container ที่รันอยู่แล้ว เช่น container ที่รัน MySQL อยู่ เช็คด้วย `docker ps` แล้วเจอแบบนี้

```
$ docker ps
CONTAINER ID   IMAGE     COMMAND                  CREATED       STATUS      PORTS                               NAMES
963b015eb1c1   mysql:8   "docker-entrypoint.s…"   4 weeks ago   Up 2 days   0.0.0.0:3306->3306/tcp, 33060/tcp   mysql_container
```

แล้วถ้าเราอยากสั่งรันโปรแกรมอื่นๆ เช่นจะเรียกใช้ mysql client command ที่ติดตั้งไว้ภายใต้ container ที่กำลังรันอยู่นี้ด้วย เราสามารถใช้คำสั่ง `docker exec` ช่วยได้

เราลองดู help ของคำสั่งนี้กันก่อนด้วย `docker help exec` จะเจอแบบนี้

```
$ docker help exec

Usage:  docker exec [OPTIONS] CONTAINER COMMAND [ARG...]

Run a command in a running container

Options:
  -d, --detach               Detached mode: run command in the background
      --detach-keys string   Override the key sequence for detaching a container
  -e, --env list             Set environment variables
      --env-file list        Read in a file of environment variables
  -i, --interactive          Keep STDIN open even if not attached
      --privileged           Give extended privileges to the command
  -t, --tty                  Allocate a pseudo-TTY
  -u, --user string          Username or UID (format: <name|uid>[:<group|gid>])
  -w, --workdir string       Working directory inside the container
```

ซึ่งในกรณีนี้เราจะใช้ option `-it` เพราะต้องการให้ client ทำงานโดยมี interactive terminal รอรับคำสั่งที่เราจะพิมพ์ลงไปที่ mysql client ด้วย

ตัวอย่างการใช้งานในการเรียก mysql client ให้รันภายใต้ container ชื่อ mysql_container เป็นดังนี้

```
$ docker exec -it mysql_container mysql -p test
```

นั่นคือสั่ง `docker exec -it` ตามด้วยชื่อ container `mysql_container` ตามด้วยคำสั่งและ option ของคำสั่งที่จะรัน `mysql -p test` เท่านี้เราก็รันคำสั่งที่ต้องการภายใต้ container ที่กำลังทำงานอยู่ได้แล้ว

<a href="https://www.buymeacoffee.com/weerasak" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
Format Swift on Save - AppCode with swift-format
Tags: swift, tooling
Published: 2021-01-18 00:01:12

{% youtube Gm8R9NxoOlE %}

Coming from WebStorm and TypeScript land, I got sick of not having auto-formatted code while working on a small Front End SwiftUI project. After finally figuring out how to autoformat my Swift code, I had to share as NO RESULTS ONLINE WERE HELPFUL!

See below and linked video. Let me know if you have any questions or suggestions for improvements. 

1. brew install nshipster/formulae/swift-format
2. Create external tool 
3. Name it swift-format
4. Under Tool Settings > Arguments:        --in-place $FilePath$
5. Advanced Options > Uncheck Open console for tool output
6. Click OK
7. Click Apply
8. Create a Keymap for your new external tool by searching for “swift-format” and double clicking on the result
9. Open any code file
10. Edit > Macros > Start Macro Recording
11. Invoke the keycap from step 6 and then save your file
12. Click the stop button in the bottom right hand of your editor to stop the macro
13. LAST STEP Assign the ⌘S keymap to your new macro
Creating Go Application Releases with GoReleaser
Tags: go, devops, github, actions
Published: 2021-01-19 02:43:56

---
title: Creating Go Application Releases with GoReleaser
published: true
date: 2021-01-18 00:00:00 UTC
tags: go, devops, github, actions
canonical_url: https://hector.dev/2021/01/18/creating-go-application-releases-with-goreleaser/
---

A few weeks ago, I set out to upgrade the version of Go (1.6 to 1.15) used to build an old command-line utility I developed, named [Heimdall](https://github.com/hectcastro/heimdall). Heimdall provides a way to wrap an executable program inside of an exclusive lock provided by a central PostgreSQL instance via `pg_try_advisory_lock`.

Now, Heimdall is nice little utility and all (if you’re intrigued, check out the `README`), but the most interesting part of the upgrade process came after I got everything working and started to think about how to create a new release. That’s when I came across [GoReleaser](https://goreleaser.com).

## GoReleaser

GoReleaser is a release automation tool specifically for Go projects. With a few bits of [YAML configuration](https://github.com/hectcastro/heimdall/blob/1ffc81c5457ae8692b18117a8329e3e3997e80e1/.goreleaser.yml), GoReleaser provided me with:

- Hooks into the Go module system for managing library dependencies
- The ability to easily produce a set of [build artifacts](https://github.com/hectcastro/heimdall/releases/tag/1.0.0) for multiple operating systems and computer architectures
- [Checksums](https://github.com/hectcastro/heimdall/releases/download/1.0.0/checksums.txt) for each of the build artifacts
- Easy [integration with GitHub Actions](https://github.com/hectcastro/heimdall/blob/1ffc81c5457ae8692b18117a8329e3e3997e80e1/.github/workflows/goreleaser.yml) to automate publishing releases on tagged commits

If you are responsible for Go applications that are in need of a uniform release process, I find it really hard to beat GoReleaser.
10 Clean code examples (Javascript).
Tags: javascript, webdev, tutorial, codenewbie
Published: 2021-01-17 23:46:39

#### 1. Assigning a value to the same thing conditionally using ternary operators.
```javascript
❌  
a > b ? foo = 'apple' : foo = 'ball'; 

✔️  
foo = a > b ? 'apple' : 'ball';
```


#### 2. Assigning the same value to a specific object property conditionally.
```javascript
❌  
c > d ? a.foo = 'apple' : a.bar = 'apple';

✔️  
a = { [c > d ? 'foo' : 'bar']: 'apple' };
```


#### 3. Exporting multiple variables
```javascript
❌ 
export const foo;
export const bar;
export const kip;

✔️ 
export const foo, bar, kip;
```


#### 4. Declaring and assigning variables from object properties.
```javascript
❌  
const a = foo.x, b = foo.y;

✔️
const { ['x']: a, ['y']: b } = foo;
```


#### 5. Declaring and assigning variables from array indexes.

```javascript
❌  
let a = foo[0], b = foo[1];

✔️
let [a, b] = foo;
```


#### 6. Getting multiple elements from the DOM.
```javascript
❌  
const a = document.getElementById('a'),
b = document.getElementById('b'),
c = document.getElementById('c');
d = document.getElementById('d');

✔️
const elements = {};
['a', 'b', 'c', 'd'].forEach(item => elements = { 
  ...elements, 
  [item]: document.getElementById(item) 
});
const { a, b, c, d } = elements;

/*
For this to work your elements ID's must be 
able to be valid Javascript variable names
and the names of the variables in which you store
your elements have to match with that elements' ID.
This is good for naming consistency & accesibility.
*/
```


#### 7. Use logical operators for simple conditionals.
```javascript
❌  
if (foo) {
  doSomething();
}

✔️
foo && doSomething();
```


#### 8. Passing parameters conditionally.
```javascript
❌  
if(!foo){
  foo = 'apple';
}
bar(foo, kip);

✔️
bar(foo || 'apple', kip);
```


#### 9. Dealing with lots of 0`s.
`````javascript
❌  
const SALARY = 150000000,
TAX = 15000000;

✔️
const SALARY = 15e7,
TAX = 15e6;
`````


#### 10. Assigning the same thing to multiple variables.
`````javascript
❌  
a = d;
b = d;
c = d;

✔️
a = b = c = d;
`````


#### Bonus⭐ (A deugging tip)
> Debugging with `console.log()` can be a pain having to write it
over and over again. You can shorten it by object destructuring
assignment.

`````javascript
const { ['log']: c } = console;
c("something");
`````

> Now Instead of having to write out `console.log()`
you can just write `c()` which is easier to write for
faster debugging.

### Thanks for reading!🎉.

[View my github](https://github.com/redbossrabbit)
JS Array Methods: .join() and .split()

Tags: javascript, arrays
Published: 2021-01-17 23:37:15


**Arrays**

In Computer Science an Array Data Structure is a data structure that consists of a collection of elements.

In JavaScript, arrays are used to store multiple values in a single variable.

```
//creating a new array 
const arr1 = ["I", "am" , "just", "a" ,  "poor" ,  "array" ]
``` 

Javascript arrays come with a lot of prebuilt methods. However, for the purpose of this post, we are going to be looking at the .join() and .split() method. 

**.join()**

The .join() converts the elements of an array into a string and returns a new string

The join method can take an optional Parameter  *i.e arr1.join([seperator]).* 
if the separator is omitted the array elements are returned as a string with a comma to separate.

The following examples create an array, arr, with six elements, then joins the array four times: using the default separator, empty string, a space, then a dash 

```
let arr1 = ["I", "am" , "just", "a" ,  "poor" ,  "array" ]; 

let string1 = arr1.join()

let string2 = arr1.join("")

let string3 = arr1.join(" ")

let string4 = arr1.join(" - ")

console.log(string1) // 'I,am,just,a,poor,array'
console.log(string2) //  Iamjustapoorarray'
console.log(string3)  //'I am just a poor array'
console.log(string4)  // 'I - am - just - a - poor - array'

``` 

**.split()**

The  [split() ](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split) method divides a String into an ordered list of substrings, puts these substrings into an array, and returns the array. You would normally use this when you want to make a string object *iterable*

The split method takes two parameters. - Separator and Limit

**Separator**
We have already seen how separators work in the examples above with .join(), they work the same. However, The .split() separator can either be a string or a  [regular expression. ](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) 

**Limit**
 If provided, it splits the string at each occurrence of the specified *separator* but stops when *limit* entries have been placed in the array.

```
let string = "I am just a poor string" 
let newArray = string.split()
let newArray1 = string.split('')
let newArray2 = string.split(' ')
let newArray3 = string.split(' ', 3)

console.log(newArray) // [ 'I am just a poor string' ]
console.log(newArray1)
/*
[
  'I', ' ', 'a', 'm', ' ',
  'j', 'u', 's', 't', ' ',
  'a', ' ', 'p', 'o', 'o',
  'r', ' ', 's', 't', 'r',
  'i', 'n', 'g'
]
*/
console.log(newArray2)//[ 'I', 'am', 'just', 'a', 'poor', 'string' ]
console.log(newArray3) // [ 'I', 'am', 'just' ]
```
Softer Software: How I improved the quality of my code
Tags: softwaredevelopment
Published: 2021-01-17 23:36:16

It took my a few years to get to a point where I felt I could write good code. I used a lot of principles from the book "Clean Code", and recently read "Refactoring". I've written up how I developed my skills over time and what I got from there books:

https://mark-mccracken.medium.com/softer-software-how-i-improved-the-quality-of-my-code-d0d72bc5e11
I made this SCSS or CSS theme generator
Tags: webdev, showdev, css
Published: 2021-01-17 23:32:24

![Theme generator preview](https://dev-to-uploads.s3.amazonaws.com/i/qh3n6aho829cn97clkax.png)
This app prompts you for colors, sizes, and other things to create an SCSS theme file that you can use for a site or app. It actually uses CSS variables so you can dynamically change the theme with JavaScript. You can use it [here](https://jadenconcord.github.io/theme-generator/). I like to use it when I am starting an app and I take a screenshot of the palate in the top left and make the design in [Inkscape](https://inkscape.org/). The Randomize Theme button is very nice to use to find a good color scheme to start with. Here is a sample output of a theme:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/kn7foege9f2ibda218oa.png)
I am still working on the SCSS output but here is what the output looks like:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/dl1ck041teyihj5ck5cl.png)
As you can see, it is a very long file. That is because it gathers the SCSS variables, calculates new variables, makes them into CSS variables, and finally makes SCSS variables to use the CSS variables. Also it has conditions for it to be light or dark, light with dark, dark with light themes which makes it long.

I just made this so I haven't used the SCSS result so there will definitely be lots of changes but this is one of the apps that I plan to make, next is a CSS defaults theme using this site SCSS results.

Again the demo is [here](![Alt Text](https://jadenconcord.github.io/theme-generator/).
The Github repo is [here](https://github.com/jadenconcord/theme-generator) and I would appreciate any issues that were posted.
Learning Android: Adaptive Icons
Tags: android
Published: 2021-01-17 22:44:41

Adaptive icons were introduced in Android 8 (Oreo | API 26) to add a bit of design flair to your launcher icons.

The feature allows the user's OEM to determine a mask to apply onto your launcher icon (e.g. cut a square icon, squircle icon)

## Key Points:

* Foreground/Background layers: 108 x 108 dp
* Only works with API 26+
    * Move your adaptive icon file to res/mipmap/anydpi-26
* Icons for earlier versions use 48 x 48 dp icons

## Code

_Android Manifest_

```
<application
    …
    android:icon="@mipmap/ic_launcher"
    android:roundIcon="@mipmap/ic_launcher_round"
    …>
</application>
```

_res/mipmap/anydpi-26_
```
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@drawable/ic_launcher_background" />
    <foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
```

## Links:

* [Android Developer Guidelines](https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive)
* [Styling Android Guide](https://blog.stylingandroid.com/adaptive-icons/)
Local Hack Day : Build
Tags: mlh, majorleaguehacking, localhackday
Published: 2021-01-17 22:34:38

Local Hack Day : Build

I never thought I would come so far!

This has been a fantastic journey, I contributed a lot and learned at the same time. learning with people, building various projects, sharing ideas and views and what not.
Local Hack Day Build has given us the opportunity to open up ourselves and come ahead and make ourselves shine.
I was proud to be part of EddieHub Community! As I started, people in the community were super interactive which gave me boost, i actively took part in everything!
Attended live sessions, various workshops, mini-events and what not, it has been altogether an incredible one.

## CodeLess API

Its call API Chaining and it requires a backend that uses the new api pattern

If it is properly setup, you can automatically call it from the frontend like so:

The POST post-chain would be encoded as follows:

```
{ 
    ...[your_data_being_sent]... 
    chain:{ 
        key:dept_id, 
        combine:'false', 
        type:'postchain', 
        order:{dept/show:company_id,company/update:return} 
    } 
} 
```
And then call via Curl(or via javascript) as follows:
```
curl -v -H "Content-Type: application/json" -H "Authorization: Bearer [access token]" -X POST -d "{'chain':{'key':'dept_id','combine':'false','type':'postchain','order':{'dept/show':'company_id','company/update':'return'}}}" "http://localhost:8080/v0.1/person/show/1" 
```
If you need to send Max/Offset variables, do so as follows:
```
curl -v -H "Content-Type: application/json" -H "Authorization: Bearer [access token]" -X POST -d "{'chain':{'key':'dept_id','combine':'false','type':'postchain','order':{'dept/show':'company_id','company/update':'return'}}}" "http://localhost:8080/v0.1/person/show/1?max=1,1,1&offset=0,0,0" 
```
Thanks for reading!
Make Cables and Boxes in Code Directly. 
Tags: effectnode, visual, coding, creative
Published: 2021-01-17 22:17:57

---
title: Make Cables and Boxes in Code Directly. 
published: true
description: Making Cables and Boxes Work Directly in Code in a simple way.
tags: #effectnode #visual #coding #creative
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/n3phdvleg7e7nrnc9m7k.png
---

![Graph Based Code](https://dev-to-uploads.s3.amazonaws.com/i/3k3nzsygez1fqlyijnlq.png)

https://gist.github.com/wonglok/cdb7cf080f6263872b4042eeaae6f1ca