teleren/devto huggingface dataset:
Buying Phone Numbers and Pointing them to your SIP/SMPP Network programmatically.
Tags: inthirtyseconds, productivity, tutorial, devops
Published: 2020-04-24 21:39:47

In this tutorial I will share how to programmatically search and buy a virtual voice and SMS enabled phone number and point them to your own SIP and SMPP network/devices. 

### Search for a Phone Number in UK starting with 4471

```shell

curl --location --request POST 'https://apiv2.telecomsxchange.com/number/market' \
--form 'prefix=44741' \         
--form 'country=' \
--form 'description=' \
--form 'seller=' \
--form 'voice=1' \
--form 'sms=1' \
--form 'fax=0' \
--form 'video=0' \
--form 'did_type=any' \
--form 'pager=5' \
--form 'off=0'

```

- API Response

```json

{
  "status": "success",
  "dids": [
    {
      "i_did": "1002",
      "country": "GB",
      "msisdn": "447418340370",
      "cost": "1.25",
      "type": "mobile-lvn",
      "features": [
        "VOICE",
        "SMS"
      ],
      "monthly_fee": "2.5063",
      "number": "447418340370",
      "smpp_price": "0.0063",
      "price_1": "0.0050",
      "setup_fee": "0.0000",
      "capacity": 50,
      "voice": 1,
      "sms": 1,
      "video": 0,
      "fax": 0,
      "verification_required": 0,
      "interval_1": 60,
      "interval_n": 60,
      "did_type": "mobile",
      "vendor_name": "BT",
      "is_nexmo": 0,
      "country_code": "gb",
      "country_name": "UNITED KINGDOM",
      "description": "Mobile - Tismi",
      "price_n": "0.0050"
    }
     
```

### Buy Phone Number and Point it to your SIP / SMPP Network Address


```shell

curl --location --request POST 'https://apiv2.telecomsxchange.com/number/purchase' \
--form 'i_did=1002' \ 
--form 'billing_i_account=[Your Billing Account ID]' \
--form 'contact=sip:447418340370@sip.domain.com:5060' \
--form 'smpp_contact=smpp:login:pass:447418340370@smpp.domain.com:PORT'

```shell

```json

{
  "status": "success",
  "message": "+447418340370 has been purchased and pointed to your network successfully"
}


```

That's it! You can now call or text +447418340370 from any phone and it'll be routed to your SIP/SMPP network.
Npm over Yarn
Tags: npm, yarn, node
Published: 2020-04-16 14:15:35

Both npm and yarn are package managers. As an alternative to npm, yarn was built by Facebook. They developed yarn to solve the problems they had when using npm, specifically the issues of accuracy, protection and speed. Within this article we'll look at npm and yarn differences. If there are any issues feel free to comment below and share your thoughts.

#npm, the Node package manager

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/xmzy9y5fvs92gniey3ha.png)
Npm is the default package manager we all know, and it is bundled with node.js. It is the command-line interface to the npm ecosystem. It is designed for battle-tested, incredibly flexible and uses JavaScript developers every day by hundreds of thousands.

**npm install**

Using `npm -v` you will see the current npm version which you are using.

Here's mine
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/rl5enph9fu9jsran7ggt.PNG)

If you have an older version of npm then you can update it to the latest version using the following command.
```
npm install npm -g
```
To access npm help, use `npm help` in the terminal.
```
npm help
```

#new npm alternative, Yarn package manager

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8k7tg1r8tzwkwtsxyz1v.png)

Yarn caches every package that it installs, so that it never has to do so again. This also incorporates activities to optimize resource utilization and installation times are quicker than ever before.

If you have `npm` installed, you can just install yarn with npm.
```
npm install yarn --global
```

##What differs yarn from npm?

Yarn is somewhat distinct from npm. The key reason developers choose to move to yarn is its stability. Firstly, yarn caches all the packages installed. Yarn is more convenient than npm. This is because yarn installs that packages at once in comparison with npm that installs one at a time. In npm, the versions of the installed packages can be different when we need to deploy the project on different machines. I assume this was the reason yarn first appeared. Yarn has an engaged community of users. 

Both npm and yarn download packages from npm repository. Npm will run code from dependencies automatically. While this feature has its own accessability, it has raised several security issues. Yarn only installs from your yarn.lock or package.json files. Yarn.lock ensures that all users have the same software installed. It reduces the ability for bugs to be found in different versions.

