teleren/devto huggingface dataset:
Using Copier Answers to rerun templates quickly
Tags: python, linux, cli
Published: 2022-01-08 15:34:52

---
canonical_url: https://waylonwalker.com/til/copier-answers/
published: true
tags:
- python
- linux
- cli
title: Using Copier Answers to rerun templates quickly
---

The copier answers file is a key component to making your templates re-runnable.  Let's look at the example for my setup.py.

``` bash
❯ tree ~/.copier-templates/setup.py
/home/walkers/.copier-templates/setup.py
├── [[ _copier_conf.answers_file ]].tmpl
├── copier.yml
├── setup.cfg
└── setup.py.tmpl

0 directories, 4 files
```

Inside of my `[[ _copier_conf.answers_file ]].tmpl` file is this, a message not to muck around with it, and the answers in yaml form.  The first line is just a helper for the blog post.

``` yaml
# ~/.copier-templates/setup.py/\[\[\ _copier_conf.answers_file\ \]\].tmpl
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
[[_copier_answers|to_nice_yaml]]
```

Inside my copier.yml I have setup my _answers_file to point to a special file.  This is because this is not a whole project template, but one just for a single file.

``` yaml
# copier.yml
# ...
_answers_file: .setup-py-copier-answers.yml
```

> Once I change the _answers_file I was incredibly stuck

## Run it

I'm making a library of personal copier templates in my
`~/.copier-templates` directory and I am going to run it from there.

``` bash
copier copy ~/.copier-templates/setup.py
```
## Results

After rendering the template we have the following content in our `.setup.setup-py-copier-answers.yml` file.  This will allow us to update quick if we ever change our template.

``` yaml
# .setup-py-copier-answers.yml
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_src_path: /home/walkers/.copier-templates/setup.py
author_github: waylonwalker 
author_name: Waylon Walker 
description: awesomeness 
framework: null 
keywords: null 
package_name: my-package
```

## Update it

This is where I was most stuck, primarily becuase `-a <answers_file>` must come exactly after the base command `copier`.  This felt a bit odd to and not where I expected it so it.

``` bash
copier -a .setup-py-copier-answers.yml update
```

## Stop asking all these damn questions

So the defaults are now changed to our previous results, but it keeps asking for them.  To stop asking we can simply add a `-f` flag.

``` bash
copier -fa .setup-py-copier-answers.yml update
```
Dockerize Angular App
Tags: angular, docker, tutorial, bash
Published: 2022-01-08 15:27:11

## Agenda

