teleren/devto huggingface dataset:
Simple Translator in Python
Tags: python, tutorial
Published: 2020-06-28 08:35:39

Installation
```python
pip install translate
```
code
```python
from translate import Translator

translator= Translator(to_lang="Hindi")
translation = translator.translate("Follow code_snail")
print(translation)
```
##Between Any Two Languages
```python
from translate import Translator

# Between Any Two Languages
translator= Translator(from_lang="hindi",to_lang="english")
translation = translator.translate("@code_snail का अनुसरण करें")
print(translation)
```

Like, Follow, Comment and Code :)
Google Search (aka. Google SERPs) JSON API
Tags: google, search, serps, api
Published: 2020-06-28 08:22:48

---
title: Google Search (aka. Google SERPs) JSON API
published: true
description: I built the most reliable & most affordable API to consume data from Google SERPs.
tags: google, search, serps, api
---

Data mining is a hard job and it gets harder when you are supposed to deal with giants like Google. A couple of years ago, I needed to deal with Google SERPs data and I searched for available options. I found a couple of web services as well as open-source code to get Google SERPs data but each solution had its own limitations.

I found a couple of services to be reliable but they were costly. Some were affordable but I had to wait for several minutes before they returned me a result. And there, I started my research.

I opted for Python as the programming language and thanks to several other tools that I used, I was able to build a solution. My web service is [https://serpsbot.com](https://serpsbot.com) and now it is in full production mode. You can use it to consume [Google](https://google.com) SERPs data for any purpose.

To cover the server costs, I'm charging $0.001 per API call there. For high-volume customers, the price can be reduced down to $0.0005 per API call.

## How to get Google SERPs?
You can get Google SERP results as JSON data. Here is an example of usage for the awesome Python. Please beware that you need to create an account and get your API key at our website [SerpsBot](https://serpsbot.com) first.

```python
import requests

# Your API key
apikey = 'your-api-key-here'
headers = {
  'Authorization': 'Bearer {}'.format(apikey)
}

payload = {
  'q': 'programming',
  'pages': 2,
  'hl': 'en-US',
  'gl': 'us'
}

res = requests.get('https://serpsbot.com/api/v1/google-serps/', headers=headers, params=payload)

# JSON data
res.json()
```

## How to build a custom site search engine?
Using our API service, you can build a search engine for your website. As we support all Google search filters, you can pass in your website URL using `site:` filter and only results for your provided URL will be returned.

```python
import requests

# Your API key
apikey = 'your-api-key-here'
headers = {
  'Authorization': 'Bearer {}'.format(apikey)
}

payload = {
  'q': 'python site:dev.to',
  'pages': 2,
  'hl': 'en-US',
  'gl': 'us'
}

res = requests.get('https://serpsbot.com/api/v1/google-serps/', headers=headers, params=payload)

# JSON data
res.json()
```

Possibilities are limitless. You can use any programming language to consume data from our API endpoint and you can build your next tool that consumes data from our API. If you have any questions, you can ask me in the comments.

p.s. I'll publish the website source at GitHub in the upcoming months.
Comprehensions in Python: Why are they faster? A deep dive.
Tags: python, computerscience, c
Published: 2020-06-28 08:04:12

I've asked this question to Python developers - beginners and advanced Python devs alike. Their answer, however, more often than not doesn't answer the fundamental question: are they the same as a simple for loop.

The internet does have a lot of articles around how you use them, but they do not cover the `why` - why do list comprehensions exist? What did the vanilla for loop miss that we had to create another syntax to do the same thing? I'm sharing a short summary of how you can use them and why are they faster, but if you want to deep dive, feel free to read more at [this link](https://www.angrynerd.in/posts/comprehensions-in-python-the-hard-way/?utm_source=dev.to).

# What are comprehensions?
In short, comprehensions can help you shorten your code while giving a performance boost to your code. As an example, if you want to loop over a range of integers & add 1 to all, the for loop will be:

```python
la_ints = []
for i in range(10**7):
    la_ints.append(i + 1)
```

However, a comprehension is much shorter and ~30% faster
```python
la_ints = [i+1 for i in range(10**7)]
```

# But.. why?
You might already know that Python itself is built on top of C - which is much faster than Python when it comes to handling raw data. When you're using a list comprehension, the evaluation logic of the loop is taken care of by the lower level implementation which is much faster. If you see the disassembly of these implementation using `dis` module, you'll see how append kills the performance of the for loop.

In my blog post [Comprehensions in Python: The hard way](https://www.angrynerd.in/posts/comprehensions-in-python-the-hard-way/?utm_source=dev.to), I deep dive into disassembling of the two implementations (including sweet sweet bytecodes), and how to manage memory with generator expressions when you're hitting memory limits.

Happy to hear any feedback about this post of the blog post! Thanks!
I have built hamburger menu with styled-components & TS & React
Tags: typescript, react, design, css
Published: 2020-06-28 08:00:19

I like to work minimalist and design that way. One of my works need to be creating hamburger menu and decided to created it as public repository. Any feedback would be great. I hope you liked it and use it in your projects!

https://github.com/farukbigez/styled-components-hamburger
Scala+Stellar Weekly Update June 28, 2020
Published: 2020-06-28 07:55:54

🤔 **Thinking about**
I hadn't paid much attention to [Public Node](publicnode.org) until last week. I listened to the 3 episodes in their newly started [podcast series](https://podcasts.apple.com/us/podcast/stellar-discussions-by-the-public-node-community/id1514550787) and it's very good. Their [blog content](https://publicnode.org/blog/) is also high quality. I really like their model for public ownership of Stellar node infrastructure and look forward to integrating support for their Horizon instances.

[Leigh's](https://twitter.com/___leigh___) video on [SEP-30 key management](https://www.youtube.com/watch?v=W-n73Cuy7-0) is next up on my watchlist. If you pay attention to the developer mailing list you'll know that his work is very thorough and he has a great ability to explain technical concepts concisely, so I'm also looking forward to watching this.

🔙 **Last Week**

_Current SDK_
* Completed SEP-007 `web+stellar:tx` support. It is now possible to create and parse signing requests; as well as sign+validate as the requestor.

```scala
// Generating a signed signing request
val requestingKey: KeyPair
val txn: Transaction
val signingRequest = txn.signingRequest(
  callback = Some(HttpUrl.parse("https://foobar.com/txn")),
  message = Some("For access to FooBar features."),
  ... and several more optional params
).sign("foobar.com", requestingKey)
val signingRequestUrl = signingRequest.toUrl

// Parsing and validating the request
val signingRequest = TransactionSigningRequest(signingRequestUrl)
val valid: Future[SignatureValidation] = signingRequest.validateSignature()
val transaction = signingRequest.transaction
```

SEP-007 `web+stellar:pay` support remains to be completed before I can cross off this feature from the quarterly goals.


🍕 **Planned (Jun-Aug)**

* SEP-007 - URI Scheme to Facilitate Delegated Signing
* SEP-010 - Stellar Web Authentication
* Ongoing SDK rebuild effort.
Comprehensive guide about Gatsby routing you should know
Tags: gatsby, routing, react, seo
Published: 2020-06-28 07:15:39

Hi everyone, I am a frontend developer come from Vietnam.

This minimal guide will show the way how we should build frontend projects using Gatsby (https://gatsbyjs.org/) with understanding it's routing system.

## Client side only with static pages

I assume that you have basically done something with Gatsby before. In this article, we will follow some steps:
- Create some pages inside pages folder.
- Create some pages with for client side only with @reach/router.
- Compare two kind of pages above after run gatsby build and view page source by Ctrl + U.

First, create some pages like I did in below image.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/qe32z0tonz71ep5gp2c8.PNG)


Above example code is quite easy to understand yeah?

Then run gatsby build and gatsby serve to load all pages at localhost port 9000.
First, take a look at our build folder, we would see something like below

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/z2ksr3i7q7h123fopfb7.PNG)


Inside `app` folder, we can see that Gatsby doesn't create login and profile pages for us, because these pages are only available for client side only.

Open two pages, for current example, they are index page at "http://localhost:9000/" and profile page at "http://localhost:9000/app/profile/", and then view source by `Ctrl + U`.

Below result for the index page, notice that I have used `Ctrl + F` to find the content in index page to make sure this page is actually be server side rendered.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/bci04bi6pib74bxr5v6f.PNG)


Below result for profile page, use the same technique to find content but got no result.

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



So, we saw that those pages with render using `@reach/router` , they are **ONLY AVAILABLE** for client side only.

Why is this important? Because you need SEO!

## What's next!

You might be wonder what we should do if we want to make some pages that need to be actually SSR and then, some parts should be rendered on the client side instead of blank page like above?
Yes, the answer is detect client or server side in Gatsby, https://blog.logrocket.com/fixing-gatsbys-rehydration-issue/ is a good start for you with.


Happy coding ❤
How to delete all node_modules folder in system !!!
Tags: node, beginners, angular, react
Published: 2020-06-28 07:01:23

Most of the time once the project is completed, we will move to different projects leaving the old project folder in the system without any cleanup.

Nodejs application or npm based application node_modules will take a lot of system memory and eventually our system memory will dry up, its not easy task to find and remove all node_modules in one go.

Wrote simple CLI to do this clean that's "mo-clean", its a simple CLI that finds the all node_modules in the system by root path and provides the details like memory taken, last used time, and path. after getting all information it will remove those node_modules from the system.

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

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/7ocd857mycmnjy8ovy55.gif)

## What it does?
It identifies the unused node_modules of NodeJS application based on last used by days and provides the details
 1. When the project was last used.
 2. How much memory node_modules taken.
 3. Remove those node_modules from system.

## How to use
Just install the library, don't clone this repository and run! (you can do that but not required)
  
## Installation

Please install the package with the flag '-g'.

```
 npm install -g mo-clean
```

## Execution

Run the below command from the command prompt/terminal

```
> mo
```

that will prompt the user with the below options for the search or delete the node_modules

```
  __  __    ___
 |  \/  |  / _ \
 | |\/| | | | | |
 | |  | | | |_| |  _   _   _
 |_|  |_|  \___/  (_) (_) (_)

? Please select an option:

 1) Search all the node_modules present in the path and show the total memory taken?

 2) Search and delete all the node_modules present in the path?

 Enter the option(1 or 2):
```

after the option selected it will prompt the path for the search or delete

## Search Option

It will search for all the node_modules present under the provided path.

![demo](https://raw.githubusercontent.com/uttesh/mo/master/images/search_screen.png)

## Remove Option

It will search all the node_modules present under the provided path and delete them.

![demo](https://raw.githubusercontent.com/uttesh/mo/master/images/delete_screen.png)

Github Link: https://github.com/uttesh/mo
Why Everyone can't hack facebook 
Tags: career, security, hacking, iamprogrammer
Published: 2020-06-28 04:43:42

*Worth Reading*


Hello EveryOne Reading this post, today i am going to share something that may not make sense as a programmer, but it is logical and annoying. I was in a WhatsApp group where people wanted to learn hacking. you can find many WhatsApp groups link online. 
So i was there in one of the WhatsApp group, every participant in that group wanted to learn hacking as the group name was learn hacking. 
So i texted in the group "hello i am programmer" and just after texting this every participant started texting me even the admin of that group,  and 90% of them were asking about how to hack social media account.I was smiling while reading these messages because all of them were illogical. And today i will tell you why it is so:


1.*You can never hack a company(tech giants like Facebook)*: So whenever someone asks me that can you hack facebook account or facebook. The first thing i tell them is that you can never hack a company because it is nearly impossible to find flaw and exploit it, every Company has a team of Security experts to prevent them from getting hacked. Apart from this companies often conducts bug bounty programs which is open challenge to hackers to find flaw in their programs or site and get paid for it. so it becomes very difficult to hack database and other things of a company to get password and userid.


So the question arises why there are so many complains of people getting hacked online??

The answer to this lies in the question. people get hacked not the company, in 98% of cases people or the users get hacked from their end. users generally don't even think about their security until or unless they get hacked. 
In most of the cases hackers generally play with the mind of users(Social Engineering) and uses some programming knowledge or you can also say some technical knowledge to get the credentials of user. And believe me in India it is very Easy to manipulate people.

So let me tell you how people get hacked.Especially in a country like India everyone wants things for free and that is where hacker play with mind. Hacker creates a website where he put some free stuff and users login with their credentials which get stored to the database which hacker created. And at the end free stuff website tells you to share that with your friends either on WhatsApp or facebook groups etc. 

So let me give you an idea if you want to hack someone's pubg account you can create a website with free UC and ask the user to login with userid and password.


if you read it till last paragraph thanks for reading. i was writing this during CORONA QUARANTINE.

AS RAMDAS ATHAWALE SAID "CORONA GO".reverse()

bye vasudev kutumbkam
TIPS TO RANK YOUR WEBSITE ON VOICE SEARCH
Tags: voicesearch, seo, localbusinesslisting, digitalmarketingcompany
Published: 2020-06-28 06:49:06

The digital world is evolving each and every day and so is consumer behavior. Due to this reason, it has become more than necessary for brand owners to keep up with the changes in consumer behavior or they are sure to lose out on the market competition. According to a study by Google, 58% of consumers have found local business services near them by conducting searches via voice. Read the blog on Prism and learn tips on how you can rank your website on voice search. 

https://www.prism-me.com/blog/5-tips-to-rank-your-website-on-voice-search-with-google-siri-and-alexa/
Vanilla JavaScript Update URL without Refresh
Tags: javascript
Published: 2020-06-28 06:19:15

Today we are looking into updating the `URL` without doing a refresh. We can make use of the History API to access and modify the `URL` states.

The cool part, it has superb browser support!

## JavaScript History API

The history API is a set of methods used to manipulate history. For instance, we can go forward and backward, just like clicking the buttons in your browser.

More on these methods in another article.

## JavaScript history.pushState

Today's focus is on the method called pushState(). We can use this method to push a new entry into the browser's history. It doesn't need a refresh and will show the new URL in the browser.

The history.pushState() method accepts three arguments:

- `state`: This is an object with details about the `URL`
- `title`: The title (normally the `<title>` attribute)
- `url`: The actual `URL` you see in your browser bar.

In code, it would look like this:

```js
history.pushState({pageID: 'unicorn'}, 'Unicorn', '/unicorn');
```

You can open up the console and paste the above code in it. And you should see the URL change.

Also, note we tell it the title, but it is not reflected anywhere. I'm not 100% sure why we even have the `title` option.

## Browser Support

![History support](https://caniuse.bitsofco.de/static/v1/mdn-api__History-1593269956388.png)

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)
I built an online code editor
Tags: clojure, webdev, codenewbie, html
Published: 2020-06-28 06:07:19

https://slingcode.net/

{% youtube 0tONEHy-P7M %}

I built a web based IDE with live-reloading which you can use to make, run, and share web apps. I made it for my kids so that they have a nice simple environment in which they can learn web app development without complex command line tooling and hosting, but I hope it will be useful to non-kid amateurs and maybe even professionals too.

The main things it does differently from existing online code editors are:

 * It's **fiercely independent**, entirely self-contained in a **single HTML file** with no server side dependencies.
 * It supports **live-reloading** of changes so you can iterate very quickly on designs and functionality.
 * You can share the apps you make **peer-to-peer** between different devices so you don't need to host them online.

{% github chr15m/slingcode %}
How to deploy applications using Helm in Kubernetes?
Tags: kubernetes, opensource, beginners, devops
Published: 2020-06-28 05:15:59

Let's learn How to deploy PHPMyAdmin application using helm chart? Learn more about helm [here](https://helm.sh/).

## Prerequisites:

### Create NFS share
Reference:
- https://www.linuxbabe.com/ubuntu/nfs-share
- https://vitux.com/install-nfs-server-and-client-on-ubuntu/

### Install Helm
Refer installation guide [here](https://helm.sh/docs/intro/install/)

### Clone github repository
```
git clone https://github.com/sagar-jadhav/kubernetes-essentials.git
```

### Go to `session_5` directory
```
cd ./kubernetes-essentials/session_5/
```

## Enable Nginx ingress controller
```
minikube addons enable ingress
```
```
kubectl get pods --watch -n kube-system
```
Exit once controller pod goes into running state

## Step 1: Create PHPMyAdmin helm chart
```
helm create phpmyadmin
```

## Step 2: Add all application YAML files to templates directory
Remove unwanted files from template directory
```
rm -rf ./phpmyadmin/templates/*
```
Copy YAML files
```
cp configmap.yaml db-deployment.yaml db-pv.yaml db-pvc.yaml db-service.yaml secret.yaml phpmyadmin-deployment.yaml phpmyadmin-ingress.yaml phpmyadmin-service.yaml ./phpmyadmin/templates/
```

## Step 3: Package helm chart
```
helm package phpmyadmin
```

## Step 4: Deploy PHPMyAdmin application
```
helm install phpmyadmin ./phpmyadmin-0.1.0.tgz
```

## Step 5: List helm release
```
helm ls
```

## Step 6: List pods
```
kubectl get pods
```

## Demo
{% youtube 7yjyLG66Rk0 %}
Free Social Proof widget for your website ⚡️on G-Sheets
Tags: saas
Published: 2020-06-28 05:03:01

I hope this will be helpful for the community! 

Skyrocket Conversions on your website by over 25% in just 5 minutes by adding a few lines of code to your website
and the #1 Social Proof Widget ⚡️ on Google Sheets 

it's free and easy to use: https://proven.ly/demo.html
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/zz1qm4x127u7vc4lyyfu.png)
Hey, Wait: Git Has a New Complaint
Tags: git
Published: 2020-06-29 02:24:02

---
title: Hey, Wait: Git Has a New Complaint
published: true
date: 2020-06-28 05:00:00 UTC
tags: 
  - git
canonical_url: 
---

When you upgrade to [Git 2.27](https://raw.githubusercontent.com/git/git/master/Documentation/RelNotes/2.27.0.txt), one of the first changes you’ll notice is Git issuing this dire warning every time you go to pull from a remote:

```
$ git pull origin main
warning: Pulling without specifying how to reconcile divergent branches is
discouraged. You can squelch this message by running one of the following
commands sometime before your next pull:

  git config pull.rebase false # merge (the default strategy)
  git config pull.rebase true # rebase
  git config pull.ff only # fast-forward only

You can replace "git config" with "git config --global" to set a default
preference for all repositories. You can also pass --rebase, --no-rebase,
or --ff-only on the command line to override the configured default per
invocation.

```

Almost certainly the best option here is to (probably globally) specify fast-forward only:

```
$ git config --global pull.ff only

```

A fast-forward is what happens under the happiest of circumstances: your local branch has no new changes that aren’t already on the remote, so you’re updating (fast-forwarding) the pointer on the HEAD commit to match the remote. Setting `pull.ff only` ensures that that happy behavior continues.

But there are plenty of unhappy circumstances. The one that most commonly ruins my day is when I’ve been working on the same branch of the same repo on two different computers. I push the commits from Computer A to the remote, but forget to run `git pull` from Computer B before writing new commits.

The default strategy, a merge commit, means you can end up with a repository full of merge commits from your own remote branch. It’s ugly and almost always leads to [foxtrot commits](https://blog.developer.atlassian.com/stop-foxtrots-now/).

By setting `pull.ff only`, Git will no longer race ahead and create a merge commit. You can opt to do so manually (`git merge origin/main`), but if you’re not working on a public branch, or if your divergent commits are still local, you can rebase your local branch onto the missing commits from your remote (`git rebase origin/main`). They’ll then appear as though they’ve been there the whole time.

Of course, when it comes to working with branches shared with others, it’s better by far to create your own, independent feature-branches and keep your work isolated, and rebase from the parent branch before pushing the commits on your own branch.