command | description |
---|---|
ctrl + a | Goto BEGINNING of command line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$dotnet --version | |
9.0.100 | |
$dotnet new list | |
These templates matched your input: | |
Template Name Short Name Language Tags | |
-------------------------------------------- -------------------------- ---------- -------------------------------- | |
API Controller apicontroller [C#] Web/ASP.NET | |
ASP.NET Core Empty web [C#],F# Web/Empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$export GEMINI_API_KEY=your-key | |
$python demo.py | |
ChatCompletionMessage( | |
content='I can definitely help you find a restaurant in Thailand! To give you the best recommendations, | |
I need a little more information. Tell me:\n\n* **Where in Thailand are you looking?** | |
(e.g., Bangkok, Chiang Mai, Phuket, etc.) \n* **What kind of cuisine are you interested in?** | |
(e.g., Thai, Italian, Japanese, street food, etc.)\n* **What is your budget?** | |
(e.g., budget-friendly, mid-range, high-end)\n* **What kind of atmosphere are you looking for?** | |
(e.g., romantic, lively, casual, etc.)\n\nOnce I have this information, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$npx genaiscript run genaisrc/demo01.genai.mjs | |
genaiscript: genaisrc/demo01.genai.mjs | |
trace: /.genaiscript/runs/demo01/2024-11-04T08-11-49-564Z.trace.md | |
prompting openai:gpt-4o (~543 tokens) | |
```json schema=CITY_SCHEMA | |
[ | |
{ | |
"name": "Bangkok", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const a = await ai.languageModel.capabilities() | |
console.log(a.available); | |
// ถ้าขึ้นคำว่า readily แสดงว่าเราสามารถใช้งานได้เลย | |
// แต่ถ้าไม่ ให้ทำการสร้างดังนี้ | |
await ai.languageModel.create(); | |
ทำการตรวจสอบใน browser = chrome://components | |
* Optimization Guide On Device Model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For OTLP - OTLP Prometheus endpoint, OTLP requires pushing | |
management.otlp.metrics.export.url=http://localhost:9090/api/v1/otlp/v1/metrics | |
# only for demo purposes | |
management.otlp.metrics.export.step=2s | |
# All traces should be sent to latency analysis tool | |
management.tracing.sampling.probability=1.0 | |
# OTLP endpoint - OTLP Tempo endpoint | |
management.zipkin.tracing.endpoint=http://localhost:4318/v1/traces | |
management.zipkin.tracing.encoding=PROTO3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$node --test --experimental-test-coverage | |
▶ getUserById | |
✔ should fetch user data successfully (4.168291ms) | |
✔ getUserById (4.678666ms) | |
ℹ tests 1 | |
ℹ suites 1 | |
ℹ pass 1 | |
ℹ fail 0 | |
ℹ cancelled 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { DatabaseSync } from "node:sqlite"; | |
const db = new DatabaseSync(":memory:"); | |
db.exec(` | |
CREATE TABLE data( | |
key TEXT PRIMARY KEY, | |
value TEXT | |
) STRICT | |
`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$pytest --cov=main --cov-report=html | |
================================= test session starts ================================== | |
platform darwin -- Python 3.12.5, pytest-8.3.3, pluggy-1.5.0 | |
rootdir: python-test | |
plugins: time-machine-2.14.2, cov-5.0.0, anyio-4.4.0, Faker-25.2.0 | |
collected 2 items | |
test_main.py .. [100%] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastapi import FastAPI | |
app = FastAPI() | |
@app.get("/", tags=["Main"]) | |
async def root(): | |
return {"message": "Hello World"} | |
@app.get("/products/{product_id}", tags=["Product"]) | |
async def get_product(product_id: int): |
NewerOlder