Skip to content

prettyirrelevant/gistrunner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


gistrunner
gistrunner

Your go-to πŸ’‘ for running πŸƒβ€β™‚οΈ code snippets directly on GitHub Gist!

GitHub Workflow Status License Typescript version License

Features β€’ Usage β€’ Folder Structure β€’ API Documentation

🎯 Features

(Back to top)

Note: This is an early stage proof of concept (PoC). It may be buggy or limited. The goal is to demonstrate the possibilities and gauge interest.

πŸ‘¨β€πŸ’» Languages

  • C
  • C#
  • C++
  • Zig
  • Lua
  • Ruby
  • Rust
  • Julia
  • Python
  • Golang
  • Kotlin
  • Javascript
  • Typescript

πŸ”Œ Dependencies

  • Support for packages/dependencies ⏳

πŸ–₯️ Extension

  • Support gists that are not truncated
  • Add expiry to supported languages cache

🀹 Usage

(Back to top)

πŸ’» API

You can use the API directly to run arbitrary code snippets. See the API docs below for more details.

πŸ“¦ Chrome Extension

The browser extension is now live on the Chrome Web Store! πŸŽ‰

You can install it here: https://chrome.google.com/webstore/detail/mbgnplbkkklomfbfcbeeanmmnabmmlbk

To load the extension manually for development:

  1. Clone this repo
  2. Go to chrome://extensions in your browser
  3. Enable "Developer mode"
  4. Click "Load unpacked" and select the extension directory
  5. Enjoy! πŸš€

🌡 Folder Structure

(Back to top)

.
β”œβ”€β”€ api (Golang API)
β”œβ”€β”€ docker-daemon (Docker Engine API)
└── extension (Chrome Extension)

πŸ“œ API Documentation

(Back to top)

Run Code

Execute an arbitrary code snippet.

POST /api/run

Request

curl --location '/api/run' \
--header 'Content-Type: application/json' \
--data '{
    "content": "package main\nimport \"fmt\"\n\nfunc main() {\n\rfmt.Println(\"Hello, World!\")\n}"
    "language": "golang"
}'

Response (200)

{
    "code": 200,
    "data": {
        "ID": "gist_kQVHDPvYqBeYMMKdnRDaLm",
        "Hash": "91548d9381c30d715ae7e6ccb7aec0907599c2008497ab289c3b9d970fbf4589",
        "Result": "2024-01-07T09:09:51.636886900Z  Hello, World!\r\n",
        "Language": "golang",
        "CreatedAt": "2024-01-07T10:09:53.012498+01:00",
    },
    "message": "gist ran successfully"
}

Response (>400)

{
    "code": 500,
    "message": "Oops! Something went wrong on our end"
}

Get statistics

Retrieves total amount of code snippets executed.

GET /api/stats

Request

curl --location '/api/stats'

Response(200)

{
    "code": 200,
    "data": {
        "count": 1
    },
    "message": "Gists count returned successfully"
}

Get supported languages

Retrieves an array of languages that support code execution.

GET /api/languages

Request

curl --location '/api/languages'

Response(200)

{
    "code": 200,
    "data": {
        "golang": ".go",
        "javascript": ".js",
        "julia": ".jl",
        "kotlin": ".kt",
        "lua": ".lua",
        "python": ".py",
        "ruby": ".rb",
        "rust": ".rs",
        "typescript": ".ts"
    },
    "message": "Supported languages returned successfully"
}

About

Your go-to πŸ’‘ for running πŸƒβ€β™‚οΈ code snippets directly on GitHub Gist!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published