teleren/devto huggingface dataset:
GitHub Actions & Security - NDC London
Published: 2022-03-09 03:05:16

---
title: GitHub Actions & Security - NDC London
published: true
date: 2021-01-28 00:00:00 UTC
tags: 
canonical_url: https://devopsjournal.io/blog/2021/01/28/GitHub-Actions-NDC-London
---

Today I delivered my GitHub Actions & Security session at [NDC London](https://ndc-london.com/agenda/how-to-secure-your-github-actions-0vd4/0gnrspzjdmb) for the first time (both for the session and NDC London 😁).

NDC London was a lot of fun! The organizers really went out of their way to enable speakers to even see the attendees, welcome you into the room and guide you through things.

# Presentation

You can find the presentation on [SlideShare](https://www.slideshare.net/RobBos10/github-actions-security).

Keep note of this page, as I will start adding new blogpost discussion security measures when using GitHub Actions here with the learnings from this session.

![SlideShare image of the presentation](https://devopsjournal.io/images/20210128/20210128_01_SlideShare.png)

# How to secure your GitHub Actions

When working in the real world with continuous integration / continuous deployment, you have to take care of your pipelines. - Who can push to an environment? - Who could change the connection strings to the database? - Who can create new resources in your cloud environment? - Do you trust your third party extensions? I’ll go over each of these aspects of your GitHub Actions Workflows and show you what to look for and how to improve your security stance without locking every DevOps engineer out.

More info about this session can be found [here](https://sessionize.com/s/RobBos/how_to_secure_your_github_actions/36976).
How to get the width and height of the window using JavaScript?
Tags: javascript
Published: 2021-01-28 00:00:00

---
  title: How to get the width and height of the window using JavaScript?
  published: true
  tags: JavaScript
  date: Thu Jan 28 2021 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/get-width-height-of-window-javascript
  cover_image: https://melvingeorge.me/_next/static/images/main-41b9ea6e1015a79e39c0bb889f3e2f2e.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/get-width-height-of-window-javascript)
  
To get the width and height of the window, you can use the `innerWidth` property and `innerHeight` property respectively in the global `window` object in JavaScript.

```js
// window height
const height = window.innerHeight;

// window width
const width = window.innerWidth;

console.log(height, width); // 711 1440
```

- Both the properties return the pixel value in the `Number` type.

See this example live in [JSBin](https://jsbin.com/bakofohuyu/2/edit?js,console,output).

### Feel free to share if you found this useful 😃.

---
Filewatcher in Golang
Tags: go
Published: 2021-04-08 13:18:19

---
title: Filewatcher in Golang
published: true
date: 2021-01-28 00:00:00 UTC
tags: Go, Golang
canonical_url: https://mnlwldr.com/filewatcher-in-golang/
---

This is a simple example of how to move files from one folder to another automatically with Go and [fsnotify/fsnotify](https://github.com/fsnotify/fsnotify).

```go
func main() {
	srcDir := "path/to/a"
	destDir := "path/to/b"

	watcher, err := fsnotify.NewWatcher()
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	defer watcher.Close()

	done := make(chan bool)
	go func() {
		for {

			event, ok := <-watcher.Events
			if !ok {
				return
			}
			if event.Op.String() == "CREATE" {
				log.Println("[event] ", event)
				newPath := destDir + filepath.Base(event.Name)
				err := os.Rename(event.Name, newPath)
				if err != nil {
					log.Fatal(err)
				}
			}
		}
	}()
	err = watcher.Add(srcDir)
	if err != nil {
		log.Fatal(err)
	}
	<-done
}
```
Cookies vs Sessions
Tags: programming
Published: 2021-01-27 23:44:58

Para poder adentrarnos en el tema de Cookies y Sessions es necesario saber que estas “herramientas” se crearon porque el protocolo HTTP es Stateless, lo que significa que no maneja estados almacenados entre cliente y servidor. Ahora, la diferencia entre Cookies y Sessions:

- Cookies: Almacenan información en el navegador, es decir del lado del cliente.

- Sessions: Almacenan información del lado del servidor, sin embargo las sesiones proporcionan una Cookie para indicarle al servidor que sesión estamos utilizando.

**Explicando como funciona una Cookie**

• El servidor es quien define cuando se almacena la información, esto es proporcionado al cliente mediante el header llamado Set-Cookie.
      
• Para que la Cookie se mantenga vigente se tiene que enviar en cada una de las solicitudes que se realizan al servidor.
      
Ahora, ¿Cómo y donde se crea una Cookie? Tenemos dos formas de hacerlo, se puede hacer tanto con Javascript, o simplemente haciendo una petición hacia el servidor.

Vamos a ver la segunda opción: 

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


1. El cliente envía una petición al servidor.
       
2. El servidor responde con una petición HTTP con el header Set-Cookie y el valor de la Cookie.
       
3. El cliente ahora puede realizar peticiones hacia el servidor utilizando la misma Cookie, por lo que el servidor va a reconocerlo en cada una de las peticiones.

Una Cookie cuenta con argumentos/parámetros que vamos a conocer a continuación:

• Domain: 
   ◦ Define el host en donde es válida la Cookie, en el caso de que no sea especificada, el navegador lo definirá como el host actual
          
  ◦ El “.” nos sirve como un comodín para hacerle saber que la Cookie va a ser usada en todos los subdominios de este dominio, como mipagina.com y blog.mipagina.com o www.mipagina.com
             
• Expires: Nos define un tiempo de duración de la Cookie creada
      
• Path: Es el lugar desde donde puede ser usada/enviada la Cookie, básicamente sería el contexto en donde puede ser usada, tomemos de ejemplo el siguiente: path=/videos 
  
  ◦ Podrá ser usada en todos los lugares donde el path empiece con /videos, /videos/usuario1, etc.

• Content: Es la lista de valores que son almacenados en la Cookie, un ejemplo podría ser usuario=”escritor”; logged_in=”1”
      
• HTTP Only Flag: Define si la Cookie puede ser enviada a través del protocolo HTTP, esto por ejemplo nos condicionaría al tratar de leer la Cookie a través de Javacript.
      
• Secure Flag: Solo se envía la Cookie a través de SSL, es decir HTTPS.


**Explicando como funciona una Session**

En primer lugar y como dije arriba, las sesiones necesitan de una Cookie para poder funcionar, y la diferencia también explicada arriba es que la sesión se almacena del lado del servidor, y puede ser guardad en memoria, en archivos o en una base de datos.

Esto puede ser creado a través del Backend, en Node puede ser creado con el módulo express-session, y en PHP lo más común es utilizar la variable global $_SESSION.
Anime CLI Project
Published: 2021-01-27 23:42:12

This blog post will be discussing the rollercoaster I was on while completing my first flatiron coding project.  It will go into detail on the project I created and the difficulties I encountered. 

When it came to the ideation of this project, I wanted to create a personal aspect that would keep me motivated throughout the process.  Since I'm an avid watcher of Anime shows so I decided to use an Anime API, specifically, the one by Jikan.  From this API. I created a command-line interface(CLI) that acted as a library and would provide the user information for a particular anime. 

After entering the name of the anime you wanted to know about,   displayed in the terminal would be basic information, like title, id, and a synopsis of the show.  Then the user would be prompted and asked if they would like more information, if so, the user would be provided with further details on the show like when it started and when it ended. Lastly, the user would have the option to look at a recommended list of shows based on the anime they searched for. 

Surprisingly, the most difficult part of this project was getting started. Writing the pseudo-code for how this project would interact/work, and understanding the relationships the 3 classes would have was challenging.  This is because typically we would have a spec file that would let us know what was going wrong and if we passed the test.  This time around we had to check every step of the way that everything we were returning was accurate.

Snippet of the pseudo-code:

"CLI class" gets an input -> calls on the "API class" and sends it off a request to get information -> "API class" calls on the anime class to create a new object  -> that new object  is what the "CLI Class" will use /output/do something to


Link to my Github CLI Project: https://github.com/Bcharlotin1/anime_cli_project
Solution commands when Flutter build error happened
Tags: flutter, ios
Published: 2021-01-27 23:35:08

# Check the error details

```sh
flutter run --verbose
```

# flutter clean


```sh
flutter clean
```

# Reinstall pod files

```sh
flutter clean
rm -rf ios/Pods
rm -rf ios/.symlinks
rm -rf ios/Flutter/Flutter.framework
rm -rf ios/Flutter/Flutter.podspec
rm ios/Podfile
```

# Update flutter

```sh
flutter upgrade
flutter clean
```

# Change flutter channel

```sh
flutter channel
flutter channel stable
flutter clean
```

# Clear Xcode cache

This is the solution about Xcode freeze.

```sh
rm -rf ~/Library/Caches/com.apple.dt.Xcode
```

# Remoce Derived Data

```sh
rm -rf ~/Library/Developer/Xcode/DerivedData/
```

# Remove cache by Xcode Tools

```sh
xcrun --kill-cache
```

# Remove the app and settings on simulator

```sh
xxcrun simctl erase all
```

# Remove CocoaPods cache

```sh
pod cache clean --all
```

# Update Cocoapods itself

If you need sudo permission, please use sudo.

```
[sudo] gem update cocoapods
```

If you use old gem version, please update gem.

```
gem update --system
```
Modern Shopify theme development
Tags: javascript, webpack, vue, webdev
Published: 2021-01-27 23:23:23

If you ever tried to develop a Shopify theme you know how ridiculously neglected the official Shopify tooling is. I'm not exaggerating here. I spent countless hours searching for a way to set up a development environment, navigating through abandoned or deprecated Shopify projects, and reading comments from fed up devs. 

![woman in disbelief](https://media.giphy.com/media/xTiTngHGyb6C8qMkta/giphy.gif)

In the end, I said: _"Fine, I'll do it myself"_. That's pretty much how the [Shopify Theme Lab](https://github.com/uicrooks/shopify-theme-lab) project started. Of course, the road to the finished product was a little bit more complicated, but that's another story.

## The Framework
So what exactly is **Shopify Theme Lab**? It can be summed up in one sentence:

> It's a highly customizable Shopify theme development environment, with great developer-experience and modern tooling.

Once you use Shopify Theme Lab you'll see how incredibly simple and enjoyable the process of developing themes can be.

## What can it do?
First and foremost it's probably the easiest way to get up and running with Shopify theme development. And that's the most difficult part.

Some other notable features include:
- It's highly customizable
- You have modern tooling at your disposal. Out of the box, it comes with **Vue** and **Tailwind CSS**
- Remote reloading during development
- Preprocessor support for SASS/SCSS, LESS and Stylus

## Get to work
Head over to the [Shopify Theme Lab repo on GitHub](https://github.com/uicrooks/shopify-theme-lab) and build something awesome 💪🏻
We're hiring! Come build some Web & Mobile Apps with us!  
Tags: reactnative, ios, android, design
Published: 2021-01-27 23:19:38

We're hiring for multiple positions: 

- Sr. Software Engineer (React Native)
- Sr. Software Engineer (iOS focus)
- Sr. Account Strategist 
- UI/UX Designer 

Send us your resume at hi@echobind.com
Wednesday Links - Edition 2021-01-27
Tags: java, kotlin, spring, quarkus
Published: 2021-01-27 12:59:45

The problem with Gradle: really? (15 min read) 🐘
https://melix.github.io/blog/2021/01/the-problem-with-gradle.html

YMNNALFT: The Spring *Utils Classes (5 min read) 🔧
https://spring.io/blog/2021/01/27/ymnnalft-the-spring-utils-classes

Sealed goodies coming in Kotlin 1.5 (6 min read) 🦭
https://zsmb.co/sealed-goodies-coming-in-kotlin-1-5

Kotlin Roadmap - Jan 2021 (3 min read) 🛣️
https://kotlinlang.org/roadmap.html

JEP draft: Primitive Objects (20 min read) 🦕
https://openjdk.java.net/jeps/8251554

JEP draft: Snippets (10 min read) 📜
https://bugs.openjdk.java.net/browse/JDK-8201533

AdoptOpenJDK 8u282, 11.0.10, and 15.0.2 Available (3 min read) 🎉
https://blog.adoptopenjdk.net/2021/01/adoptopenjdk-8u282-11010-and-1502-available

Quarkus 1.11 released (3 min read) 🎉
https://quarkus.io/blog/quarkus-1-11-0-final-released

GraalVM 21.0: Introducing a New Way to Run Java (6 min read) 🎉
https://medium.com/graalvm/graalvm-21-0-introducing-a-new-way-to-run-java-df894256de28

Announcing Distributed Testing for Maven (5 min read) 🪶
https://gradle.com/blog/distributed-testing-for-maven/

ReScript – the language after TypeScript? (16 min read) ⭕
https://blog.codecentric.de/en/2021/01/rescript-compare-typescript-elm/
Alô
Published: 2021-01-27 22:50:53

Meu nome é Iran Garcia. Trabalho como Estagiário em desenvolvimento Front-end na <a href="https://penseavanti.com.br/" target="_blank">Avanti</a>. Comecei na programação em fevereiro de 2020 e desde então me apaixonei pela área, estou sempre estudando novas tecnologias e aprendendo mais, gosto de constantemente sair da minha zona de conforto e buscar conhecimento! Esse blog inicialmente é um desafio para mim, aqui vou compartilhar o que venho aprendendo, alguns conteúdos daora sobre tecnologia e também praticar um pouco da minha escrita. Enjoy it. ( ͡° ͜ʖ ͡°)

Caso esteja curioso e queira ver algum dos meus projetos:  <a href="https://github.com/irangarcia" target="_blank">GitHub</a>.

Se quiser entrar em contato comigo, pode me mandar um [E-mail](mailto:hello@irangarcia.dev) ou mandar uma mensagem no <a href="https://linkedin.com/in/irangarciaj/" target="_blank">LinkedIn</a>.

Aproveita também e me segue no <a href="https://twitter.com/irangarciaz" target="_blank">Twitter</a>.
Survey: State of Application Architecture Quality
Tags: codequality, programming
Published: 2021-01-27 22:41:30

We, at AppLand, are excited to be conducting a market survey for product and software architecture quality.

This 10-minute survey is designed to learn more about both software structural quality and developer efficiency initiatives in software development organizations. “Software structural quality” refers to how well the code meets requirements other than functionality, such as robustness, security, performance and maintainability.

Why should you take it? As with surveys of this type, we will be making the results of this survey public and if we hit our goal of 300+ responses, we will be donating $1,000 to the Girls Who Code organization. By taking a few minutes of your time you will have access to the results and help a good cause.

You can find the survey here:
https://www.surveymonkey.com/r/archsurveygeneral
Lists, Tuples, and Sets in Python
Tags: beginners, python
Published: 2021-01-27 22:37:05

**Intro**

Lists, tuples, and sets are 3 built in Python data types to store multiple variables. While they may serve the same function, each built in data type has a few key differences.

**Lists**

The list data types have the following traits: 
1.Lists are written with brackets.
2.The items in a list are ordered.
3.The items in the list can be changed.
4.Duplicate items in a list are allowed.

**Create a list**

To create a list we use the following syntax:

```
l = ["Bob", "Rolf", "Anne"]
print(l) # prints ["Bob", "Rolf", "Anne"]
```
**Print a list item** 

Because list items are ordered we print them using an index. The first item has an index of 0 the next item an index of one and so on:

```
print(l[0]) # prints "Bob" 
print(l[2]) # prints "Anne" 
```
**Change a list element**

To change an element in a list you refer to the index number :

```
l = ["Bob", "Rolf", "Anne"]
l[0] = "Smith"
print(l) # prints ["Smith", "Rolf", "Anne"]
```

**Add to a list element**

To add an element to the end of a list we use the `append()` method:

```
l = ["Bob", "Rolf", "Anne"]
l.append("Smithy")
print(l) # ['Bob', 'Rolf', 'Anne', 'Smithy']

```

**Remove a list item**

To remove a list item we use the `remove()` method

```
l = ["Bob", "Rolf", "Anne"]
l.remove("Rolf")
print(l) # prints ['Bob', 'Anne']

```

**Sets**

The set data type has the following traits:
1.Sets are written with curly braces.
2.Sets are unordered.
3.Sets are not indexed.

**Create a Set**

To create a set we use the following syntax:

```
s = {"Bob", "Rolf", "Anne"}
print(s) # prints {"Bob", "Rolf", "Anne"}
```

**Add item to a set**

To add an item to a set we use the `add()` method:

```
s = {"Bob", "Rolf", "Anne"}
s.add("Smith")
print(s) # prints {"Bob", "Rolf", "Anne","Smith"}
```

**Remove item from a set**

To remove an item we use the `remove()` method:

```
s = {"Bob", "Rolf", "Anne"}
s.remove("Bob")
print(s) # prints {"Rolf", "Anne"}
```

**Tuples**

The tuple data type has the following traits:
1.Tuples are written with round brackets.
2.Tuples are ordered.
3.Tuples are not changeable.

**Create a tuple**

To create a tuple we use the following syntax:

```
t = ("Bob", "Rolf", "Anne")
print(t) # prints ("Bob", "Rolf", "Anne")
```

**Access tuple items**

Similar to lists we access tuple items using the index number:

```
t = ("Bob", "Rolf", "Anne")
print(t[1]) # prints "Rolf"

```

**Conclusion** 
 
Now you know how to work with 3 of the 4 built in python data types. Next week we will go over the fourth data type in python dictionaries.
How To Open Apple Maps From An Address In SwiftUI
Tags: ios, swift, beginners
Published: 2021-01-27 22:28:41

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

In an iOS app I am working on I need to show a map from an address.
But after researching and asking some questions I was able to get it to work. 

I must admit I struggled quite a bit with how to show an alert if the address string was invalid In hindsight, the solution is pretty straightforward. It comes down to just Observing a published property in an Observable Object Class.


I am finding that SwiftUI has really made things a lot simpler.
I put up a small repository using this feature maybe it would be helpful to others.

[Open Apple Maps In SwiftUI](https://github.com/Ongomobile/OpenMapInSwiftUI) 

Here are some resources I used in my research.

[Apple docs](https://developer.apple.com/documentation/corelocation/clgeocoder/1423591-geocodeaddressstring)

[Ray Wenderlich Tutorial](https://www.raywenderlich.com/14255236-swiftui-maps-location-fundamentals)

[Hacking With Swift](https://www.hackingwithswift.com/)
It's about time... Rails new beginners tutorial by GoRails
Tags: ruby, rails, beginners
Published: 2021-01-27 22:10:44

---
title: It's about time... Rails new beginners tutorial by GoRails
published: true
description: 
tags: ruby, rails, beginner
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/sbtrmso8bv9azx2v02sv.jpeg
---

Hi,

I am not affiliated with GoRail in any way but want to take some time of my busy schedule to share with you a good news for Rails community...

GoRails, one of the hottest sites in the Rails community, has just released a 100% free beginners tutorial. These are in fact 41 small digestible videos that teach the basics of Rails and a bit more with a cool step by step project.

If you want to learn Rails in 2021, look no further for your starting point : https://gorails.com/series/rails-for-beginners
Learned Python 🐍 basics in 24 hours and created my first game!
Tags: python, codenewbie, programming
Published: 2021-01-27 21:59:52

Yesterday, I watched the first couple hours of a [Python Tutorial for Beginners - Full Course](https://youtu.be/4F2m91eKmts) by CleverProgrammer.

It was *super* helpful to learning the basics and fundamentals of coding with Python.

I've learned many frontend languages and techoligies such as Javascript, HTML, CSS, React, Next, Gatsby, and so on...

However, up until this point I had never really divded into the huge ocean of backend development... so I decided to learn Python! 🐍

---

## How did it go?

Pretty smoothly actually. Python is really simple to learn.

It has an easy-to-understand syntax and great documentation. It also didn't hurt that this wasn't the first language I've learned.

After a learning about sets, lists, dictionaries, variables, if/else, while loops, for loops, (*and so many more* 😉), I decided to make my first game.

I chose to recreate Hangman in the terminal.

Github source code ➡ https://github.com/BraydenTW/hangman-python

![Terminal screenshot](https://i.ibb.co/SNztYCP/Screenshot-605.png)

---

It was a great learning experience along the way.

I'd love to hear any feedback you have for my code style/process.

*'til next time!* 👋

![Lebron wave goodbye](https://media0.giphy.com/media/xUOxfoKRdls7OX39fy/source.gif)
Deploy and try Meilisearch in 3 steps - 30 seconds ⏱
Tags: database, meilisearch, cloud
Published: 2021-01-27 21:57:22

[MeiliSearch](https://www.meilisearch.com/) is a powerful, fast, open-source, easy to use, and deploy search engine. Both searching and indexing are highly customizable. Features such as typo-tolerance, filters, and synonyms are provided out-of-the-box. Meilisearch is a great Elasticsearch and Algolia alternative.

Here is how to deploy it in 3 steps with [Qovery]().

## Qovery
Qovery is a PaaS to deploy your full-stack apps on your AWS or Digital Ocean account. Free hosting on Digital Ocean is provided for individual developers. This is what I am going to use for this quick tutorial

## Deploy Meilisearch
### 1. Connect to Qovery
Connect to the [Qovery web interface](https://start.qovery.com) with your Github or Gitlab account. 

### 2. Create a project
Give a name to your project.

### 3. Use Meilisearch template
Then select the Meilisearch template, click on "next", then click on "Deploy"

![Meilisearch template on Qovery](https://dev-to-uploads.s3.amazonaws.com/i/701osxjepgmelfcalpsc.png)

Congrats 👏, your Meilisearch instance is deployed and available through the provided public URL.

Check out the final video
{% youtube E0RejclnL4w %}

In the next article, I will explain how to attach a custom domain.
Question - Should I write about it?
Tags: discuss, docker, selfhosted, degoogle
Published: 2021-01-27 21:21:33

---
title: Question - Should I write about it?
published: true
description: 
tags: discuss, Docker, selfhosted, degoogle
//cover_image: https://direct_url_to_image.jpg
---

Hi!

I’ve recently decided to quit google and replace google’s services with different services to secure own my data + avoid privacy issues...

If you wonder what’s “degoogle” about, see this article: [here](https://www.reddit.com/r/degoogle/comments/huk4rp/why_you_should_degoogle_intro_degoogling/)

I was thinking about writing a series of articles about deploying some self-hosted solution to your private servers/NAS/VPS. All in Docker, I could use Terraform to spin up some VPS. Some reverse-proxy, securing the setup, using SSL, etc.

Some initial ideas for articles:
1. Building a simple Infrastructure as a Code using Terraform to spin up our server.
2. Deploying Ghost as a blog engine.
3. Adding Comments engine and plugging it to the blog.
4. Adding Analytics solution and plugging it to the blog.
5. Deploying some cloud storage solution for storing files.
6. Separate article about reverse proxy, securing the setup, using SSL certs, hardening the server setup.
7. Other services that will be needed to replace google with something.
8. If you have more ideas, just let me know.

Would you find such articles useful? 
Maybe it would be a great opportunity for you to learn something new, like #terraform, #docker, #reverse-proxy, #iaac? :)

Let me know your thoughts!

Cheers,
Thomas