Dockerize an [Angular app](https://angular.io/), built with the [Angular CLI](https://angular.io/cli), using [Docker](https://docs.docker.com/engine/), In this blog we will have a walkthrough of angular 7 and dockerize it over node image(base). 

Here, we specifically focus on:
1. Create an angular app using CLI and test it locally
2. Create an image for dev environment with code Hot-reloading


## Project Setup

Install the [Angular CLI](https://github.com/angular/angular-cli) globally:

```
npm install -g @angular/cli@7.3.10
```

Generate a new app aka “angular-microservice” using CLI:

```
ng new angular-microservice 
cd angular-microservice
```

(optional)To generate in present dir use: 

```
ng new angular-microservice –directory ./
```

## Docker Setup

Add a Dockerfile to the project root:

```
# base image
FROM node:12.2.0

# set working directory
WORKDIR /app
# install and cache app dependencies
COPY package.json /app/package.json
RUN npm install
RUN npm install -g @angular/cli@7.3.10

# add app
COPY . /app

# start app
CMD ng serve --host 0.0.0.0
```
**Building Docker image**

```
docker build -t angular-microservice:dev .
```
**Run Docker Image**

Run the container after the build is done:

```
docker run -d -v ${PWD}:/app -v /app/node_modules -p 4201:4200 --rm angular-microservice:dev
```

Use the -d flag to run the container in the background:

```
docker run -d -v ${PWD}:/app -v /app/node_modules -p 4201:4200 --name foo --rm angular-microservice:dev
```

Please react if you found this blog helpful and informational.
Top 5 Demanding Tech in 2022
Tags: webdev, javascript, career, beginners
Published: 2022-01-08 15:18:30

Computer Science filed is emerging now days and its still continue with almost next decade with trend and some of field which pay you most in 2022 is following
####1. Data Science and Machine Learning 
 Data science is a field of study that aims to use a scientific approach to extract meaning and insights from data.
 Machine learning, on the other hand, refers to a group of techniques used by data scientists that allow computers to learn from data.<br>
Machine learning and data science both are high demanding tech in computer field you can start with both on Coursera, YouTube and Udemy.
####2. DevOps
DevOps is next level technology which is required in digital era for fast processing and deploying the applications without compromising the quality of work.
here you can start with DevOps as Beginner
[Free Udemy Course for DevOps Beginners](https://www.udemy.com/topic/devops/free/)
####3. Blockchain
Blockchain is security system or system which record information which is difficult to hack or manipulate and Bitcoin is cryptocurrency and blockchain provide security to the Bitcoin for secure functioning.
[Learn Blockchain ](https://www.edx.org/learn/blockchain)
####4.Full Stack Development
Full stack development means the developer have knowledge about all programming field which contain to specific area in short its Master of one some and jack of all methods for full stack developer in 2022. The full stack development commonly used in web development as well as other but in web development its contain js framework like React/Vue/Angular and node.js etc. 
[Roadmap for Becoming Full Stack Developer](https://www.freecodecamp.org/news/what-is-a-fullstack-developer/)
####5. App Development 
App Development is essential and most demanding skills in 2022 because every business wants there personal android/iOS application and for this they ire app developers to develop application for them you can start with app development with Android and the kotlin/flutter and if you are familiar with React then you can start with React Native app development.
[Google free Course for app Development](https://www.udacity.com/course/new-android-fundamentals--ud851)

Don't forget to comment below if you're getting this article helpful and if you have something to ask my inbox is always open for you...!
connect with me on twitter link in bio...!
In catalogue tại TPHCM IN5GVN
Tags: javascript, programming, python, discuss
Published: 2022-01-08 15:11:41

In Catalogue tại TPHCM In5gcataloguehcm, dịch vụ in catalog nhanh, sắc nét. Thiết kế ( /m/0c5mq ) in Catalog Nhanh theo yêu cầu. In catalogue tại tphcm sẽ mang đến cho bạn giải pháp chất lượng, giá rẻ và giao hàng đúng hẹn. 
Thông tin về dịch vụ in catalogue tại TPHCM
Địa chỉ: 30 Kha Vạn Cân, P.Hiệp Bình Chánh, Tp.Thủ Đức, TP.HCM 
SĐT: 0866 746 766 
Email: in5g@gmail.com 
Website: https://in5g.vn/in-catalogue 
https://en.wikipedia.org/wiki/Catalog 
https://www.google.com/search?q=In+catalogue+tại+TPHCM&kgmid=/m/0c5mq 
https://linktr.ee/in5gcataloguehcm
https://www.credly.com/users/in5gcataloguehcm/badges
http://in5gcataloguehcm.idea.informer.com/
https://cults3d.com/en/users/in5gcataloguehcm
https://cults3d.com/es/usuarios/in5gcataloguehcm
https://dev.to/in5gcataloguehcm
Global using directives in dotnet 6 and C# 9+
Tags: dotnet6, csharp, dotnet, beginners
Published: 2022-01-08 15:00:53

The latest version of dotnet platform now supports global using directives which means we can now add all using directives in one place or 1 file instead of in every class file.

Infact all dotnet 6 project templates automatically include global directives option. In order to declare a global using directive, for example-

    global using System;

Now all files in the project can refer to all the api's in the System namespace.

## Missing Main() method in Program.cs

Another significant change is when you try to create a new console application using visual studio or dotnet cli in dotnet 6 platform you see something like this-

    Console.WriteLine("Hello, World!");

Believe it or not thats the entire program.cs, it made me feel am I writing C# or JS on a browser console, the new C# 9+ evolution is mindblowing. So whats missing? To know that lets go back a bit, dotnetcore3.1 may be-

    using System;

    namespace dotnet5consoleapp
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("Hello World!");
            }
        }
    }

As you can see the using directive is missing, namespace, class program, Main method and last but not the least the curly brackets are missing. In case of dotnet6 the program entry  is generated by the platform in the program.cs file which microsoft documentation terms as using "top-level statements". You can disable implicit using features from config file by removing the node `<ImplicitUsings>enable</ImplicitUsings>` from csproj file.

Now you can keep writing all your code in Program.cs file assuming as if you are writing within the Program class and Main method. This seems like less code but a bit confusing initially you can always refer to ms [documentation](https://docs.microsoft.com/en-us/dotnet/csharp/fundamentals/program-structure/top-level-statements) for details.

Thanks for your time! Keep Learning!
Some Awesome APIs for your next project
Tags: programming, code, api
Published: 2022-01-08 14:44:49

## Some Awesome APIs for your next project

*Several free web APIs are available to connect to your mobile app, web app, or website to add compelling functionality.*

*A web API is an application programming interface that may be accessed through the internet using web-specific protocols.*

*Here are nine APIs to create some fantastic projects:*


------------

**1. The CheapShark API** 

*CheapShark is a service that monitors the pricing of PC games on sites such as Amazon, Steam, and GamersGate and displays the best discounts to customers. Users may check for top bargains, search for the lowest price on a specific game, sign up for notifications, or browse what’s available on the site. Developers may use the CheapShark API to incorporate the site’s pricing data into their websites or apps.*

*link* - [*CheapShark API*](https://apidocs.cheapshark.com/ "CheapShark API")

------------


**2. The Wit.AI**

*Turn text or speech into recognizable actions that your app/website can use.*

*Wit.ai is an interface for natural language processing (NLP) that converts natural language (voice or text communications) into structured data. Wit is used by developers because it streamlines creating apps and gadgets with which users can speak. Developers would have to master natural language processing methods without it. That would take too much time if you only wanted to create a simple application.*

*link* - [*Wit.ai API*](https://wit.ai/ "")

------------

**3. GrammarBot API** 

*The GrammarBot API offers spelling and grammatical checks to your application. Submit the text, and you’ll get a JSON response with potential issues and suggested fixes.* 

*link* - [*GrammarBot API*](https://www.grammarbot.io/"")


------------

**4. Rapid API** 

*Based only on APIs, this is a handy tool. It’s more than simply an API directory; it’s also an API marketplace. If you’ve created an API and want to charge others to use it, you can publish it on RapidAPI.*

*If you only want to utilize APIs, RapidAPI provides an API playground to test an API in several languages! It is pretty beneficial.*

*link* - [*Rapid API*](https://rapidapi.com/hub"")


------------

*Thanks for reading!*


*I hope it motivates you to build more amazing projects, acquire confidence, and grow as a developer!*

*Follow me on [Github](https://github.com/Snehal0308) and [Twitter](https://mobile.twitter.com/SnehalAdbol)*
Share your VScode Extensions
Published: 2022-01-08 14:57:18

While all our amazing Devians have been posting articles on "How to get something accomplished". I think we can have a little bit of interaction with our Developer brethren by knowing what VS code extensions you guys use. i.e if you use VSCode as your code editor in the first place 😜.

I think just by the looks of VScode extensions, one can easily find out the kinda platform that the individual has their hands on with.

I'll go first, Here's my list of Extension:

- **Awesome flutter snippets**: (Not a flutter dev, Yet tried to get into it. So had this installed)
- **Bracket Pair Colorizer 2**: Highly useful if you're dealing with a long list of bracket flow in your code.
- **Dracula theme**: (I keep experimenting with themes, Would love to see some of the themes you guys use. I've got bored of the ones I've been using)
- **Electron Vue theme**
- **Material Icon theme**
- **Electron Color theme**
- **Remote - SSH**: (Most of the time I am connected to servers as all my project files are deployed there. So its super useful for me to use vscode instead of vim/nano editors in servers.
- **Vue**: (My main go-to for Frontend Web Development)
- **Prettier**: (Pretty sure 90% of us use this for code formatting. Although its sadly still missing certain file extensions that I'd love to have them added in the future.
- **Emoji**: (Don't have to run around copying unicodes or Emoji's from web, Instead just directly drop the desired emoji with a simple command in your code)
- **Nuxt**: (Just switched to Nuxt and it has already left me jaw dropping with its way of simplicity in learning curve yet being highly productive. 10/10 highly recommended framework unless you're a React peasant 😜.
- **Vetur**: (Definitely need this for Vue based code snippets and suggestions)
- **Live Server**: (If you're into mainstream HTML,CSS,JS development and are looking for quick deployment + Hot reload, This is a good pick)

Let's hear yours!
[UniswapV2] SwapRouter by @Dialectic
Tags: solidity, uniswap, ethereum, web3
Published: 2022-01-08 14:55:57

## Source
[https://github.com/dialecticch/router](https://github.com/dialecticch/router)

---

## Overview

Simple router to exchange tokens for best price for any `UniswapV2` like AMM. This contract can only be used for exchanges that uses the code of `Uniswapv2` . 

---

## SwapRouterMock

### swap

Returns SwapRouter.swap function.

---

## swap in `SwapRouter` library

### Parameters

- `swaps` is the candidates of exchanges that we can choose.
- `path` is the array of token address which we will use for swap.
- `amount` is the amount of token we want to sell.
- `slippage` is the max slippage in basis points.

---

1. Find the best profitable exchange and the corresponding `amountOut` for given `amount` by using `dataForBestExchange` function.
    
    ```solidity
    (UniswapV2 swap, uint256 amountOut) = dataForBestExchange(swaps, path, amount);
    ```
    
2. Approve `swap` (exchange we choose)  to use `path[0]` (input token for swap) for `amount` . 
    
    ```solidity
    ERC20(path[0]).approve(address(swap), amount);
    ```
    
3. Swap the token using `swapExactTokensForTokens` function from the exchange address. `out` is the real amount of output token we receive.
    
    ```solidity
    uint256[] memory amountsOut = swap.swapExactTokensForTokens(
    	amount,
    	(amountOut * (1000 - slippage)) / 1000,
    	path,
    	address(this),
    	block.timestamp + 180
    	);
    
    uint256 out = amountsOut[amountsOut.length - 1];
    ```
    

---

## dataForBestExchange

Returns the best exchange and the corresponding output value. 

For given `swap`, we calculate the biggest `out` value by using `amountOutFor` function. 

```solidity
for (uint256 i = 0; i < length; i++) {
            uint256 out = amountOutFor(swaps[i], path, amount);
            if (out > bestAmount) {
                bestExchange = swaps[i];
                bestAmount = out;
            }
        }
```

---

## amountOutFor

Use `getAmountsOut` function to calculate the optimal output value from given `amountIn` and `path`. 

```solidity
try exchange.getAmountsOut(amountIn, path) returns (uint256[] memory amountsOut) {
	return amountsOut[amountsOut.length - 1];
} catch {
	return 0;
}
```
Visual Studio Code Must Use Extensions
Tags: vscode, programming, codenewbie, editors
Published: 2022-01-08 14:52:06

Currently, I am using VS code from a few years now and find it comfortable with the time. I will be mention out few of the extension I use alot and make my life a bit easier.

I recommend these plugins to everyone.

- 
[GitLens](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens): GitLens will allow you to see the commits made by each and every developer whoever worked on the project line by line.

It will also allow you to better understand your code, helps you to effortlessly explore the history and evolution of a codebase.

You can search it in the extension explorer or run the following command on your system. 

```
code --install-extension eamodio.gitlens

```

- 
[Copilot](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens): This is cool, It is not the hero you want but this is the hero we need. 

![Batman](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r77fjkn1hnvstespx5jn.jpg)

Sometimes we don't remember syntax or logic but copilot provides you some crazy suggestions sometimes help sometime don't, just like a pair programming buddy.

It support for almost all languages Python, TypeScript, JavaScript, React, and Java. 

You can install it and register for it's access.

```
code --install-extension GitHub.copilot

```

- 
[Visual Studio IntelliCode](https://marketplace.visualstudio.com/items?itemName=VisualStudioExptTeam.vscodeintellicode):
This extension provides AI-assisted IntelliSense by showing recommended completion items for your code context at the top of the completions list.

Following command will help you with installation.
```
code --install-extension 
 VisualStudioExptTeam.vscodeintellicode
```

Few other recommendations are followng.

- Auto Rename Tag: If you are a front-end developer this will help you automatically renaming tags when you rename tags in big DOM.
- Prettier Formatter
- Remote SSH
- Live Server / Live  Share

You can try these out to check what these are :)
Billie | The Most Best Way to Create a Professional Invoice
Tags: atlashackathon, sideprojects, mongodb, showdev
Published: 2022-01-08 14:28:56




### Overview of My Submission

Billie is a user-friendly and customizable free invoice producing online invoicing software that allows you to make professional invoices in seconds. It does not require any setup, installation, or upkeep! By simply altering the templates, Billie can also be used for business activities. Dashboard for customer and invoice management has been added. You can send invoice emails to customers directly from the dashboard. This project use mongodb serverless as database. 

Features:
 1. Scheduled Invoice Sending
 2. Customer Management
 3. Manage Invoices

[Note]: # (Please make sure the project links to the appropriate GitHub repository, and includes the [Apache-2 permissive license](https://www.apache.org/licenses/LICENSE-2.0)  and README.)


### Submission Category: 

[Note]: # (E-Commerce Creation, Prime Time, Action Star, Automation Innovation, or Choose Your Own Adventure)
#### Own Adventure

### Link to Code

#### https://github.com/sats268842/billie-invoice

### Additional Resources / Info

* Here is a working live demo :  https://billie.digital


### Screenshots



Landing Page

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rvk2eigo2gbh0o7zjwln.png)

Dashboard


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uk053cxkxwvpiyldeo2x.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zu6klnkl0a4v4m65baqs.png)


#### Built with 

- [Angular](https://angular.io/) - Angular is a platform for building mobile and desktop web applications.

- [Mongodb](https://www.mongodb.com/) - MongoDB is a source-available cross-platform document-oriented database program.

- [FastApi](https://fastapi.tiangolo.com/) - FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.

- [PDFKit](https://pypi.org/project/pdfkit/) - Wkhtmltopdf python wrapper to convert html to pdf using the webkit rendering engine and qt

- [AWS SES](https://aws.amazon.com/ses/) - Amazon Simple Email Service (SES) is a cost-effective, flexible, and scalable email service that enables developers to send mail from within any application. You can configure Amazon SES quickly to support several email use cases, including transactional, marketing, or mass email communications. Amazon SES's flexible IP deployment and email authentication options help drive higher deliverability and protect sender reputation, while sending analytics measure the impact of each email. With Amazon SES, you can send email securely, globally, and at scale.


- [auth0](https://auth0.com/) - Auth0 is an easy to implement, adaptable authentication and authorization platform.
Daily JavaScript Tips #1
Tags: javascript, node, webdev, beginners
Published: 2022-01-08 14:12:07

**Pass arguments as an object.**

The code becomes much more clear and easily understandable as the name of the properties is clearly visible to you as well any code reviewer.

### Don't do this ❌
```js
const user = (name, email, proUser) => {
        // Logic goes here
}

user('SnowBit', 'xyz@someemail.zyx', true);
```

### Do this ✅
```js
const user = ({name, email, proUser, isAdmin}) => {
        // Logic goes here
}

user({
    name: 'SnowBit', 
    email: 'xyz@someemail.zyx', 
    proUser: true,
    isAdmin: true
});
```

***
Thank you for reading

- Follow me on Twitter - [@codewithsnowbit](https://twitter.com/codewithsnowbit)
- Subscribe me on YouTube - [Code With SnowBit](https://www.youtube.com/channel/UCNTKqF1vhFYX_v0ERnUa1RQ?view_as=subscriber&sub_confirmation=1)
Who am I ?
Tags: javascript, typescript, postgres, go
Published: 2022-01-08 14:09:30


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1d3k762mwdt4enh76cjo.png)
My name is G'ulomjon. I'm from Central Asia. 

**Let's Go**

> Fun fact: Any friend of coffe is a friend of mine!