Skip to content

Instantly share code, notes, and snippets.

View seghier's full-sized avatar

seghier seghier

  • Algeria
View GitHub Profile
@monsieurpablo
monsieurpablo / openAI_ChatGPT3.py
Created January 18, 2023 17:45
Integrate open AI API using Iron Python (Can be used inside Grasshopper3D)
import urllib2
import json
# Set the endpoint URL and the prompt text
url = "https://api.openai.com/v1/completions"
# Set the API key and other parameters
data = json.dumps({ "model": "text-davinci-003", "prompt": prompt, "temperature": 0.5, "max_tokens": 1024})
headers = { "Content-Type": "application/json", "Authorization": "Bearer {0}".format(api_key) }
@uchida
uchida / enumerate.cs
Created November 28, 2011 13:55
C# sample code for equivalent of python enumerate()
// GWLlosa's answer in http://stackoverflow.com/questions/521687/c-sharp-foreach-with-index
using System;
using System.Collections.Generic;
using System.Linq;
namespace EnumerateTest {
class Program {
static void Main(string[] args) {
List<int> list = new List<int> {4, 2, 3, 1, 8};