###Any yarn problems?

Yes, Unfortunately :(

Here are two major issues.

1)Installation of native modules is difficult.
2)Yarn doesn’t work with any node.js version older than 5.

##Which one would you select?
###yarn or npm?

There are many improvements yarn has higher speeds and more control over npm. But many people suggest that if you already know npm, a move to yarn isn't really necessary. To sum-up personally I will favor to use npm :)
Favorite funny sites and projects
Tags: watercooler, funny, hosting
Published: 2020-04-24 21:12:26

---
title: Favorite funny sites and projects
published: true
description: What dev projects have you found online that you can't resist laughing at?
tags: watercooler, funny, hosting
---

Every now and then someone I know shares a link to a hilarious project that makes me literally LOL—and also wish I could think of something funny like it to put online.

This time a friend shared a link to a website called [No Uptime Hosting](https://nouptime.com/). The longer I looked at it, the more I laughed. 🤣

![No Uptime Hosting screenshot](https://dev-to-uploads.s3.amazonaws.com/i/7nq562cb9zms31u74dfb.jpg)

There have been some other funny ones, like [Rockstar](https://github.com/RockstarLang/rockstar) programming language (although I can't remember the others off the top of my head). Incidentally, this one was also shared in the same local Slack group the first one was shared in (at least, that's how I learned about it).

What are you're favorite funny projects? 🙂
Breathe new life into your old photos with colorization - Ainize
Tags: opensource, AI, github
Published: 2020-04-24 21:09:56

I was surprised how AI (Artificial Intelligence) technology can replace human intelligence and change our future when I watched the Google Deepmind Challenge Match in 2018. Since then, AI has been a cutting edge trend and I have watched this field with interests.

Now I work for this company which built open source as a service platform called Ainize especially for AI. Naturally, I encountered many fun open source projects related to AI and would like to share one of them called DeOldify.

DeOldify created by Jason Antic is an open-source AI tool enabling us to colorize and restore black and white images based on the GAN (Generative Adversarial Network) deep learning model. This one has been trained to add high-quality colorization to grayscale images. DeOldify is also selected as one of the top 10 most popular Machine Learning Github repositories.

I also had a chance to see photo albums of my grandparents and most of the pictures were black and white and they seemed oddly distant from reality even though they have emotional power at some point. I wondered how it would be to colorize those pictures. Maybe they would feel quite different by just colorizing pictures.

It would be very fun to fill with vivid colors for any kind of old pictures such as historic images, old animations, any photo you want to bring back to your life. As an example of what I can do with DeOldify, I tried Olivia Hussey.

You can also get started coloring your images and I’d like to share a short tutorial for this. You can click this link (https://deoldify-api.kmswlee.endpoint.ainize.ai/) and simply put an image URL and run it. Ainize team has deployed DeOldify and served it as API on this website using technologies such as Docker. Our Youtube video explains well about this project showing many examples of “Deoldified images”

If you are also interested in deploying other cool open-source projects using Ainize for free without any backend infrastructure, you can visit this link.(https://ainize.ai/) You can easily deploy it with Github URL once there’s a dockerized file on the repo. If not, simply follow our direction on http://docs.ainize.ai for the deployment.

Thanks to Jason, I am also glad that I could share this awesome project with everyone.
Hopefully this website gives you a fun experience. Enjoy Ainizing!

DeOldify GitHub : https://github.com/jantic/DeOldify
Try on Ainize: https://bit.ly/2Vc79RL
Sign up for Ainize Project : https://link.ainize.ai/2Xnbe76
Youtube: https://www.youtube.com/watch?v=Gei0nxVqbOo&feature=youtu.be
Facebook : https://bit.ly/2XIL7Yn
Twitter : https://link.ainize.ai/3alYwZ2
PRIDigital.com's Remote Team Is Hiring
Tags: hiring, career, jobs, remotejobs
Published: 2020-04-24 21:00:56

---
title: PRIDigital.com's Remote Team Is Hiring
published: true
description: PRIDigital.com is hiring 3-4 developers to join it's dispersed team of professionals.
tags: hiring, careers, jobs, remotejobs
---

Hey friends, PRI is looking to hire 3-4 persons to join our dispersed team of talented professionals.

👩‍💼 Technical Project Manager

👨🏽‍💻 Drupal Developer 

🆘 IT Customer Support Specialist

Click the link 👇 for more details on our fun group of designers, developers, coders, writers, and editors dedicated to developing technology, products, and experiences that enable businesses and people to thrive at what they do best. https://pri.breezy.hr/
Creating a JavaScript Function to Calculate Whether It's a Leap Year
Tags: javascript, webdev, beginners, programming
Published: 2020-04-24 20:55:50

---
title: Creating a JavaScript Function to Calculate Whether It's a Leap Year
published: true
description: Calculating whether it's a leap year isn't a straightforward as you might think!
tags: javascript, webdev, beginner, programming
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/9o5y8qg8z8zftqd0xdii.png
---

Calculating whether it's a leap year isn't a straightforward as you might think! Here's how leap years are calculated, as described on Wikipedia:

>In the Gregorian calendar, each leap year has 366 days instead of 365, by extending February to 29 days rather than the common 28. These extra days occur in each year which is an integer multiple of 4 (except for years evenly divisible by 100, which are not leap years unless evenly divisible by 400).

Wat? 🤯

Let's break this down into enumerable steps, which we can then convert into code:

**Note:** This is an academic exercise! If you're going to do any date calculations in a production application, I'd strongly encourage you to use a tried-and-true library like moment.js. Dates can be tricky and you don't want to hit nasty bugs rolling your own solution!

1) If a year is divisible by 400, it's a leap year
2) Otherwise, if a year is divisible by 100, it's _not_ a leap year
3) Otherwise, if a year is divisible by 4, it's a leap year

This is fairly straightforward now and can be converted into code:

```javascript
function isLeapYear(year) {
  if (year % 400 === 0) return true;
  if (year % 100 === 0) return false;
  return year % 4 === 0;
}
```

And we can test a few scenarios:

```javascript
isLeapYear(2000) // true
isLeapYear(2001) // false
isLeapYear(2004) // true
isLeapYear(2100) // false
```

Happy coding!
VueJS: Scroll top component 
Tags: vue, scroll, component, slot
Published: 2020-04-24 20:40:09

---
title: VueJS: Scroll top component 
published: true
description: Creating a scroll top component from scratch
tags: vue, scroll, component, slot
series: vue examples
cover_image: https://i.blogs.es/99f0c0/vue/450_1000.png
---

To start my weekend i have decided code a customizable scroll top component, component will be implemented with vue slots. Slots will allow us to passing any kind of html element to the component.

### Component implementation

We will bind to scroll event and check Y axis scroll, this will allow us to hide/show compoment depending on the scroll of the page.

Next, we will make a function that scroll to top of the page step by step and make an simple animation.

#### Scroll top component

```vue
<template>
    <a @click="scrollTop" v-show="visible" class="bottom-right">
        <slot></slot>
    </a>
</template>

<script>
export default {
  data () {
    return {
      visible: false
    }
  },
  methods: {
    scrollTop: function () {
      this.intervalId = setInterval(() => {
        if (window.pageYOffset === 0) {
          clearInterval(this.intervalId)
        }
        window.scroll(0, window.pageYOffset - 50)
      }, 20)
    },
    scrollListener: function (e) {
      this.visible = window.scrollY > 150
    }
  },
  mounted: function () {
    window.addEventListener('scroll', this.scrollListener)
  },
  beforeDestroy: function () {
    window.removeEventListener('scroll', this.scrollListener)
  }
}
</script>

<style scoped>
.bottom-right {
  position: fixed;
  bottom: 20px;
  right: 20px;
  cursor: pointer;
}
</style>

```

#### Scroll top arrow

Now, with a generic component we will implement a new one: we will use font awesome icon and  a simple css styles.

```vue
<template>
  <ScrollTopComponent>
      <a class="btn btn-light">
        <font-awesome-icon :icon="['fas', 'angle-double-up']" size="3x" />
      </a>
  </ScrollTopComponent>
</template>

<script>
import ScrollTopComponent from './ScrollTopComponent'
export default {
  components: {
    ScrollTopComponent
  }
}
</script>

<style>
.btn {
    border-radius: 8px;
    background-color: rgba(0, 0, 0, 0.55);
    padding-top: 27px;
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: 5px;
}
</style>

```


### Use

The component using is quite simple, we only need to place component on the DOM.

```vue
<template>
    <div class="container">
        <p>A super long component</p>
        <ScrollTopArrow></ScrollTopArrow>
    </div>
</template>
<script>
import ScrollTopArrow from '@/components/shared/blog/ScrollTopArrow'
export default {
  components: {
    ScrollTopArrow
  }
}
</script>
```

### Result

Now when we are on top of the page component is hidden but when we scroll component shows up, you can see component ´s implementation on my github.

![Example gif](https://media.giphy.com/media/Icp0uDdl7Qxe7bHFM5/giphy.gif)

## References

[Github](https://github.com/mandrewcito/devto/tree/master/vue-examples)
[vue font awesome](https://github.com/FortAwesome/vue-fontawesome)
Don't Label Yourself 'Self-taught' or 'Junior' in Your Public Profiles
Tags: beginners, career, codenewbie
Published: 2020-04-24 20:24:11

Why not? 

Becoming a programmer is a challenging undertaking. Learning to code on your own is hard. Completing online courses, projects, and bootcamps is a big accomplishment. So once you've done all this you want people to know that you're self-taught and darn proud of it! And you write Self-taught Developer or Junior Developer on your public profiles - on twitter, on your blog, everywhere! This is not a good idea. 

But why not?

1. It subjects you to unnecessary bias. When people see *self-taught* or *junior* they may hear *inexperienced*. Some may dismiss your advice, your blog posts or tweets because...well humans are flawed. There is an underlying psychology at work, not in your benefit. (analogy - it's like someone sharing food recipes on youtube and explicitly pointing out that they have never gone to culinary school.)

2. Why? You don't gain anything by labeling yourself as self-taught or junior in public profiles so why say Junior Developer when you can say Developer. Make Self-taught Developer --> Developer. It does not matter how you learned. If you've ever made a computer do something with code and the sheer power of your brain (and hands for typing I guess) you are a developer.

3. If you're job searching, you can impress your potential employer by revealing that you're self-taught during an actual conversation. And you should absolutely talk about this in the right context. It demonstrates so many desirable quality - self-motivation, discipline, follow-through, passion, resilience, problem solving. I'd rather hire you than someone who has a CS degree but has been stagnant with their career.
 
Don't sell yourself short. Go change your public profiles now. Write developer. You are a developer.
GITHUB Breakdown for beginners THREAD!
Tags: github, codenewbie, beginners
Published: 2020-04-24 20:04:28

*If you like this article, chances are you'd like what I tweet as well. If you are curious, have a look at my [Twitter](www.twitter.com/DThompsonDev) profile. Or check out my podcast! "Commit Your Code!" Where we interview and talk to some phenomenal developers and motivate you to stay on the coding journey!* 

We have a project we want to upload to github! So let's do this step by step.
Left hand side of the screen, you will see a green button that says New. Press that.

Now we need a repository name. A repository is the space we are saving our code in. You can add a description to explain what is in this space, so if you come back after a few months you can remember what is in there.

Now lets go ahead and create the repository!

Now one way we can do this, is by copying and pasting our code. By pressing the Create a new file link, it will open an editor that will allow us to paste our code in.
![Create a new file on github](https://dev-to-uploads.s3.amazonaws.com/i/ax0h1gb9rkgvicjnlnlh.png)

This is where we would paste our code and then press Commit new file
Your code is now saved in the repository!
![github text editor](https://dev-to-uploads.s3.amazonaws.com/i/cpb57mh3creffem1rmjy.jpg)

NOW! Learn how to do this using Git! Learn how to do this like a professional!
[GitBash breakdown for beginners!](https://dev.to/dthompsondev/gitbash-breakdown-for-beginners-use-git-the-way-you-would-need-to-in-a-company-position-4dlj)

Follow me on [Twitter!](www.twitter.com/DThompsonDev)
Clone ALL Github repos for a user on Windows
Tags: community
Published: 2020-05-08 17:53:19

---
title: Clone ALL Github repos for a user on Windows
published: true
date: 2020-04-24 19:45:20 UTC
tags: Community
canonical_url: https://yiddish.ninja/clone-all-github-repos-for-a-user-on-windows/
---

Recently I had to do this, found [a shell script that cloned all repositories matching a search query](https://stackoverflow.com/questions/56335204/is-there-a-way-to-bulk-batch-download-all-repos-from-github-based-on-a-search-re), and edited it to meet my purposes.

### You’ll need

1. A working installation of Git with GitBash.
2. A copy of [jq](https://stedolan.github.io/jq/download/) in a directory that’s in your path (or in the directory where you’re running the script)
3. Git set up to work with SSH. Alternatively, you might want to try changing “ssh\_url” below to “clone\_url” and that should pull the https link.
4. An approximate count of the number of repos you’ll be cloning. Set the end of the loop in the first line to that number divided by 100, rounded up to the next whole number. For example, I had a little over 100 public repos to clone, so my loop is `1..2`.

### The Script

```
for i in {1..2}
  do curl "https://api.github.com/users/[your user name]/repos?per\_page=100&page=$i" \ | jq -r '.[].ssh\_url' >> urls.txtdonecat urls.txt | xargs -P8 -L1 git clone
```
Then just run the script in GitBash. `sh [scriptname]`

And that did it for me. Hope it helps.
Day-13 Find Pivot Index
Tags: python, challenge
Published: 2020-04-24 19:42:23

##### Background
This problem statement is a part of Leetcode's learning card Arrays and Strings. Under the sub-heading Introduction to Array.

##### Problem Statement
```
Input: 
nums = [1, 7, 3, 6, 5, 6]
Output: 3
Explanation: 
The sum of the numbers to the left of index 3 (nums[3] = 6) is equal to the sum of numbers to the right of index 3.
Also, 3 is the first index where this occurs.
```

```
Input: 
nums = [1, 2, 3]
Output: -1
Explanation: 
There is no index that satisfies the conditions in the problem statement.
```

Note:
  1. The length of nums will be in the range [0, 10000].
  2. Each element nums[i] will be an integer in the range [-1000, 1000].


##### Solution Approach 1
1. Reading the problem statement intuitive method that struck was to slice the list. And keep calculating the sum of those sliced sub-lists. When sum of the elements to the left-hand side of the element and right-hand side of the element matches. Return the index.

##### Problems with Approach 1
1. This would result in an unoptimized solution. Slicing has its own time complexity depending on the length of the sublist. Overall complexity would have become quadratic.

##### Solution Approach 2
1. Take a pen and paper and mathematically try observing the pattern. 
2. Calculate the total of all elements present in the list.
3. Then compute the sum of all elements to the left-hand side of the current index. Store this sum for each element in a new list.
4. Sum of right-hand side would be. 
right_hand_side = Total - value of element at current index - sum of left hand side elements at same index.

```
class Solution:
    def pivotIndex(self, nums: List[int]) -> int:
        total = 0
        result = -1
        for x in range(0, len(nums)):
            total += nums[x]
            
        element_sum = 0
        left_side_sum = [0] # Sum of elements to the left of value
        for i in range(1, len(nums)):
            element_sum += nums[i-1]
            left_side_sum.append(element_sum)
            
        for index in range(0, len(nums)):
            right_side_sum = total - nums[index] - left_side_sum[index]
            if right_side_sum == left_side_sum[index]:
                result = index
                break
                
        return result
```

##### Learnings and Takeaways
1. Time complexity - O(n), Space complexity - O(n)
2. Time complexity of append - O(1)
3. The first element of left_side_sum is initialized to 0 because there is no value to the left-hand side of leftmost element present in the list.
Optimisation And Realisation
Tags: engineering, development
Published: 2020-04-24 19:39:12

There is no developer that hasn’t heard the famous Donald Knuth quote:

> Premature optimisation is the root of all evil.

Often this sentence is understood in the context of performance, i.e. the speed of the software execution. However, it refers more to something else.

It's about the value that some code brings into the product.

During the development, the programmer's goal is to write the code that effectively meets the required functionality. However, often in the desire to write a high-quality code, a programmer goes too far and introduces complexity that is greater than its real worth (over-engineering). In other words, the value of the code decreases because of the unnecessary increases in complexity. Similarly, sometimes the development focuses on features that are not critical and do not give the product essential value. Instead, development tackles less relevant features.

In this context, premature optimisation is all the work that was not spent on the production of real value. The alternative to optimisation is realisation: work that actually brings value. Now the Knuth sentence is more meaningful.

Striking the balance between optimisation and realisation is not reserved for planning and top-level architecture. It make sense to view work on everyday code from this perspective. No matter whether it is a feature or a code block, try to determine if it is an optimisation or a realisation. If it is an optimisation, work out whether it is premature or not. Are you working on something that brings little value, or even no value, at the moment? Are you introducing unnecessary complexity? Are you adding more edge cases than actually needed?

The virtue is to avoid complexity. Detect it on time by thinking about premature optimisation.

---

More [here](https://oblac.rs/en/optimisation-and-realization/)