teleren/devto huggingface dataset:
Setup GPG on macOS
Published: 2023-03-12 14:07:08

## Install

```
brew install gpg
```

## Create new key

```
# generate key
gpg --full-generate-key

# get the public key using key ID
gpg --armor --export XXXXXX

# set the key ID in git
git config --global user.signingkey XXXXXXX

# always sign commits
git config commit.gpgsign true
```

## Setup keychain

gpg collects password from cli. This causes issues if using vscode to create a commit. So input can be taken from a popup or keychain.

```
brew install pinentry-mac
```

The brew installation will print these caveats:

```
==> Caveats
You can now set this as your pinentry program like

~/.gnupg/gpg-agent.conf
    pinentry-program /opt/homebrew/bin/pinentry-mac
```

So just create a `~/.gnupg/gpg-agent.conf` file if it doesn't exist and put the line `pinentry-program /opt/homebrew/bin/pinentry-mac` in it.

Now, to check if it works.


1.`gpg --list-keys` to print the existing keys.
2. `pkill -TERM gpg-agent`.
3. Restart the terminal.
4. `echo test | gpg -e -r <PUT THE KEY ID HERE> | gpg -d`

This should open a pin entry popup and make sure "save in keychain" option is selected.

## More links

Documentation on GitHub for setup: https://docs.github.com/en/authentication/managing-commit-signature-verification
fetch info from db with ajax
Published: 2023-03-12 14:05:18

1.html file
<!DOCTYPE html>
<html>
<style>
th,td {
  padding: 5px;
}
</style>
<body>

<h2>The XMLHttpRequest Object</h2>

<form action=""> 
  <select name="customers" onchange="showCustomer(this.value)">
    <option value="">Select a customer:</option>
    <option value="ALFKI">Alfreds Futterkiste</option>
    <option value="NORTS ">North/South</option>
    <option value="WOLZA">Wolski Zajazd</option>
  </select>
</form>
<br>
<div id="txtHint">Customer info will be listed here...</div>

<script>
function showCustomer(str) {
  if (str == "") {
    document.getElementById("txtHint").innerHTML = "";
    return;
  }
  const xhttp = new XMLHttpRequest();
  xhttp.onload = function() {
    document.getElementById("txtHint").innerHTML = this.responseText;
  }
  xhttp.open("GET", "getcustomer.php?q="+str);
  xhttp.send();
}
</script>
</body>
</html>

2.php file
<?php
$mysqli = new mysqli("localhost", "root", "", "customer");
if($mysqli->connect_error) {
  exit('Could not connect');
}

$sql = "SELECT cid, cname, name, adr, city, pcode, country
FROM customers WHERE cid = ?";

$stmt = $mysqli->prepare($sql);
$stmt->bind_param("s", $_GET['q']);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($cid, $cname, $name, $adr, $city, $pcode, $country);
$stmt->fetch();
$stmt->close();

echo "<table>";
echo "<tr>";
echo "<th>CustomerID</th>";
echo "<td>" . $cid . "</td>";
echo "<th>CompanyName</th>";
echo "<td>" . $cname . "</td>";
echo "<th>ContactName</th>";
echo "<td>" . $name . "</td>";
echo "<th>Address</th>";
echo "<td>" . $adr . "</td>";
echo "<th>City</th>";
echo "<td>" . $city . "</td>";
echo "<th>PostalCode</th>";
echo "<td>" . $pcode . "</td>";
echo "<th>Country</th>";
echo "<td>" . $country . "</td>";
echo "</tr>";
echo "</table>";
?>
[Typescript] Study TS with me (2) - Generics
Published: 2023-03-12 13:57:48

> Generics allow creating 'type variables' which can be used to create classes, functions & type aliases that **don't need to explicitly define the types that they use**.

> Generics makes it easier to write reusable code.



제네릭은 **Java**나 **C++** 같은 정적 타입 언어에선 이미 널리 쓰이고 있는 기능이라고 한다. **다양한 타입에서 작동**한다는 장점이 있기 때문에 component를 만들때 유용하게 쓰일 수 있다.

