To compile:
as -o hello.o hello.s
ld -o hello hello.o -lSystem -syslibroot `xcrun -sdk macosx --show-sdk-path` -e _main -arch arm64
./hello
To compile:
as -o hello.o hello.s
ld -o hello hello.o -lSystem -syslibroot `xcrun -sdk macosx --show-sdk-path` -e _main -arch arm64
./hello
| Seems to work, but I'm not an expert with this stuff, so YMMV. |
| require 'http' | |
| require 'json' | |
| class GroqClient | |
| def initialize(api_key: nil, api_url: "https://api.groq.com/openai/v1/chat/completions", model: "mixtral-8x7b-32768") | |
| @api_key = api_key || ENV['GROQ_API_KEY'] | |
| @api_url = api_url | |
| @model = model | |
| end |
| <!DOCTYPE html> | |
| <!-- A totally pointless and overkill use of import maps | |
| and Moment.js, in order to simply use the technology and | |
| see it in action.. --> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Buildless example</title> | |
| <link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet"> |
| # Example of using SQLite VSS with OpenAI's text embedding API | |
| # from Ruby. | |
| # Note: Install/bundle the sqlite3, sqlite_vss, and ruby-openai gems first | |
| # OPENAI_API_KEY must also be set in the environment | |
| # Other embeddings can be used, but this is the easiest for a quick demo | |
| # More on the topic at | |
| # https://observablehq.com/@asg017/introducing-sqlite-vss | |
| # https://observablehq.com/@asg017/making-sqlite-extension-gem-installable |
| class Perceptron | |
| def initialize(inputs, bias = 0.0) | |
| @weights = Array.new(inputs.keys.first.size) { rand } | |
| @inputs = inputs | |
| @bias = bias | |
| end | |
| def run(inputs) | |
| z = inputs.zip(@weights).map { |i, w| i * w }.reduce(:+) + @bias | |
| 1.0 / (1.0 + Math.exp(-z)) |
| require 'json' | |
| require 'rest-client' | |
| require 'base64' | |
| url = "http://localhost:7860" | |
| payload = { | |
| "prompt": "liminal space, unusual lighting, sinister presence", | |
| "negative_prompt": "", | |
| "steps": 30, | |
| "sampler_name": "Euler a", |
| # Read stdin, extract email addresses | |
| # Look up MX records for those addresses | |
| # Return each email address and their first MX record | |
| # (or IP address, as a fallback) | |
| hosts = {} | |
| STDIN.each_line do |l| | |
| # Extract the email and the email domain from each line | |
| email = l[/^([^\s]+\@[^\s+\,]+)\b/, 1] |
| import requests | |
| import time | |
| # Initialize variables | |
| api_url = "https://meta.wikimedia.org/w/api.php" | |
| params = { | |
| "action": "query", | |
| "format": "json", | |
| "list": "globalblocks", | |
| "bglimit": "500" |