teleren/devto huggingface dataset:
Sharing Typescript code between AWS Lambda with AWS SAM CLI
Tags: typescript, aws, serverless, node
Published: 2022-07-08 03:55:53

## Introduction

Recently, Amazon has released a beta version of [AWS SAM CLI with the support of Typescript](https://aws.amazon.com/blogs/compute/building-typescript-projects-with-aws-sam-cli/).
The sample works well when you have a simple use case.
Now, imagine that you want to have multiple *AWS Lambda* in your repository and have to share your code.
The goal of this post is to continue using SAM CLI to build and deploy your Typescript code.

## Default configuration

By default, you can notice that the **CodeUri** property is referencing only your function folder.
 
```YAML
HelloWorldFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: hello-world/
      Handler: app.lambdaHandler
      Runtime: nodejs16.x
```

and your code is like the following:

```Typescript
import type { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda';
import { helloWorld } from '../shared/hello';

export const lambdaHandler = async (event: APIGatewayProxyEvent): Promise<APIGatewayProxyResult> => {
    return {
        statusCode: 200,
        body: JSON.stringify({
            message: helloWorld,
        }),
    };
};
```

When you'll try to build with an import that is not part of the current directory you'll get the following error:
> Build Failed
Error: NodejsNpmEsbuildBuilder:EsbuildBundle - Esbuild Failed: ✘ [ERROR] Could not resolve "../shared/hello"

>   app.ts:2:27:
      2 │ import { helloWorld } from '../shared/hello'; 


## Custom configuration

You need to change the **CodeUri** property to a folder that contains all the source files that you want to share.

```YAML
  HelloWorldFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: .
      Handler: app.lambdaHandler
```

Thanks to this configuration you can now share your code between multiple *AWS Lambda*.

By default, **AWS SAM CLI** is using bundling, tree shaking, and minification so the code that is not called in your *AWS Lambda* will not be deployed.

You can look at the code directly on this sample: https://github.com/faridz974/sam-typescript

## Conclusion

**AWS SAM CLI** with the support of Typescript is still in Beta. If you want more advanced features maybe you should not use it.
Lately, in version *1.49.0* `External` and `Loader` properties have been added.
If you want to share your feedback and/or requests [this issue ](https://github.com/aws/aws-sam-cli/issues/3700) has been created.
So tried bun! the new JS runtime.
Tags: javascript, bunjs, node, discuss
Published: 2022-07-08 03:12:57

---
title: So tried bun! the new JS runtime.
published: true
description: 10 years of nodejs, and bun came.
tags: js, bun, nodejs, discuss
# cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8fpyryt1zz6odwz6w3b7.png
 
# Use a ratio of 100:42 for best results.
---
#bun-scripts


## Installation

```bash 
$ curl https://bun.sh/install | bash
```
after this i opened my .bashrc and added the following line:
```bash
BUN_INSTALL="/root/.bun"
PATH="$BUN_INSTALL/bin:$PATH"
# as it wasn't added automatically, i added it manually
```
i restarted my terminal and it worked! 🎉


## working with [.env](./.env) and bun
```bash
# then i did a fancy stuff
echo PORT=5000 >> .env
touch http.js
```

```JavaScript
// http.js
console.log(process.env.PORT)
// USING ENVIRONMENT VARIABLES WITHOUT DOTENV MODULES.
```

```bash
bun run http.js
```

![bunrun](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/06ex1iafdpeqexvsm514.png)

checkout the code [@repo](https://github.com/theabhayprajapati/bun-projects)
---
sugggest me what should i try next with [bun](https://bun.sh)

**🤝🏾Connect me on:**
**Twitter**: 🕊️[`@Abhayprajapati_`](https://twitter.com/Abhayprajapati_)
**Github**: 🐧[`@theabhayprajapati`](https://github.com/theabhayprajapati)
Laravel 8 cURL HTTP Request Example
Tags: laravel, curl, http, php
Published: 2022-07-08 03:09:47

In this article, we will see how to make cURL HTTP requests in laravel 8. In this tutorial, I will give you laravel 8 cURL HTTP request example. The name stands for "Client URL". A cURL is a command-line tool for getting or sending data including files using URL syntax. cURL supports HTTPS and performs SSL certificate verification by default when a secure protocol is specified such as HTTPS.

So, let's see cURL HTTP request, cURL example, cURL get request, cURL in laravel 8, cURL API, cURL post request, cURL get request with parameters, cURL get request PHP.

Many times you need to integrate any third-party APIs in your laravel application you can do this with a cURL or HTTP guzzle request. cURL is very simple and does not take much more time to make GET or POST HTTP APIs requests.

> GET Request Example :

In this example, we initialize the cURL and use the GET data from the URL.

```
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://example.com",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_TIMEOUT => 30000,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => array(
    	// Set Here Your Requesred Headers
        'Content-Type: application/json',
    ),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);

if ($err) {
    echo "cURL Error #:" . $err;
} else {
    print_r(json_decode($response));
}
```

---
 
**_[Read Also : Laravel Custom Export Button In Datatable](https://techsolutionstuff.com/post/laravel-custom-export-button-in-datatable)_**

---
 
> POST Request Example :

In post request, we need to pass the parameter in the CURLOPT_POSTFIELDS field.

```
// Make Post Fields Array
$data = [
    'name' => 'techsolutionstuff',
    'email' => 'test@gmail.com',
];

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://example.com",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30000,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => json_encode($data),
    CURLOPT_HTTPHEADER => array(
    	// Set here requred headers
        "accept: */*",
        "accept-language: en-US,en;q=0.8",
        "content-type: application/json",
    ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error #:" . $err;
} else {
    print_r(json_decode($response));
}
```
 
---
You might also like :

- **_[Read Also : Laravel 8 Toastr Notifications Example](https://techsolutionstuff.com/post/laravel-8-toastr-notifications-example)_**

- **_[Read Also : How To Create Dynamic Pie Chart In Laravel](https://techsolutionstuff.com/post/how-to-create-dynamic-pie-chart-in-laravel)_**

- **_[Read Also : How to Send E-mail Using Queue in Laravel 7/8](https://techsolutionstuff.com/post/how-to-send-e-mail-using-queue-in-laravel-7-8)_**
my new parkour game
Tags: gamedev, community, challenge, game
Published: 2022-07-08 02:54:35

Nexus the beginning is the free 3d parkour, single-player game
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wx22furnuq5u85docjzo.png)
hello, world welcome to nexus.  I don't what happened to me.  so help me to know my dream by sharing your view on my decision [ "I was right " ]. what do you think of this world and decisions [ i am here, I am you] 

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


download here 
https://technocraft27.itch.io/nexus-the-beginning-story
Implement a CPU emulator (a virtual machine) in JavaScript
Tags: javascript, cseducation, emulator, cpu
Published: 2022-07-08 02:51:18

I recently start a youtube channel with coding videos for beginners and recreational coding hobbyists.

This current video is from my channel.

You can find more on youtube at:
[https://www.youtube.com/c/CodingAdventures/](https://www.youtube.com/c/CodingAdventures/)
Day 44 and 45 of 100 days of code complete
Tags: webdev, beginners, programming, 100daysofcode
Published: 2022-07-08 02:35:28

Haven’t posted an update on here in a while. I’ve been posting updates on Twitter mostly but will keep updating here as well. 

I finished building a balance sheet and learning more about CSS pseudo selectors. I learned how to hide information on a page and order it so it makes sense to users using Screen readers. Very informative.
Day 588 : Easier Said Than Done
Tags: hiphop, code, coding, lifelongdev
Published: 2022-07-08 02:33:54

_liner notes_:
- Professional : So many meetings today. Pretty much from morning to the afternoon. haha I was able to get some PRs merged. Looked over someone's PR. Finished reviewing a blog post and got it ready to be posted. Also got to follow up on some community questions. Not bad for a day of mostly meetings.

- Personal : Went through some tracks for the radio show. Lost track of time and went to bed finishing up watching the rest of "The Umbrella Academy" episodes. That was a really good season.

![View from a shallow pond surrounded by trees with a waterfall on the other side with a few shrubs growing in the middle of the pond under a blue sky with a few clouds in Krka Nat'l Park, Croatia](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f2enkj957m4rqr9k89s1.jpg)

Going to go through a bunch more tracks. I want to have enough so I don't have to listen to any more and can focus on putting together the radio show Friday. Going to see if I can figure out what elements I can pull from this library to use in my side project. Should hopefully be just plug and play. That's easier said than done. haha I'm out!

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube 9PN_-fY7hL8 %}
Upload large file to GitHub
Tags: github, file, opensource, programming
Published: 2022-07-08 02:32:59

To upload large file to GitHub, follow the following steps,

## 1. Install and select LFS file

```shell
git lfs install

# I am adding the deep learning model file
git lfs track "*.h5"
```

## 2. Commit and push to the GitHub

```shell
git lfs push --all origin main

git add .
git commit -am "add large file"
git push -u origin main
```

## Solve large file upload issue

If you already tried to upload the file and facing *remote: error: File model.h5 is 270.75 MB; this exceeds GitHub's file size limit of 100.00 MB* similar issue, It can be solved by following method,

## 1. Reset `git`

```shell
git reset HEAD~<HOWEVER MANY COMMITS YOU WERE BEHIND>
```

> If you want to go before one commit: `git reset HEAD~1`

**Pro Tip:** Check git log: `git log`

## 2. Check status and push

```shell
git status

git push
```
ASO guide to your app rank on Google Play Store
Published: 2022-07-08 01:52:12

You have made an awesome app, but it's not ranking on Google Play Store? Don't worry I will share awesome 7 tips to rank your apps on Google Play Store. Even if your app is new, and your competitor has 5 Million above downloads, you can still rank your app on top of the Google Play Store.

The keyword is a very important factor for ranking your app on Google Play Store. You can think of a keyword as a search term that general people will use to find apps on the Play Store. If another app is featured on a certain keyword that you want your app to rank for, you can replace a competitor's app if you make proper use of keywords.

Your app will rank in different positions in different countries over time. The ranking of this app might be different in the United States and the Philippines.


## 1. App icon
Your app icon and the colors used should be different than of your competitors. This will make people catch their attention faster on your app.

## 2. Use keywords in your app title
Find the search term that you think people might search for finding similar apps to yours. You can use keywords in your app title after your app name. For example, [WiFi Thief Detector - Who uses my WiFi](https://play.google.com/store/apps/details?id=tej.wifithiefdetector&hl=en&gl=US). Doing this doesn't change your original app name.

I used this technique at the beginning to improve my rank app on Google Play Store faster. People searching for the keyword "WiFi Thief Detector" and "Who uses my WiFi", both can see the app on Google Play Store.

## 3. Use keywords in your app short description
Similarly, think of a search term that people will search by the feature. Then, make a short description using those keywords. You shouldn't flood the descriptions with keywords only, your sentence should look natural.


For full article, check out: [https://sagasab.com/blog/7-aso-tips-to-rank-your-apps-on-google-play-store/](https://sagasab.com/blog/7-aso-tips-to-rank-your-apps-on-google-play-store/)
3 HTML5 tags you didn't know existed.
Tags: progresstag, abbrtag, detailstag, html
Published: 2022-07-08 00:52:29

There are well over 100 HTML tags. We all know the basics such as div, p, img. But here are three dynamic tags you probably didn't know about.


## The Progress Tag

- The "progress" tag is an easy way to display a progress bar using only HTML. Of course, you can also update the value with JavaScript and move it.

```html
<progress value="30" max="100">30%</progress>
```


## The Details Tag + Summary Tag = Accordion

- If you use the "Details" and "Summary" tags together, you'll get a very simple accordion right out of the box, without the need for JS at all.

```html
    <details>
      <summary>Now open the accordion</summary>
      And here is the accordion body
    </details>
```


## Abbreviation (abbr)

- You can use the "abbr" tag to add notes to the abbreviation. Very useful when writing technical content with many shortcuts that we usually take for granted.

```html
<abbr title="World Health Organization">WHO</abbr> was founded in 1948.

```


**_Thanks for following along and would love to have a feedback of how this helped you._**
What do you consider as a "stable work environment"?
Tags: career, beginners, goals, dream
Published: 2022-07-08 00:44:55

As we exist the pandemic stage of fright, we cannot deny the fact that our mindset towards employment has shifted. Individuals who once worked full-time in a cubicle  found themselves in the comfort of their own homes. People working 70-90 hour work weeks found their productivity enhanced from remote jobs and their hours being cut to a fraction of their old patterns. Some employees became their own bosses and turned to entrepreneurship! Way to go!

But as the shift continues and people are still shifting their gears to find what is the most comfortable for them, the question is still afloat: what will produce the most stable environment for us, produce the most financially to be able to keep us healthy and happy, and give us the freedom we deserve and aspire to live? The answer...is up to you.

As much as we all hate is, success can only be determined by the one living the life success is brought into. That means success is different to me than the next person. One person may want a yacht to go out to the beach every month while another's dream is to be able to have a staycation every week. Two very different goals, two very different ideas of stability in order to get them to that desired outcome.

Have you thought about where you want to be 5 or 10 years from now? Are you doing the right things that will get you there?
#JulyOT 08: .NET nanoFramework GPIO, I2C, SPI and other IO support
Tags: julyoy, iot, embedded, nanoframework
Published: 2022-07-08 00:33:27

---
title: #JulyOT 08: .NET nanoFramework GPIO, I2C, SPI and other IO support
published: true
date: 2022-07-08 00:00:00 UTC
tags: julyoy,iot,embedded,nanoFramework
canonical_url: https://JulyOT.dev/blog/08-nano-framework
cover_image: https://JulyOT.dev/assets/images/JulyOT-banner-8-nanoframework-770d33e22e2443104bc72a8abf8d5fa2.png
series: JulyOT 2022
---

# GPIO, I2C, SPI, PWM, ADC, DAC, Serial and more!

.NET nanoFramework has support for GPIO, I2C, SPI, PWM, ADC, DAC, Serial, 1-Wire. Also the API are aligned with [.NET IoT](https://github.com/dotnet/iot/) making it easy for code reuse between development on a Raspberry Pi with .NET 6.0 and an MCU running .NET nanoFramework.

A comparison on how to reuse code and the differences between .NET IoT and .NET nanoFramework is available [here](https://github.com/dotnet/samples/tree/main/iot/dotnet-iot-and-nanoframework).

There are dedicated classes with detailed documentation and samples for each of them:

- General Purpose Input and Output (GPIO): [System.Device.Gpio](https://github.com/nanoframework/System.Device.Gpio) and associated documentation for the [class library](https://docs.nanoframework.net/api/System.Device.Gpio.html)

- Serial Peripheral Interface (SPI): [System.Device.Spi](https://github.com/nanoframework/System.Device.Spi)and associated document for the [class library](https://docs.nanoframework.net/api/System.Device.Spi.html)

- Inter-Integrated Circuit (I2C): [System.Device.I2c](https://github.com/nanoframework/System.Device.I2c) and associated document for the [class library](https://docs.nanoframework.net/api/System.Device.I2c.html)

- Digital-to-analog converter (DAC): [System.Device.Dac](https://github.com/nanoframework/System.Device.Dac) and associated document for the [class library](https://docs.nanoframework.net/api/System.Device.Dac.html)

- Analog-to-digital converter (ADC): [System.Device.Adc](https://github.com/nanoframework/System.Device.Adc) and associated document for the [class library](https://docs.nanoframework.net/api/System.Device.Adc.html)

- Pulse-width Modulation (PWM): [System.Device.Pwm](https://github.com/nanoframework/System.Device.Pwm) and associated document for the [class library](https://docs.nanoframework.net/api/System.Device.Pwm.html)

- Serial Port: [System.IO.Ports](https://github.com/nanoframework/System.IO.Ports)and associated documentation for the [class library](https://docs.nanoframework.net/api/System.IO.Ports.html)

- One Wire or 1-Wire: [nanoFramework.Device.OneWire](https://github.com/nanoframework/nanoFramework.Device.OneWire) and associated document for the [class library](https://docs.nanoframework.net/api/nanoFramework.Device.OneWire.html)
Blog: 2022-07-08: Content & Tooling Team Status Update
Published: 2022-08-18 15:42:18

---
title: Blog: 2022-07-08: Content & Tooling Team Status Update
published: true
date: 2022-07-08 00:00:00 UTC
tags: 
canonical_url: https://puppetlabs.github.io/content-and-tooling-team/blog/updates/2022-07-08-status-update/
---

# What’s new?

## Welcome back Paula 🎉

We are so excited to have Paula back amongst us who has been hard at work on maternity leave. You’ve been missed and I know we are all looking forward to building some cool things together.

A quick note from Paula:

> Im delighted to be back and I can’t wait to get up to speed and stuck in.

Welcome back to the team!

## In other news…

In addition I just want to bring your attention back to [Aaron’s blog post](https://pup.pt/cat/blog/posts/2022-06-30-changes-to-supported-modules/) on changes to our supported modules. The changes are scheduled to happen on the **15th of July** 👀.

Nice and short this week… activate weekend mode!

![Team Weekend](https://media.giphy.com/media/l0MYHpCZ9yxKXIsjC/giphy.gif)

## Community Contributions

We’d like to thank the following people in the Puppet Community for their contributions over this past week:

- [`puppetlabs-apache#2255`](https://github.com/puppetlabs/puppetlabs-apache/pull/2255): “Automatically include modules used in vhost directories”, thanks to [ekohl](https://github.com/ekohl)

- [`puppetlabs-docker#847`](https://github.com/puppetlabs/puppetlabs-docker/pull/847): “devcontainer install missing package”, thanks to [STaegtmeier](https://github.com/STaegtmeier)

- [`puppetlabs-postgresql#1351`](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1351): “Respect $service\_status on Red Hat-based distros”, thanks to [ekohl](https://github.com/ekohl)

- [`puppetlabs-postgresql#1350`](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1350): “Add version for Ubuntu 22.04”, thanks to [arjenz](https://github.com/arjenz) and the following people who helped get it over the line ([ekohl](https://github.com/ekohl))
#JulyOT 08: IoT for Beginners lesson 2!
Tags: julyot, iot, beginners
Published: 2022-07-08 00:35:14

---
title: #JulyOT 08: IoT for Beginners lesson 2!
published: true
date: 2022-07-08 00:00:00 UTC
tags: julyot,iot,beginners
canonical_url: https://JulyOT.dev/blog/08-julyot-iot-beginners
cover_image: https://JulyOT.dev/assets/images/JulyOT-banner-8-iot-beginners-2dd46376c9b787bf9f2082260655bae5.png
series: JulyOT 2022
---

_Today we live stream lesson 2 of IoT for Beginners - a deeper dive into IoT._

## IoT For Beginners[​](#iot-for-beginners "Direct link to heading")

[IoT for beginners](https://aka.ms/iot-beginners) is a free, open source, 24-lesson IoT curriculum. The second lesson is live-streamed today from the Microsoft Reactor. It was streamed live at 9am Pacific Time, so catch the recording on the Microsoft Reactor YouTube channel.

{% youtube NAcTzfMSxA8 %}
Day 89: Best practices freak 😎
Published: 2022-07-07 23:43:35

Hi!
"The best practices freak", yeah that's me or at least that's how I call myself because even if it is not always the case I often to try to follow best practices and enjoy that feeling you get when you know that you are not only doing something but doing it right/ as it should be done. Today I found a whole repos and wikis of best practices about almost anything I needed to learn about from git, code reviews, code of conduct and more so I think it was a big win for me and I found several good reads over there. Also today I finally finished the Registering feature the one with the legendary multi step form but It may need a fix pull request after I realised that I may need to clean the PR but so far so good tomorrow I will focus more on code refactoring I think the codebase is now a living mess it gives me headaches just to even think about it so tomorrow will be the main focus we will see how clean we can make it 

I think that's enough for today. see you!
Signing off...
Useful (Doom) Emacs Commands/Shortcuts
Tags: emacs, doom, shortcuts
Published: 2022-07-07 13:46:52

Hi! 
This is a note to self sort of an ongoing post that I'll keep adding emacs shortcuts I come across to. 

I use doom emacs in evil mode. So it might or might not be useful to you depending on your configuration. I'm new to emacs myself, but this has been an exciting journey, and I'm looking forward to making the most of it!

Disclaimer: I might include the more uncommon commands here than the ones I use in my regular workflow because of the muscle memory, whereas some might be too obvious for the same reason that it's new to me. So be prepared for a weird jumble ahead! 

Enjoy:

1. `markdown-cleanup-list-numbers`: reorders the numbering in your file if they've been messed up somehow. 

2. `set-background-color`: (and color selection) to choose a background for your frame. I actually got there by mistake but I like the ultra-dark mode the `black` background provides, so it's there to stay!