**1. Function**

```typescript
function identity<T>(arg: T): T {
  return arg;
}

// 함수를 호출하는 순간 Type이 결정됨.
const output1 = identity(3); // number
const output2 = identity('myName'); // string
```

**2. Class**
```typescript
class SimpleImage<T, S> implements Image<T, S>{
  constructor(
    private _title: T,
    private _size: S,
  ){}

  title(): T {
    return this._title;
  }
  size(): S {
    return this._size;
  }
}

const simpleImage = new SimpleImage({ main: 'sample image'}, 300);
```

**3.1 Generic Constraints**

```typescript
interface Lengthwise {
  length: number;
}

function logginIdentity<T extends Lengthwise>(arg: T): T {
  console.log(arg.length);

  return arg;
}

// 제네릭 함수의 타입이 제한되어 있기 때문에, 모든 타입에 대해선 동작하지 않음.
logginIdentity(3); // Error

// length property가 있는 type을 전달해야 함.
logginIdentity({ length: 10, value: 3 });

```

**3.2 Using Type Parameters in Generic Constraints**

```typescript
// obj에 존재하는 property만 가져오도록
function getProperty<T, K extends keyof T>(obj: T, key: K) {
  return obj[key];
}

const x = {
  a: 1, 
  b: 2, 
  c: 3,
  d: 4
}

getProperty(x, 'a');
getProperty(x, 'f'); // Error: f는 x에 존재하지 않는 property
```

--

