| Key | Result |
|---|---|
v |
select |
y |
copy (yank) |
c |
change |
d |
delete |
This guide will walk you through adding a ChatGPT-like messaging stream to your Ruby on Rails 7 app using ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind. All code included below!
Want more content like this, for free? Check out my free book, RailsAI!
- Follow me on Twitter for more Ruby AI at https://twitter.com/alexrudall
- Released under the MIT License - use as you wish :)
| require "json" | |
| struct = { "a" => 1, "b" => 2, "c" => [1, 2, 3], "d" => [{ "e" => 3 }, nil, false, true, [], {}] } | |
| source = JSON.dump(struct) | |
| tokens = [] | |
| index = 0 | |
| until source.empty? | |
| tokens << |
| import json | |
| from pyspark.sql.types import * | |
| # Define the schema | |
| schema = StructType( | |
| [StructField("name", StringType(), True), StructField("age", IntegerType(), True)] | |
| ) | |
| # Write the schema | |
| with open("schema.json", "w") as f: |
| /* | |
| * Enhance Avro to support data validation via Regular Expression | |
| */ | |
| const avro = require('avsc') | |
| class ValidatedString extends avro.types.LogicalType { | |
| constructor (attrs, opts) { | |
| super(attrs, opts) | |
| this._pattern = new RegExp(attrs.pattern) | |
| } |
Sometimes you have a process you lost the PID, and would like to kill it.
You can use top (or better htop) to search for your process name and press k to kill it.
But this isn’t optimal when you aren’t sure of its name.
A better alternative is to search by the port opened, for example port 80:
sudo lsof -i :80| Copyright (c) 2016 Jens Bissinger | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is | |
| furnished to do so, subject to the following conditions: | |
| The above copyright notice and this permission notice shall be included in all |
Last Updated: March 2023
IMPORTANT: Ignore the out-of-date steps below for getting Chromium keys.
Instead, read this up-to-date guide (Jan 2023) written by @LearningToPi.
P.S. Thank you to every contributor below who provided tips over the years on what should be a straightforward process: setting up Chromium for local development.
Long live the web!
| import time | |
| import random | |
| class Node: | |
| def __init__(self, value, left, right): | |
| self.value = value | |
| self.left = left | |
| self.right = right |
