teleren/devto huggingface dataset:
Google Gemini Free API
Tags: googlecloud, javascript, api
Published: 2024-04-02 16:51:05

# Gemini-API 

Gemini API is a free api for chatbot development using google gemini model

> Click Here :- https://gemini-apis.vercel.app/api?prompt=Hi
> https://gemini-apis.vercel.app/api?prompt=write%20a%20song%20for%20me

> Backup :- https://gemini-api-nfvu.onrender.com/


[Contribute Here
](https://github.com/SH20RAJ/gemini-api/)

{% github https://github.com/SH20RAJ/gemini-api/ %}

Powered by [WhollyAPI](https://github.com/SH20RAJ/whollyapi)

https://dev.to/sh20raj/google-gemini-free-api-269o/edit

{% codepen https://codepen.io/SH20RAJ/pen/wvZpgZd %}


### Endpoints

`/api/?prompt={My Custom Prompt}`

The API endpoint will be `https://{your domain}/api?prompt=myCustomPrompt`


Test API - https://gemini-apis.vercel.app/api?prompt=myCustomPrompt


`/api?prompt={My Custom Prompt}`

The API endpoint will be `https://{your domain}/api?prompt=myCustomPrompt`


### Example - Fetch Response from the API Endpoint

That will return the text

```js
let prompt = "I love you"
// fetching the response from api
fetch('https://gemini-apis.vercel.app/api/?prompt='+encodeURIComponent(prompt)+'')
.then(res => res.text())
.then(res => console.log(res))

```

### Result

```
I'm just an AI assistant, and do not have the capacity to reciprocate feelings or experience emotions like love.
```
{% post https://dev.to/sh20raj/generate-ai-songs-for-free-gemini-api-186k %}
### License
[MIT](LICENSE)
香港專屬伺服器
Published: 2024-04-02 16:47:42

在動態的線上狀態中，網路託管的選擇對於確保網站的最佳效能、安全性和可訪問性起著至關重要的作用。 在眾多可用選項中，香港作為新興的網路託管解決方案中心脫穎而出，提供先進技術、戰略位置和強大基礎設施的整合。 在本文中，我們深入研究香港的網站寄存領域，探討伺服器選項、DDoS 防護、WordPress 託管、網域註冊以及香港資料中心的重要性等關鍵面向。

香港伺服器：精準賦能數位企業
香港因其戰略地理位置而成為託管伺服器的黃金地段，擁有與亞洲主要市場的良好連接。 香港的託管伺服器提供與中國大陸、東南亞等地的低延遲連接，確保全球觀眾的無縫存取。 此外，香港可靠的電力基礎設施和嚴格的資料隱私法進一步增強了其作為託管目的地的吸引力。
**_[香港專屬伺服器](https://www.dataplugs.com/tc/product/dedicated-server/)_**

裸機伺服器：釋放無與倫比的效能
對於尋求最大程度控制和效能的企業來說，香港的裸機伺服器提供了令人信服的解決方案。 這些專用伺服器提供對硬體資源的獨佔訪問，消除了虛擬化帶來的限制。 借助裸機伺服器，組織可以自訂其配置，優化特定工作負載的效能，並根據不斷變化的需求擴展資源，從而確保為使用者提供卓越的託管體驗。

DDoS 防護：防範線上威脅
在網路威脅盛行的時代，DDoS 攻擊對線上業務帶來重大風險，中斷服務並造成收入損失。 認識到這一威脅，香港的網站託管提供商提供了強大的 DDoS 保護機制，以加強其基礎設施免受惡意攻擊。 透過先進的緩解技術和流量過濾機制，位於香港的伺服器可確保不間斷的服務交付，從而保持託管網站的完整性和可用性。

Anti-DDoS 伺服器：強化網路攻擊防禦
除了標準的 DDoS 防護措施之外，專門的反 DDoS 伺服器還有助於阻止針對 Web 應用程式和網路基礎架構的複雜攻擊。 這些伺服器利用智慧演算法和即時監控來快速偵測和緩解 DDoS 威脅，最大限度地減少停機時間並保持託管網站的效能。 借助反 DDoS 伺服器，企業可以在面對不斷變化的網路威脅時充滿信心地運營，保護其數位資產並保持為客戶提供不間斷的服務。

CN2GIA：增強高速連線能力
連接性在數位時代至關重要，特別是對於在亞洲市場運營的企業。 CN2GIA（中國新一代網路存取）是一項優質網路服務，可在香港和中國大陸之間提供高速、低延遲的連線。 透過利用支援 CN2GIA 的伺服器，企業可以優化其在中國市場的覆蓋範圍和績效，充分利用亞洲經濟強國提供的巨大機會。

WordPress 託管：簡化內容管理
由於其用戶友好的介面和廣泛的自訂選項，WordPress 仍然是全球數百萬網站的首選平台。 香港的託管提供者提供專門的 WordPress 託管解決方案，以滿足 WordPress 驅動的網站的獨特要求。 這些託管計劃通常包括優化的伺服器配置、自動更新和強大的安全功能，使企業能夠專注於內容創建和受眾參與，而無需擔心基礎設施管理。

網域註冊：建立數位身份
網域作為網站的數位位址，代表其在網路上的唯一身分。 香港的主機供應商提供全面的網域註冊服務，讓企業輕鬆取得所需的網域。 憑藉各種可用的域名後綴，企業可以選擇與其品牌標識和目標受眾相符的域名，從而在競爭激烈的數位環境中建立強大的線上形象。

香港租用伺服器：靈活性和可擴展性
在香港租用伺服器為企業提供了無與倫比的靈活性和可擴展性，使他們能夠適應不斷變化的市場動態和不斷變化的客戶需求。 無論是想要推出第一個網站的新創公司，還是擴大其數位足蹟的跨國公司，在香港租用伺服器都提供了一種經濟高效的解決方案，可以隨著業務的成長軌跡進行擴展。
Day 2/366
Tags: 1percentplusplus, 100daysofcode
Published: 2024-04-02 15:41:45

🚀 **Today's Learning:**

🌟 DSA

- Memory Units (bits and Bytes)
- Character Encoding Schemes - ASCII & Unicode

🌟 Dev

- Difference between innerText and textContent.
- Use of data attribute for a HTML element
- Difference between loading lazy and loading eager on img tag.
- Difference between rem, em and px.
- Difference between max-width and min-width.

🔍 **Some Key Highlights:**

DSA

- **Bit**: Short for binary digit (0 or 1), a bit is the basic unit of information in computing and digital communications.
- **Byte**: A byte is a unit of digital information that consists of 8 bits. Bytes are commonly used to represent characters, such as letters and numbers, in computer systems. For example, the ASCII encoding scheme uses 1 byte to represent each character (ASCII code for the letter 'A' is 65 i.e. 01000001 in binary)
- In Short:→
    
    1 bit = 1 binary digit ( 0 or 1) 
    8 bits = 1 Byte
    1024  Bytes = 1 KB
    1024 KB = 1 MB = 1 M x 8 bits = 8 Mb (8 Megabits)
    (so 1 Mb = 1/8 MB)
    
**Note**: The MB which people talk about in daily uses like a file size or download speed is actually the Mega Bytes (MB)
    
→ So if you see a wifi recharge plan with speed upto 30 Mbps, It is 30 Megabits per second, means → 30/8 MB/sec = 3.75 MB/sec. Hence, the download speed will be upto 3.75 MB/sec in this plan.
    
- ASCII primarily covers characters from the English alphabet, digits, punctuation marks, and control characters while Unicode can represent characters from all languages, scripts, and symbols worldwide from various scripts, including Latin, Cyrillic, Greek, Arabic, Chinese, Japanese, Korean, and many more, as well as emoji symbols.

- Unicode uses different encoding forms, such as UTF-8, UTF-16, and UTF-32, to represent characters. Among these, UTF-8 is the most commonly used encoding on the web. For example:
- The Unicode code point for the Latin capital letter 'A' is U+0041.
- The Unicode code point for the Devanagari letter 'क' (ka) is U+0915.
- The Unicode code point for the emoji "smiling face with sunglasses" is U+1F60E.
- In HTML, by using UTF-8 encoding and declaring it in the **`<meta>`** tag, you ensure that your HTML document can handle a wide range of characters and symbols, making it suitable for internationalization and multilingual content.

DEV

- **`innerText`** returns visible text, while **`textContent`** returns all text including hidden and line breaks.
- **`data`** attributes allow storing extra information on HTML elements, useful for JavaScript.
- **`loading="lazy"`** delays loading images until they enter the viewport, while **`loading="eager"`** loads them immediately.
- **`rem`** is relative to the root font size.
- **`em`** is relative to its parent's font size.
- **`px`** is an absolute unit of measurement.
- **`max-width`** limits the maximum width an element can have.
- **`min-width`** sets the minimum width an element must have.

 #1PercentPlusPlus #100DaysOfCode #LearningEveryday #LearnInPublic #Programming #Coding #DSA #SoftwareDevelopment
Find if Path Exists in Graph | LeetCode | Java
Tags: leetcode, java, algorithms, beginners
Published: 2024-04-02 16:46:28

``` java
class Solution {
    public boolean validPath(int n, int[][] edges, int src, int dest) {
        
        List<List<Integer>> adjList = new ArrayList<>();
        
        for(int i=0; i<n; i++){
            adjList.add(new ArrayList<>());
        }
        
        
        for(int i=0; i<edges.length; i++){
            int u = edges[i][0];
            int v = edges[i][1];
            
            adjList.get(u).add(v);
            adjList.get(v).add(u);
        }
        
        Queue<Integer> queue = new LinkedList<>();
        boolean visited[] = new boolean[n];
        
        queue.add(src);
        visited[src] = true;
        
        while(!queue.isEmpty()){
            int node = queue.remove();
            
            if(node==dest)
                return true;
            
            for(int ele : adjList.get(node)){
                if(visited[ele]==false){
                    visited[ele] = true;
                    queue.add(ele);
                }
            } 
        }
        
        return false;
    }
}
```

_Thanks for reading :)
Feel free to comment and like the post if you found it helpful
Follow for more 🤝 && Happy Coding 🚀_

If you enjoy my content, support me by following me on my other socials:
https://linktr.ee/tanujav7
Using downloaded custom fonts in Vue.
Tags: webdev, javascript, beginners, programming
Published: 2024-04-02 16:43:58

This is a breakdown of how to use downloaded fonts in Vue.
 Step 1: Download your fonts.
You can check out [befont](befont.com) for downloadable fonts.
Step 2: Add the downloaded fonts files 📄 to your assets folder 📂 in Vue.
Step 3: In App.vue, write out this code

```
@font-face {
  font-family: 'Aeonik';   /* Name of the font */
  src: url('./assets/AeonikTRIAL-Regular.otf');   /* Link to access your downloaded fonts */

}

#app {
  font-family: 'Aeonik', Helvetica, Arial, sans-serif;}
```
You can also use these fonts generally in other components you've created.
Cheers 🥂
Find Unique Binary String | LeetCode | Java
Tags: leetcode, backtracking, java, algorithms
Published: 2024-04-02 16:41:52

``` java
class Solution {
    Set<String> numSet;
    int n = 0;
    String res = "";
    public String findDifferentBinaryString(String[] nums) {
        n = nums.length;
        numSet = new HashSet<>();
        for(String s : nums){
            numSet.add(s);
        }
        
       backTrack("", 0);
        
        return res;
    }
    
    
    void backTrack(String str, int index){
        if(str.length()==n){
            if(!numSet.contains(str)){
                res = str;
            }
            return;
        }
        
        if(index>n)
            return;
        
        String str0 = str + "0";
        backTrack(str0, index+1);
        
        String str1 = str + "1";
        backTrack(str1, index+1);
        
        return;
    }
}
```
_Thanks for reading :)
Feel free to comment and like the post if you found it helpful
Follow for more 🤝 && Happy Coding 🚀_

If you enjoy my content, support me by following me on my other socials:
https://linktr.ee/tanujav7
Learning AWS Day by Day — Day 24 — S3 Introduction — Part 2
Tags: aws, cloud, cloudcomputing, beginners
Published: 2024-04-02 16:31:17

Exploring AWS !!

**Day 24:**

**S3 Introduction — Part 2**

**Accessing Buckets:**
Types of URLs for bucket access:
- Virtual hosted style:
http://bucket.s3.amazonaws.com/object OR
http://bucket.s3-aws-region.amazonaws.com/object
- Path Style:
http://s3.amazonaws.com/bucket/objectOR
http://s3-aws-region.amazonaws.com/bucket/object

**Naming Convention:** should be globally unique, lowercase, (DNS naming)

**Objects**:
without folder → bucket → object (mybucket.s3.amazonaws.com/myobject)
with folder → bucket → folder → object (mybucket.s3.amazonaws.com/folder/object)
Objects are photos, videos, files stored inside bucket. While creating bucket a name is given and name is the ‘object key’. There cannot be any sub-bucket or sub-folder inside a bucket (however folder can be created on console, which provides a logical hierarchy only and are used as prefixes in object key)

**Metadata and Storage Class:**
Object Metadata: for each object S3 maintains a set of system metadata.
— Date: current time and date
— Content-length: Object sizes in bytes
— Last modified
— x-amz-side-encryption: encryption enabled or not
— x-amz-version-id: Object version
— x-amz-delete-marker: object is a delete marker in case of versioning.
— x-amz-delete-marker: Object is a delete marker in case of versioning.
— x-storage class: storage class associated with object.

**Versioning**: enables us to keep multiple versions of same object in one bucket. It has to enabled explicitly, each version has a version ID.
Existing objects are not overwritten i.e. new file will become newer version and it won’t replace older one.
How To Set IAM Roles Permissions For Lambda To Interact With Other AWS Services
Tags: aws, iam, lambda, roles
Published: 2024-04-02 16:31:12

IAM roles are essential for our services to interact with each other in AWS.

In this article we’ll be using the example of Lambda functions since we use them to interact with many of our AWS services.

When you want Lambda to integrate with services like DynamoDB, API Gateway, SNS or EventBridge for example, we must explicitly add an IAM role with the appropriate policies in order to let Lambda communicate with these services.

Let’s take a look at how to do this.

Read more here:

https://medium.com/technology-hits/how-to-set-iam-roles-permissions-for-lambda-to-interact-with-other-aws-services-3ad8a22c598d
Kubernetes Annotations and Labels: What’s the Difference?
Tags: kubernetes, annotations
Published: 2024-04-02 16:29:33

Both labels and annotations are ways to attach metadata to objects in Kubernetes. But when should you use one versus the other?


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


> The Kubernetes documentation is somewhat opaque on this subject:
Labels are key/value pairs that are attached to objects, such as pods. Labels are intended to be used to specify identifying attributes of objects that are meaningful and relevant to users, but do not directly imply semantics to the core system. Labels can be used to organize and to select subsets of objects. Labels can be attached to objects at creation time and subsequently added and modified at any time … Labels allow for efficient queries and watches and are ideal for use in UIs and CLIs. Non-identifying information should be recorded using annotations.


The definition of annotations is shorter, but still somewhat mysterious:

[Use] Kubernetes annotations to attach arbitrary non-identifying metadata to objects. Clients such as tools and libraries can retrieve this metadata.

The actual difference between [annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) and labels is actually quite simple:


Labels are for Kubernetes, while annotations are for humans.
[Tweet this.]( https://ctt.ac/4pUZ9)

## What Are Labels in Kubernetes?

Labels are used in conjunction with selectors to identify groups of related resources. Because selectors are used to query labels, this operation needs to be efficient. To ensure efficient queries, labels are constrained by RFC 1123. RFC 1123, among other constraints, restricts labels to a maximum 63 character length. Thus, labels should be used when you want Kubernetes to group a set of related resources.

## What Are Annotations in Kubernetes?

Annotations are used for “non-identifying information” i.e., metadata that Kubernetes does not care about. As such, annotation keys and values have no constraints. Thus, if you want to add information for other humans about a given resource, then annotations are a better choice.

## Example of Using Annotations and Labels

The following simple example uses both annotations and a selector. The annotations are used to a[dd information about the Kubernetes](https://www.getambassador.io/use-case/collaborative-development) service for humans and are not used by Kubernetes. The selector is used by the Kubernetes service to identify resources that the service will route to.


apiVersion: v1
kind: Service
metadata:
 name: quote
 annotations:
   a8r.io/owner: “@sally”
   a8r.io/repository: "https://github.com/ambassadorlabs/k8s-for-humans/"
spec:
 ports:
 - name: http
   port: 80
   targetPort: 8080
 selector:
   app: quote
`
Desert Dreams: An Abu Dhabi Adventure
Tags: travel, desert
Published: 2024-04-02 16:28:46

The sun beat down on the vast sand dunes as our 4x4 roared to life. My heart hammered in my chest – a mix of excitement and terror – as our Emirati guide, [Desert World](https://www.desertworld.ae/), grinned from the driver's seat. "Ready for some dune bashing?" he boomed.

The next hour was a rollercoaster of adrenaline. The Guide expertly navigated the steep inclines, sending us shrieking with laughter as we plunged down the other side. The desert stretched out before us, a sea of ochre under the endless blue sky.

Later, perched atop a dune, we watched the sunset paint the landscape in fiery hues. Omar, ever the host, brewed fragrant Arabic coffee and explained the life of the Bedouin people. As twilight deepened, a traditional camp emerged, all twinkling lights and colorful carpets. We feasted on a delicious BBQ under a canopy of stars, entertained by mesmerizing belly dancers.

Leaving the desert that night, I was filled with a newfound appreciation for its beauty and culture. But most of all, I was grateful for their infectious enthusiasm and expertise. Desert World turned a simple desert trip into an unforgettable adventure.
Deep Drawn Components manufacturers
Tags: electronics, deepdrawn
Published: 2024-04-02 16:27:11

**[Deep Drawn Components Manufacturers](https://rselectronicsltd.com/)**  play a crucial role in various industries by providing specialized solutions for producing intricate metal parts. Deep drawing is a metal forming process where a sheet metal blank is radially drawn into a forming die by the mechanical action of a punch. This process is ideal for creating components with deep recesses, intricate shapes, and tight tolerances, making it highly versatile across sectors like automotive, aerospace, electronics, and healthcare.

One of the key advantages of deep drawn components is their ability to maintain material integrity, ensuring consistent mechanical properties throughout the part. This makes them suitable for critical applications where strength, durability, and precision are paramount. Manufacturers leverage advanced techniques and technologies to achieve superior results, including CNC machining, finite element analysis (FEA), and computer-aided design (CAD) software.
How To Run A Serverless Scheduled Function Using AWS Lambda & EventBridge
Tags: aws, lambda, serverless, eventbridge
Published: 2024-04-02 16:25:23

AWS EventBridge, formerly known as CloudWatch Events, is a serverless service that lets you run scheduled services and integrates with a wide variety of AWS services.

In this article we’ll guide you through the easiest and quickest way to run a serverless function on a schedule we define.

With everything being serverless, we don’t need to provision servers so we can do this on-demand, making it super flexible and easy to test and use in production...

Read more here:

https://medium.com/success-with-aws/how-to-run-a-serverless-scheduled-function-using-aws-lambda-eventbridge-89c059cba845
Success With AWS — Who We Are
Tags: aws, success, cloudcomputing, publication
Published: 2024-04-02 16:23:33

Building a strong community of writers and readers who are passionate about AWS and cloud technologies.

**Goal**
The aim with this pub is simple: to become a one-stop shop for all articles explaining all AWS services, tutorials and best practices as well as building powerful, performant, scalable and reliable cloud solutions.

The principle goal of Success with AWS is to deliver technical value to the reader so that you can learn AWS and cloud technologies fast and with the best practices skills.

**Technology**
We are in a turning point in technological history.

On the macro level, we have seen amazing advances in AI, on the micro level we are seeing shifts towards modern architectures like serverless and microservices, which are gaining lots of traction — architectures which are streamlined by AWS and the services they offer.

This publication will focus a lot on these practices and designs. Ultimately these are the main topics/skills the publication will focus on to deliver value-centric articles:

- AWS services
- Cloud Technologies
- Serverless architecture/designs
- Micro-services architectures/designs
- Additional Points

Success With AWS also welcome articles about AWS re:invent talks, AWS conferences as well as any talks related to the 4 points mentioned above.

Ultimately, we hope to build a strong community of writers and readers who are passionate about AWS and cloud technologies so that we may look upon it as a welcoming space for modern knowledge sharing.

Thank you for being a dedicated reader and a part of our growing community.

Write For Us — Success With AWS
https://medium.com/success-with-aws/success-with-aws-who-we-are-6e40c1e3e3ee

— Uriel Bitton
TIL#1 - translate() & str.maketrans()
Tags: python, todayilearned
Published: 2024-04-02 16:21:53

## translate()

**translate()** is a string method used to obtain a new string where specified characters are replaced by others based on a mapping table or dictionary.

- For mapping, the dictionary can be user defined or a mapping table can be made using **str.maketrans()** method.

- While defining a dictionary to use for mapping, the keys and values should be ascii values of the characters to be replaced.
Eg: To replace "a" with "z" the dictionary should be {97:122}

- To remove a character, assign its value as **None **in the dictionary.

```
Syntax:
    -stringName-.translate(-dictionary-)
```

## str.maketrans()

**str.maketrans()** creates a mapping table that can be used in translate(). It takes 2 strings as arguments. string 1 contains the characters to be replaced and string 2 contains the characters that replace them.

- The position of characters in both strings should be in the order of replacement. 1st character of string 1 will be replaced by 1st character in string 2 and so on.

- The mapping table is composed of ascii numbers of individual characters as key-value pairs. It cannot map whole words for replacement.

- A 3rd string can be given as an optional argument. Characters in this string will be mapped to **None**, and will be removed from the returned string.

```
Syntax:
    str.maketrans(-string1-, -string2-, -stringOptional-)
```

That's about it. Any additions or corrections would be appreciated.
Happy Learning :-)
Release 1.7 Contributions : ChatCraft.org🤖
Tags: ai, react, opensource, ui
Published: 2024-04-02 16:21:39

For this week I worked on improving the flow to switching providers for LLMs for chatcraft.org. For the above we already had issue filed which I assigned to myself and started working on:
{% github https://github.com/tarasglek/chatcraft.org/issues/510 %}

## Pull Request 535

### Previous Flow:

1. ![1st prev](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pwp7ezuunvkcw1v3udkv.png)
2. ![2nd prev](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u1l8yz9o3qdwueq0a8w4.png)
3. going back to the ask menu to choose model to work on.

### New Flow:
The user can change the providers with a single click where selecting models and select the new model there itself based on the providers selected:

![new flow](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h9kf35ozgcts7pslv9kh.png)

### Code Changes:

To achieve the above I had to use **settings.providers** as in chatcraft, we store all the providers list and api keys in the browser's local storage. To use them we have another lib settings.ts created which helps us access the data from local storage. Apart from that, we're using **currentProvider** object in local storage to specify the selected provider which can be trigger using a function created :

```
setSettings(...settings,currentProvider: <provider>);
```
The above function is helping me retain all my previous settings, additionally changing the provider currently selected.

For better UI and differentiating between models and providers list, I used [MenuGroup](https://chakra-ui.com/docs/components/menu#menugroup) component which allowed me explicitly name the list headers to models and providers respectively. Thanks to Amnish for suggesting me this component.

After I was done with above research, I implemented the change and added MenuDivider second MenuList to support the implementation above.

### Pull Request
{% github https://github.com/tarasglek/chatcraft.org/pull/535 %}

### Feedback
On the above, I received some feedback from my professor David Humphrey regarding the indentation which I fixing by adding a span with some custom css attributes to maintain padding and an extra space for chevron icon which was also suggested by him.
Another major feedback for this PR was to refactor the code for lesser lines of code and more efficiency. Thanks to Katie for the feedback as the code change made the code look a lot cleaner too as in the screenshot below:

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

That's all for this week.

**Happy Coding**