scss에서 많이 쓰이는 디자인 패턴인 **mixins**을 만드는데도 **Generic**이 쓰였다고 하니, 나중에 기회가 되면 또 포스팅 해봐야 겠다. ([참고 링크](https://www.typescriptlang.org/docs/handbook/mixins.html))

[출처]
- https://www.typescriptlang.org/ko/docs/handbook/2/generics.html
-https://www.w3schools.com/typescript/typescript_basic_generics.php
get hint
Published: 2023-03-12 13:54:52

1. html file
<!DOCTYPE html>
<html>
<body>

<h2>The XMLHttpRequest Object</h2>
<h3>Start typing a name in the input field below:</h3>

<p>Suggestions: <span id="txtHint"></span></p> 
<p>First name: <input type="text" id="txt1" onkeyup="showHint(this.value)"></p>

<script>
function showHint(str) {
  if (str.length == 0) { 
    document.getElementById("txtHint").innerHTML = "";
    return;
  }
  const xhttp = new XMLHttpRequest();
  xhttp.onload = function() {
    document.getElementById("txtHint").innerHTML =
    this.responseText;
  }
  xhttp.open("GET", "gethint.php?q="+str);
  xhttp.send();   
}
</script>

</body>
</html>

2.php file
<?php   
$arr[]='Munira';
$arr[]='Mansi';
$arr[]='kesha';
$arr[]='Mu';
$arr[]='tunira';
$arr[]='yunira';
$arr[]='uunira';
$arr[]='nira';
$arr[]='ira';
$arr[]='ra';
$arr[]='a';
$q=$_REQUEST["q"];
$hint="";
if($q!==""){
    $q=strtolower($q);
    $len=strlen($q);
    foreach($arr as $name){
        if(stristr($q,substr($name,0,$len))){
            if($hint===""){
                $hint=$name;
            }else{
                $hint.=",$name";
            }
        }
    }
}
echo $hint===""?"No suggestion":$hint;
?>
Implementing MicroScheme in Elm
Tags: scheme, elm, intepreter
Published: 2023-03-12 13:53:36

---
title: Implementing MicroScheme in Elm
published: true
description: An implementation of an interpreter for a small subset of Scheme in Elm
tags: Scheme, Elm, intepreter
//cover_image: https://direct_url_to_image.jpg
---

I'd like to report on a little weekend project, namely to implement an interpreter for a small subset of Scheme using [Elm](https://elm-lang.org).  Here is a screenshot of the command-line interface:

![Scheme Interpreter](https://imagedelivery.net/9U-0Y4sEzXlO6BXzTnQnYQ/7bb38caa-c314-48f0-6626-a90140b12c00/public
)

The code (open source, of course!) is on [Github](https://github.com/jxxcarlson/elm-microscheme) with some
[documentation there also](https://jxxcarlson.github.io/elm-microscheme/about/). The code base, as outlined below, is quite small. I intend to keep it that way, since the goal is educational (I am learning a lot).  I'll concentrate on a few core features, e.g., a proper implementation of environments and let-bindings.



```text
--------------------------------------------------------
File                                               code
--------------------------------------------------------
src/MicroScheme/Eval.elm                            92
src/MicroScheme/Frame.elm                           64
src/MicroScheme/Parser.elm                          56
src/MicroScheme/Interpreter.elm                     43
src/Main.elm                                        41
src/MicroScheme/Environment.elm                     19
src/repl.js                                         19
src/MicroScheme/Expr.elm                            13
src/MicroScheme/Init.elm                            10
-------------------------------------------------------
SUM:                                               357
-------------------------------------------------------
```

There is more detail in the docs linked above, but perhaps just a few words more.  The current state of the data type for Scheme expressions is

```elm
type Expr
    = Z Int
    | F Float
    | Str String
    | Sym String
    | L (List Expr)
    | SF SpecialForm


type SpecialForm
    = Define
    | Lambda
    | Display
    | If
```
I haven't done anything yet with `Display` and `If`.

The module `Main` is used to mediate via [ports](https://guide.elm-lang.org/interop/ports.html) between the interpreter and the Javascript code that runs the command-line interface you saw above in the screenshot. This set-up is very small: just 43 lines of code for `Main` and 19 for `repl.js`.

## Plans

When the project has matured sufficiently, I will publish a more fully-featured version of the code as an Elm library. I'm also planning to integrate the interpreter into [Scripta.io](https://scripta.io), a web publishing platform for technical docs.  Scripta offers three markup languages: MicroLaTeX, XMarkdown, and L0.  The first two are cousins of their official counterparts, while L0 is an experimental effort with syntax inspired by Lisp.
Simple XMLHttpRequest and retrieve data from atxt file.
Published: 2023-03-12 13:47:20

1. html file
<!DOCTYPE html>
<html>
<body>

<div id="demo">
<h2>The XMLHttpRequest Object</h2>
<button type="button" onclick="loadDoc()">Change Content</button>
</div>

<script>
function loadDoc() {
  const xhttp = new XMLHttpRequest();
  xhttp.onload = function() {
    document.getElementById("demo").innerHTML =
    this.responseText;
  }
  xhttp.open("GET", "ajax_info.txt");
  xhttp.send();
}
</script>

</body>
</html>
Transform Your Graphics Game with Pictory.ai
Tags: graphic, gamedev, ai, webdev
Published: 2023-03-12 13:41:39

Are you tired of spending hours designing graphics that still don't look quite right? Say goodbye to those frustrations and hello to Pictory.ai – the ultimate graphic design tool that will transform your graphics game.

With Pictory.ai, you can create stunning, professional-grade designs in just a few clicks. Whether you're looking to design a logo, social media post, or even a presentation slide, Pictory.ai has got you covered.

The best part is, Pictory.ai offers a free trial that lets you design graphics for free. You can test out the platform and all its features, without any commitment or payment required. And if you love it (which we're sure you will), you can upgrade to a paid plan for even more design possibilities.

One of the best things about Pictory.ai is its ease of use. Even if you have no design experience, you can still create amazing graphics with Pictory.ai. The platform has a user-friendly interface that makes designing graphics quick and simple. Plus, it comes with a variety of templates and design elements, so you can easily create graphics that match your brand or style.

Pictory.ai also offers a variety of customization options, so you can make your designs truly unique. Whether you want to adjust the color scheme, add text, or even upload your own images, Pictory.ai makes it easy to create graphics that stand out.

But that's not all – Pictory.ai also offers a collaborative design feature, which allows you to work with others on the same design in real-time. This is especially useful for teams or businesses that need to collaborate on graphic design projects.

In addition to its powerful design features, Pictory.ai also offers affordable pricing plans. You can choose a plan that fits your needs and budget, whether you're a solo entrepreneur or a large enterprise.

Don't waste any more time struggling with graphic design – [sign up for Pictory.ai](https://pictory.ai?ref=vwqk9)'s free trial today and take your graphics game to the next level!
What's the matcher?
Tags: nextjs, javascript, webdev
Published: 2023-03-12 13:39:40

Hi there,

I'm new in Next.js 13. I have a question for you. I will make a multi language web site and for this I use middleware.js.
My folder structure; app/[lang]/file-name.jsx etc.

But I don't understand what's meaning the matcher feature. What does it do? What happens if I don't use it?

`export const config = {
    matcher: ["/((?!_next).*)", "/:lang*"],
};`

I already have access to the incoming parameter because of the [lang] structure. Why do we use it for matcher. What is the logic to use here? Can you explain with an example?
Everyone is talking about how to create prompts for ChatGPT
Tags: chatgpt, ai
Published: 2023-03-12 13:33:31

Yup everyone is talking about the best prompts ever for ChatGPT. And I agree it's one of the most important things for this tool to work as you want.

I was looking at how I should create the prompts for ChatGPT. Sometimes you need it to be more inventive and sometimes you need it to be more strict. 

The first thing to know for us as **developers**: ChatGPT (**gpt-3.5-turbo**) is different from **text-davinci-003** (that one that you can access on the playground from OpenAi)

I also used this tweet as a reference which helped a lot.
{% embed https://twitter.com/kliu128/status/1623472922374574080 %} 

With that being said here comes my two cents on how to create assertive prompts for both. The only thing I should say is that text-davinci is a bit stubborn and you need to be more assertive about it.

- Always create a persona
- Tell the persona which languages you want it to understand
- Make the persona differentiate what is the user input and what is the persona output.

And how would that be inputed on the playground?

```
Create a persona called Lily;
Lily recognizes tasks and generates tasks from texts that are given to her;
Lily uses the text as base and it should get actionable items from it;
Lily does not repeat tasks;
Lily does not disclose her identity;
Lily's answers should be objective;

User: [put the user text here]

From the user text which tasks Lily think it should be created? Separated by a line break
Lily:
```

Two things you need to understand using "User" and "Lily" you make sure to separate what is the input from each. And as I said text-davinci is pretty stubborn and sometimes it wants to deviate from the prompt you created so you must force it to answer the way you want.

And if you want to use that on ChatGPT you just need to separate between "System", "Assistant" and "User".

- System is where you add information about how the assistant should answer
- User is the user input
- Assistant is the output from the prompt you just created.
Dual booting Ubuntu and Windows
Tags: ubuntu, tutorial, dualboot, windows
Published: 2023-03-12 13:30:13

## **Introduction**
Hello to you too!!!
Myself Ganesh and I will be helping you with dual-booting Windows alongside Ubuntu in this post.

## **STEP - 1**
Before you actually install Ubuntu there are some necessary precautions or pre-requisites you need to take care of.

1. Turn off the bit-locker encryption on you disk.
2. Disable secure boot in your bios on your system.
3. Disable fast-boot in your bios on your system.

## **STEP - 2**
It is highly recommended to backup your existing data so that if any error occurs during this process, you may not lose your data. Download the [Ubuntu 22.04](https://ubuntu.com/download/desktop) and save it in a memorable location on your computer. 

## **STEP - 3**
The next step is create a bootable USB stick. You can use softwares such as [rufus](https://rufus.ie/en/)to do this. Remember this is not the same as copying the content in to the USB drive. If you don't understand how to do it then refer my [link](https://youtu.be/VVsdCtu8EHg)

## **STEP - 4**
Type "disk management" in the Windows menu and select "Create and format hard disk partitions" from the search results.This will open the Disk Management tool, which displays all the drives connected to your computer. In the Disk Management tool right click on the drive you want to partition and select shrink volume. Chose amount of space you want to set aside for your Ubuntu and click shrink. Now this will create a partition named free space in your hard drive.

## **STEP - 5**
In the Windows menu, search for advanced start-up options and click on restart now. Make sure to insert the bootable USB disk before restarting the PC or Laptop. Choose Use a device and select your USB.

## **STEP - 6**
There will be a prompt asking to install or try Ubuntu. Select Install and select the language also. Choose Keyboard Layout, mostly in India we use English(US) Keyboard layout. Choose
1. normal installation
2. download updates while installing Ubuntu
3. and select continue 

## **STEP - 7**
Select something else for your installation type. Choose the partition you already made which is named as free space. Right click on it and click add. A pop come, in which choose use as Ext4 journaling file system and mount point as /.
Click OK and after that click install now.

## **STEP - 8**
Choose your time zone, as in india choose kolkata and press continue. Next, you’ll be asked to enter a username, hostname (computer’s name) and a password. Press Continue. Installation may normally take about 10 minutes if you have good internet connection.

## **CONCLUSION**
After installation, reboot the system. You will be asked to remove the bootable USB disk at this stage and you can remove it without worrying. The system rebbots only after this. If you completed the above steps correctly then, there will be no issue and you will the grub menu to select the Ubuntu boot and Windows boot to respectively boot into Ubuntu and Windows. Hope you found my post useful.
Thank You!!!
:blush:
My opinion about gender equality.
Tags: wecoded, discuss, career, webdev
Published: 2023-03-12 13:22:17


I am currently a student studying at a university. I meet people of different genders in my daily life. Share ideas with them. And because of the various things I see in the university bring me great happiness. They treat all people equally as children of the same mother. There are people of different sexuality in our university. The people I am with are the ones who draw me the best from them. Since I am doing an IT-related degree, most people with me are tech-savvy. I have seen people who get along very well with men without gender discrimination. Most of them have better logical thinking and coding skills than men. If I single out women here, there are women I know who do all the work in their homes, balance their education, and work very skillfully. It is a very rare ability that I see in women. And there are many examples we can take from them. In some societies, gender equality is not given a place. They are not respected. But now the young generation is becoming a very open-minded group. They are very friendly with others. All are given equal rights, and their views are respected

  Now let's talk about the advantages that the tech industry gets due to gender equality.

-      Increased creativity and ingenuity.
-      Enhanced effectiveness and productivity
-      Improved judgment
-      Improved company recognition and image
-      More market opportunities

Now we see that we get many such advantages. I am saying that all people should be treated equally. That everyone should appear for that. If we change, we can easily change the world.

**Okay, that’s it for this article.**
Also, if you have any questions about this or anything else, please feel free to let me know in a comment below or on [Instagram](https://www.instagram.com/_abhixsh/) , [Facebook](https://www.facebook.com/abhi.haththakage/) or [Twitter](https://twitter.com/abhixsh).

Thank you for reading this article, and see you soon in the next one! ❤️
Flexify V-0.1.1 has been released.
Tags: a11y
Published: 2023-03-12 13:15:22

---
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/itqwmlc5o5ejvjp3ijmq.png
---

Hello there. Today, I have released a new version of the extension in which I have added the following features:

- The ability to change the greyscale, perform hue rotation, and invert colors.
- The ability to change the title color.
- The ability to show/hide images.


![Demo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/acf0hln55tzy0y83lpxm.gif)

## Resources

{% embed https://github.com/wiseaidev/flexify %}


{% embed https://github.com/wiseaidev/flexify-landing-page %}

Until next time!
Vultr 主机商提供免费VPS云主机!
Tags: vps, blog, vultr
Published: 2023-03-12 13:03:36

我是 <a href="https://anothervps.com/out/vultr">Vultr</a> 云主机运营商好几年的老用户了。

[caption id="attachment_227" align="alignnone" width="870"]<a href="https://anothervps.com/wp-content/uploads/2023/03/vultr-cloud-computing-new-free-plan.jpg"><img src="https://anothervps.com/wp-content/uploads/2023/03/vultr-cloud-computing-new-free-plan.jpg" alt="使用新的 Vultr 云计算免费计划开始构建" width="870" height="237" class="size-full wp-image-227" /></a> 使用新的 Vultr 云计算免费计划开始构建[/caption]

著名的 <a href="https://justyy.com/out/vultr">Vultr</a> 云主机提供商推出了免费VPS云主机 Free Tier. 但是得申请，按照内部评定的分数来决定你是否能获得这个免费云主机。当前<a href="https://justyy.com/out/vultr">Vultr</a>用户更容易通过申请。申请通过后可以在  (Cloud Compute - Regular - Free Instance) 里创建一个免费的实例。每个月只能同时有一个免费的实例. 你可以销毁免费的这个云主机实例然后之后在另的好区选择不同的<a href="https://justyy.com/archives/2076" title="Windows 手机下的 DOS 操作系统">操作系统</a>再创建新的实例。不过，一个月最多能干两次这种事情。

免费送的VPS云主机配置不高：512MB RAM, 1 CPU 主频 2600MHz, 还有 10GB <a href="https://justyy.com/archives/44650" title="系统盘用上了2TB的SSD固态硬盘的确速度飞快">固态硬盘</a> SSD 和每月 2TB 的流量。

[caption id="attachment_223" align="alignnone" width="772"]<a href="https://anothervps.com/wp-content/uploads/2023/03/vultr-free-server.jpg"><img src="https://anothervps.com/wp-content/uploads/2023/03/vultr-free-server.jpg" alt="Free Vultr Instance Server Specification" width="772" height="1170" class="size-full wp-image-223" /></a> Free Vultr Instance Server Specification[/caption]

目前，<a href="https://justyy.com/archives/5647" title="免费才是最贵的 – 说说软件保护和花钱买软件">免费</a>套餐仅持续一年。 将来可能会延长。

[caption id="attachment_224" align="alignnone" width="1311"]<a href="https://anothervps.com/wp-content/uploads/2023/03/vultr-free-tier.jpg"><img src="https://anothervps.com/wp-content/uploads/2023/03/vultr-free-tier.jpg" alt="Vultr Free Tier Program Approved!" width="1311" height="393" class="size-full wp-image-224" /></a> Vultr Free Tier Program Approved![/caption]

并非所有地区都能选择这个免费Tier. 由于服务器配置真的很低，有些操作系统并不支持，比如 <a href="https://justyy.com/archives/3647" title="英国QuickHostUK主机大升级 Ubuntu 16.04 + PHP7 方法和经验">Ubuntu</a>。 可用的操作系统有：FreeBSD、OpenBSD、Rocky Linux、CentOS、Debian 等。

[caption id="attachment_225" align="alignnone" width="1311"]<a href="https://anothervps.com/wp-content/uploads/2023/03/vultr-free-tier-vps.jpg"><img src="https://anothervps.com/wp-content/uploads/2023/03/vultr-free-tier-vps.jpg" alt="What you can get by Deploying a Free Instance?" width="1311" height="583" class="size-full wp-image-225" /></a> What you can get by Deploying a Free Instance?[/caption]

每个人都可以申请 <a href="https://justyy.com/out/vultr">Vultr</a>的免费帐号，如果没有<a href="https://justyy.com/out/vultr">Vultr</a>的通过这个链接<a href="https://justyy.com/out/vultr">Vultr</a>申请 将同时得到<strong>100美元</strong>的试用金。

不过，这配置确实有点低，不知道有没有什么好的玩法，利用起来，好好薅一下<a href="https://justyy.com/out/vultr">Vultr</a>的羊毛。

英文: <a href="https://anothervps.com/vultr-offers-free-tier-vps/" rel="noopener" target="_blank">Vultr Offers Free Tier VPS!</a>

博客: [Vultr 主机商提供免费VPS云主机!](https://justyy.com/archives/61372)