Compare commits

...

5 Commits

Author SHA1 Message Date
Ghost user 53dbe5dd99
Merge 12d25e487a into d56ff0e90f 2024-05-23 02:25:54 -03:00
Fatih Kadir Akın d56ff0e90f
Update README.md 2024-03-26 22:13:41 +03:00
Fatih Kadir Akın 57a8dc4ccb
add sponsor 2024-03-26 22:11:51 +03:00
Fatih Kadir Akın 70b7283e4d
Add files via upload 2024-03-26 22:09:56 +03:00
Pedro Gomes 12d25e487a Visual Studio Code prompts to snippets converter 2023-01-14 19:08:50 +01:00
3 changed files with 42 additions and 0 deletions

BIN
.github/contentcodex.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -2,6 +2,10 @@
[![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)
[![ContentCodex](https://github.com/f/awesome-chatgpt-prompts/blob/main/.github/contentcodex.png?raw=true)](https://contentcodex.ai/?via=fka)
**[Be my sponsor and your logo will be here and prompts.chat!](https://github.com/sponsors/f/sponsorships?sponsor=f&tier_id=319423)**
---

View File

@ -0,0 +1,38 @@
import csv
import json
import sys
snippets = []
# Open the CSV file and read the data
with open("../prompts.csv", "r") as file:
reader = csv.reader(file)
for row in reader:
# Extract the snippet information from the row
name = row[0]
description = row[1]
# Create the snippet template
snippet = {name.lower():''}
snippet[name.lower()] = {
"scope": "markdown,python,txt",
"prefix": name.lower(),
"body": [description],
"description": name
}
# Add the snippet to the list
snippets.append(snippet)
# Write the snippets to the Visual Studio Code snippets file
# Where sys.argv[1] is the location of your snippets config file.
# Usually in .vscode folder
# Example: python3 csv_to_vs_snippets.py ./.vscode/chat_gpt_snippets.code-snippets
with open(sys.argv[1], "w") as file:
file.write('{')
for snippet in snippets:
snippet_key = list(snippet.keys())[0]
if snippet_key == 'act':
continue # Skips CSV fields.
file.write(f'"{snippet_key}":')
file.write(json.dumps(snippet[snippet_key], indent=4))
file.write(',')
file.write('}')