teleren/devto huggingface dataset:
clean database with github action
Tags: actionshackathon21
Published: 2021-12-08 18:30:52

### My Workflow
This workflow delete session entry older than 30 min  and workflow runs every 10 minutes.
[github Repo](https://github.com/Mr-Ramani/clearOldSession)


### Submission Category: 

Wacky Wildcards



### Yaml File or Link to Code

Workflow:
```YAML
name: Clean DB

on:
  schedule:
    # runs every 10 min
    - cron: '*/10 * * * *'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:

      - name: checkout repo content
        uses: actions/checkout@v2 # checkout the repository content to github runner

      - name: setup python
        uses: actions/setup-python@v2
        with:
          python-version: '3.7.7' # install the python version needed

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt
          
      - name: execute py script # run main.py to get the latest data
        env:
          DbUser: ${{ secrets.DBUSER }}
          DbPass: ${{ secrets.DBPASS }}
          DbHost: ${{ secrets.DBHOST }}
          DB: ${{ secrets.DB }}
        run: python main.py
```

main.py :

```python
from connection import conn,cur
import mysql.connector

try:
    query = "DELETE FROM sessions WHERE TIMESTAMPDIFF(MINUTE,time,CURRENT_TIMESTAMP()) > 30"

    cur.execute(query)
    conn.commit()
    print("cleaned")
except mysql.connector.Error as    e:
    print("db error")
    print(e)
```

connection.py :
```python
import os
import mysql.connector

conn = mysql.connector.connect(user=os.environ["DbUser"], 
                                  password= os.environ["DbPass"],
                                  host=os.environ["DbHost"],
                                  database=os.environ["DB"])

cur = conn.cursor()
```


### Additional Resources / Info

I am using this action in mysql databse [action](https://github.com/Mr-Ramani/clearOldSession/actions)
DevWorkflow
Tags: actionshackathon21
Published: 2021-12-08 18:30:04

[Instructions]: # (To submit to the GitHub Actions x DEV Hackathon 2021, please fill out all sections.)



### My Workflow

So Basically, whenever a person open an issue on github there is a need to know which type of issue it is or what kind of issue has been opened. let us say, if a person has opened an issue then already a template is ready in markdown format to fill up the details related the issue and automatically labeling and greeting is done with the help of github actions and once the Pull Request(PR) is merged the greeting, labeling on PR and closing the issue is done with the help of github actions.This can save the time as well as reduce the efforts for maintainer of repository for there workflow.
 
- Note: This project is opensource under the [Apache licence 2.0](https://github.com/jay-2000/DevWorkflow/blob/main/LICENSE)


### Submission Category: 

- Maintainer Must-Haves.


### Yaml File or [Link to Code](https://github.com/jay-2000/DevWorkflow)

- github link for yaml file: [link](https://github.com/jay-2000/DevWorkflow/tree/main/.github/workflows) or copy paste this link on browser: ` https://github.com/jay-2000/DevWorkflow/tree/main/.github/workflows ` 

### You can connect me at [Github](https://github.com/jay-2000) , [Twitter](https://twitter.com/_Jaystwt) , 
[LinkedIn](https://www.linkedin.com/in/jay-parmar-3755501a1/) ,
E-mail: jayparmar7654321@gmail.com
### Additional Resources / Info

[Note:] - DevWorkflow - [github link](https://github.com/jay-2000/DevWorkflow)

- It was great learning experience in this github action hackathon 2021 looking forward to learn and code more.
Beginning Git and GitHub
Tags: beginners, productivity, github, webdev
Published: 2021-12-08 18:25:56

## Overview 
This is a little series I put together to help absolute beginners get started with git and GitHub.

The series assumes no prior knowledge of git or GitHub. and promise to take you through tips and tricks I've learnt whilst using git and GitHub.

Be sure to ask for clarification at any point in the series, I've got you.
So, Shall we get started 😌💃.

## So what's git really and why does it matter 😒. 

Git is a software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows.

It let you know what changes has been made to a file (usually a [source file](https://www.pcmag.com/encyclopedia/term/source-file) ). In addition to, it  allow you to back up these changes as well as review and revert them.

Git is a free and  [open source](https://en.m.wikipedia.org/wiki/Open-source_software) distributed [version control system](https://www.atlassian.com/git/tutorials/what-is-version-control) created by Linus Torvalds, (the creator of Linux Operating system.) It is   designed to handle everything from small to very large projects with speed and efficiency. 

## and GitHub...🤷 
Simply put, GitHub is an interface of  using functionality provided by git.

To use the lingo, GitHub is a Web-based version control repository that offers all the features of the.
Planning on contribution in Telescope
Published: 2021-12-08 18:25:26

I decided to choose Telescope to work for my release 0.4.
In Release 0.4 we are expected to add features in the existing open source project. 
Since I have contributed on telescope in Release 0.4, and it would be great to work on a different area of the project, I decided to pick some issues, and create a new issue in telescope.
Most of the issues were taken by other students, however there was a new [issue](https://github.com/Seneca-CDOT/telescope/issues/2488) that I would like to work on, since I have never got to work on the security and policy side in any of the project.

Also, I did not know that clicking the date or author would open the original post in a new tab, I filed a new [issue](https://github.com/Seneca-CDOT/telescope/issues/2559) so that clicking the title would open the original post in a new tab. I had to close the issue since now I got to know that the feature is not needed. 

I will keep searching for new issues in other projects as well that I could contribute.
GitHub Action for Generating a World Map of Repository Contributions
Tags: actionshackathon21, github, go
Published: 2021-12-08 18:01:57

I found the inspiration to create this workflow after seeing some GitHub repositories listing contributors at the end of README. I thought that having a visual representation that shows where the contributors live would be a nice addition to those lists.

### My Workflow

Below is a minimal example of how to use the workflow to get an SVG map generated and placed inside your repository once a week. 

```yml
name: Create Contributor Map

on:
  schedule:
    - cron: "0 8 * * 1"
    
jobs:
  build-and-push-image:
    runs-on: ubuntu-latest
    
    steps:
      - name: Contributor Map
        uses: tunaitis/contributor-map@v1 
```

A new file "contributor-map.svg" will be committed to your repository at the end of the workflow. You can then include it in your README or any other Markdown document inside your repository using the following syntax:

```markdown
![Title of the map](contributor-map.svg)
```

### Submission Category: 

Wacky Wildcards


### Yaml File or Link to Code

{% github https://github.com/tunaitis/contributor-map %}

### Additional Resources / Info

Other actions used in the workflow:

- https://github.com/actions/checkout
- https://github.com/stefanzweifel/git-auto-commit-action

For the world map generation, a template from Wikipedia is used:
- https://en.wikipedia.org/wiki/Wikipedia:Blank_maps#/media/File:BlankMap-World.svg

The following open source databases were used to convert user-entered location information to ISO Alpha-2 country codes:
- https://geonames.org/ 
- https://github.com/dr5hn/countries-states-cities-database
Programming & GIS
Tags: python, gis, scripting
Published: 2021-12-08 17:59:15


## What is GIS?

GIS (Geographic Information System) is a system of spatial data creation, management and analysis. It connects location, where things are, to descriptive information, what things are like there.

## Why programming is vital in GIS

Utilizing programming and scripts can unlock endless possibilities in map editing and analysis. It can allow users to create custom buttons and functionality that was not provided in off-the-shelf GIS software. An organization can dedicate one member to create custom functionality, then distribute to other users who are not as familiar with the process; just like how libraries and code is shared in web and app development projects. Automating workflows is another benefit. Mapping processes that previously required manual intervention for analysis and QA/QC can be expedited with scripts   

## Prominence of Python in GIS
There are numerous programming languages utilized with GIS software, but the most popular GIS software such as ArcGIS and QGIS integrate Python, as it is generally a beginner friendly for users with limited or no background in programming and can be efficient in creating scripts.

## Examples

ESRI ArcGIS ModelBuilder allows users to create, edit, and manage workflows of geoprocessing tools. It is like a visual programming language, resulting in Python code that can be used again later and distributed easily.

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

Traditional Python programming in QGIS for more experienced (or brave!) users.

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

## Why Programming & GIS are important to me
I have a degree in GIS and have always had a passion of mapping. Programming allows me to integrate my new interest of software development into my mapping passion and open doors to exciting career opportunities.

####Resources
https://www.esri.com/en-us/what-is-gis/overview
https://www.e-education.psu.edu/geog583/node/67
https://desktop.arcgis.com/en/arcmap/10.3/analyze/modelbuilder/what-is-modelbuilder.htm
https://www.gislounge.com/use-python-gis/
https://www.geospatialworld.net/blogs/geospatial-python-do-you-need-to-learn-it/
Day 84/100 CSS Color
Tags: 100daysofcode, javascript, css, motivation
Published: 2021-12-08 17:58:12

A variety of color selection, not only specify colors in general but evaluate the whole concept of color syntax and usage of mixtures in details.

![banner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ykxrorp781ah5wulj1pc.png)

**Colors in CSS can be described in three different ways:**
- *Named colors* — English words that describe colors, also called *keyword colors*
- *RGB* — numeric values that describe a mix of red, green, and blue
- *HSL* — numeric values that describe a mix of hue, saturation, and lightness

## Dog Years
Dogs mature at a faster rate than human beings. We often say a dog’s age can be calculated in “dog years” to account for their growth compared to a human of the same age. In some ways we could say, time moves quickly for dogs — 8 years in a human’s life equates to 45 years in a dog’s life. How old would you be if you were a dog?

Here’s how you convert your age from “human years” to “dog years”:

- The first two years of a dog’s life count as 10.5 dog years each.
    
- Each year following equates to 4 dog years.

## Code Snippets

```
// current age
var myAge = 30;
// number of years
var earlyYears = 2;
earlyYears *= 10.5;

let laterYears = myAge - earlyYears;
laterYears *= 4;
let dogYear = laterYears * 4;
let myAgeInDogYears = earlyYears + laterYears;

let myName = 'Riolette'.toLowerCase();

console.log(earlyYears);
console.log(laterYears);
console.log(dogYear);
console.log(myAgeInDogYears);
console.log(myName);
console.log(`My name is ${myName}. I am ${myAge} years old in human years which is ${myAgeInDogYears} years old in dog years.`);
```

## a11y myths
**We can quickly add accessibility before the release**

> Won't work. Maybe easy things such as alternative text or form labeling may be added at the end, but some complex UX should be planned to be accessible. In some cases, making features accessible at the end of development process may require the full refactoring. 

[![resource](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/stlk1tns4zh7robhiygt.png)](https://css-tricks.com/newsletter/222-a-note-about-color-variables/)
My last week in Task-Force4.0.
Published: 2021-12-08 17:55:20

How do you feel when you achieved your goals? I guess to Wow to yourselves. Yeah, that is what happened to me on the 3rd of December 2021 Friday, I was in shock at how amazingly I and my team did present our final work to the rest of the teams both at COA(Code Of Africa) and Awesomity Lab.

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

As always, not the whole weekdays was as Friday was. especially Wednesday on 1st December was the day everyone in the team panicked to the extent we started losing hope as a team but trust me with all we can we managed to work together and come up with the solution that fits our end product. The problem we had was to come up with the solution of deploying our backend application by containerizing the application as well as setting up the CI/CD pipeline that will help us to deploy the app automatically without us going back to the server to add additional configuration. Now you can imagine how hard and amazing this was.

In the middle of the journey I mean in week 4, I was asked to provide a quote that I like and I replied with this "I don't care if it works on your machine! We are not shipping your machine!"(Vidiu Platon) Okay now everyone is saying that I am hash but this is of nothing to being strict or hashy. Ohhhhh poor me because in that last week I had to defend my quote by doing exactly what it means in software development and I did it.

What can I say if I am asked what has changed since I joined the program both personally and professionally? my answer to this question is that personally, I learned what it means to be me and what being me means to all the surrounding environment and professionally I have gained skills that will positively impact my career and make me stand out in this industry of software development. 
I would like to conclude by thanking everyone who's efforts were invested in this program by helping us to grow and learn for a better future. Thanks again
⭐️ CodeCast's Coding Advent: Day Eight ⭐️
Tags: javascript, react, tutorial, beginners
Published: 2021-12-08 17:53:30


![Day 8](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zyzwc63909ehxvmh90bj.png)

## DAY 8

On the eighth day of coding, we give to you...

The first part of a 3-part series on React & Redux! It might not seem so festive but nothing says cheer like mastering a language!

Checkout out the [Cast](https://www.codecast.io/casts/jZrpNPzNLo78-a-react-redux-beginner-s-project-pt-1) by Ambassador [Michael Tirona](https://twitter.com/TironaCodes) here!

You can also be sure to follow us on [Instagram](https://www.instagram.com/codecastapp/), [Twitter](https://twitter.com/CodeCastApp), [Facebook](https://www.facebook.com/codecastapp), and [LinkedIn](https://www.linkedin.com/company/code-cast/) to see our daily advent releases there!
Climatetech looking for a CTO
Tags: php, career, startup, webdev
Published: 2021-12-08 17:46:45

Hello everyone, I'm Adrien (blue shirt), I'm looking at a CTO for our ClimateTech.

- I'm the cofounder of adapt, a tool that helps our thousand of users to reduce the GHG emission of their energy consumption by visualising the "electricity weather forecast". Our users in Europe consume electricity wisely : they reduce consumption when carbon intensity is higher ("peak demand"), and they post pone some electricity consumption when carbon intensity is lower (e.g. "smartcharging of electric vehicles"). Our beta tool works with manual actions of our users, and we're automatising the process for significant electric uses (e.g. HVAC & EV charging) and GHG emissions reduction calculation.

- Our beta is available here: [www.adapt.sh](url)

- I started adapt with a friend of mine, working as part-time full stack developer, and we now have a junior full stack developer and some freelances. We have thousands of users and are working on some really interesting pilot projects with energy organisations. We're a non-profit and we're looking at a CTO willing to dedicate its coding skills to fighting climate change! Please send me an email at adrien [at] adapt.sh

- Our current tech FYI: Languages: css (especially twitter bootstrap 4), javascript (very little...), php 7.x ; Framework: symfony 4.x ; Web hosting: docker (local), AWS elasticbeanstalk (production)

Thanks in advance!
AWS re:Invent 2021 — Serverless Inference on SageMaker! FOR REAL!
Tags: serverless, mlops, machinelearning, deeplearning
Published: 2021-12-09 11:44:20

---
title: AWS re:Invent 2021 — Serverless Inference on SageMaker! FOR REAL!
published: true
date: 2021-12-08 17:26:50 UTC
tags: serverless,mlops,machinelearning,deeplearning
canonical_url: https://julsimon.medium.com/aws-re-invent-2021-serverless-inference-on-sagemaker-for-real-daa1ce2a5cd0
---

### AWS re:Invent 2021 — Serverless Inference on SageMaker! FOR REAL!

At long last, [Amazon SageMaker](https://aws.amazon.com/sagemaker) supports serverless endpoints.

In this video, I demo this newly launched capability, named [Serverless Inference](https://docs.aws.amazon.com/sagemaker/latest/dg/serverless-endpoints.html). Starting from a pre-trained [DistilBERT](https://huggingface.co/distilbert-base-uncased) model on the Hugging Face model hub, I fine-tune it for sentiment analysis on the IMDB movie review [dataset](https://huggingface.co/datasets/imdb). Then, I deploy the model to a serverless endpoint, and I run multi-threaded benchmarks with short and long token sequences. Finally, I plot latency numbers and compute latency quantiles.

⭐️⭐️⭐️ Don’t forget to subscribe to be notified of future videos ⭐️⭐️⭐️

{% youtube cUhDLoBH80o %}

Notebook: [https://gitlab.com/juliensimon/huggingface-demos/-/tree/main/serverless-inference](https://gitlab.com/juliensimon/huggingface-demos/-/tree/main/serverless-inference)

Documentation: [https://docs.aws.amazon.com/sagemaker/latest/dg/serverless-endpoints.html](https://docs.aws.amazon.com/sagemaker/latest/dg/serverless-endpoints.html)

New to Transformers? Check out the Hugging Face course at [https://huggingface.co/course](https://huggingface.co/course)
Mocking the AWS SDK With Go
Tags: mock, go, aws
Published: 2021-12-08 17:22:35

Mocking a client library is a common technique when building test-driven development. In golang, this can be done by creating structs that implement interfaces and then override the methods you are trying to mock. This example of mocking can be done with any method, but for this post, I will use AWS Organizations to demonstrate.
### Implementation Code
First, we want to create a struct that will be used as the methods' instance. As you see below, we are going to implement the interface of the SDK provided organizations API:
```golang
type Organizations struct {
	Client organizationsiface.OrganizationsAPI
}
```
Then once we have defined that, we will have to instantiate the method we want to implement, which for the main implementation will be a pass-through for the method used by the client.
```golang
func (s *Organizations) ListAccounts(in *organizations.ListAccountsInput) (*organizations.ListAccountsOutput, error) {
	result, err := s.Client.ListAccounts(in)
	return result, err
}
```
Finally, we will want to create a method we will test. We must parameterize the struct to help our test define which method to use.
```golang
func WhatAreMyAccounts(client *Organizations) (*organizations.ListAccountsOutput, error) {
	return client.ListAccounts(
		&organizations.ListAccountsInput{
			MaxResults: aws.Int64(5),
			NextToken:  nil,
		},
	)
}
```
### Test Code
For testing, we will create our Mock struct, followed by our method override, and then wrap that within a given test. The MockOrganization struct will implement an interface, which we can later utilize as the organization's client.
```golang
type MockedOrganizations struct {
	organizationsiface.OrganizationsAPI
}
```
For the test, we want to guarantee a response. Therefore, we will define a separate implementation of the organization interface, of which we will return a constant value for the test suite.
```golang
func (m *MockedOrganizations) ListAccounts(in *organizations.ListAccountsInput) (*organizations.ListAccountsOutput, error) {
	return &organizations.ListAccountsOutput{
		Accounts: []*organizations.Account{
			{
				Arn:   aws.String(""),
				Email: aws.String("test1@example.com"),
				Id:    aws.String("234567890"),
				Name:  aws.String("test-1"),
			},
			{
				Arn:   aws.String(""),
				Email: aws.String("test2@example.com"),
				Id:    aws.String("123456789"),
				Name:  aws.String("test-2"),
			},
		},
	}, nil
}
```
On the test code, by using our mocked interface, we can create an Organizations object. The application's function then calls our mocked response to yield the result to test.
```golang
func TestListAccounts(t *testing.T) {
	test := Organizations{
		Client: &MockedOrganizations{},
	}
	resp, err := WhatAreMyAccounts(&test)
	assert.Equal(t, len(resp.Accounts), 2)
	assert.NoError(t, err)
}
```
### Results
```shell
➜  main go test -v
=== RUN   TestListAccounts
--- PASS: TestListAccounts (0.00s)
PASS
ok      main/cmd/main   0.117s
```

To see the full code, check out the below gists:

{% gist https://gist.github.com/danquack/a870a0b46f1245cac4a4aef7acfea152 %}
Mejor app de mensajería instantánea
Tags: whatsapp, javascript, tutorial, android
Published: 2021-12-08 17:08:57

La comunicación es una de las partes fundamentales del mundo y nos ha brindado una gran ayuda a la hora de poder comunicarnos. Actualmente es una de las parte más importantes en todos los aspectos, desde económicos hasta sociales.
Cada vez comunicarnos se vuelve muchos más fácil, con las aplicaciones podemos comunicarnos de forma sencilla con personas de todo el mundo.

Una de las mejores aplicaciones que tenemos para mensajear es WhatsApp la más utilizada a nivel mundial. Gracias a su facilidad de usar todos la pueden utilizar.

Pero existen otras como <a href="https://www.noticieroandroid.com/aplicaciones/gbwhatsapp-pro/">GBWhatsApp Pro</a> que cumplen la misma funcione y además nos dan otras funciones.