Skip to content

Instantly share code, notes, and snippets.

View richievos's full-sized avatar

Richie Vos richievos

View GitHub Profile

This is recording some 🤯ing interactions I had with ChatGPT. The context is I have been doing some Arduino/ESP32 embedded system development as a hobby. I wrote some code using the built-in Arduino WebServer.h library. I found some code online that I wanted to reuse, but it turned out it was using a different web framework (ESPAsyncWebServer).

Initially I expected to have to learn a bunch about this, but instead I decided to talk this over with ChatGPT-4 and see what it could do. I'm documenting what happened because I'm blown away by this. I would for sure hire this AI as at least a junior programmer.


Note in this one how not only did it convert from one library to another, it did it in a way that's showing some level of understanding of the semantics. It's not just doing a search and replace of methods, it's making changes so that it does the same high level goal in a different implementation.

  • the response discussing that server.handleClients() is no longer needed and therefore it also dele
# Main implementation
def compress(string)
return "" if string.empty?
result = ""
cur_char = nil
count = 0
richievos /
Last active May 22, 2020 04:38

Given a sorted array of integers a, your task is to determine which element of a is closest to all other values of a. In other words, find the element x in a, which minimizes the following sum:

abs(a[0] - x) + abs(a[1] - x) + ... + abs(a[a.length - 1] - x)

(where abs denotes the absolute value)

If there are several possible answers, output the smallest one.


Currently the most useful Android bike computer app for training (especially interval training). The runner up is Wahoo Fitness, but Wahoo lacks the right views for power based training, and flakes out a lot. However, this app could use a bit of a user experience / design overhaul. The feature set is great, the way it's presented is a bit painful.


  • integrates well with all the bluetooth sensors I have (heart rate, speed/cadence, power meter)
  • uploads to a wide assortment of sites out there (including strava and training peaks)
  • very customizable, I was able to make almost exactly the layout I want
  • so far seems reliable (just did a small ride however)
  • I'll have to get used to the Start Sensors vs start trip flow, but I think I might like that
  • ability to merge rides in the UI is an awesome feature
  • great that it can trigger calibration on power meters

The use case is a command line tool that needs some configuration. The simplest case is just reading in a yml file for it, but commonly people have more complicated ways of doing this configuration (a hierarchy of configs that get merged, or some environment sourced things, or an erb yml file, or ...) so I also want to be able to let people set a pre-processed config.

The original command line was going to be:

  background_job_kicker_offer -c path_to_config_file -r any_file_you_want_required -r some_other_file start

Most of these solutions will leverage the -r option to allow for complex ruby to run.

Option 1: make people set config in one of their initializers

richievos /
Created November 4, 2012 22:35
Simple hadoop example
import java.util.*;
import java.util.regex.Pattern;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.conf.*;
import org.apache.hadoop.util.*;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
richievos / gripes.txt
Created July 3, 2012 18:56
Github Enterprise gripes
Github Enterprise gripes:
==Pull requests==
* Can't stage/batch up comments
Sometimes a comment is just a note to myself, and/or when I'm going through a diff I later find something that makes my comment irrelevant. I want to be able to stage a bunch of comments, and publish them all at once.
* too chatty (solved by batching comments)
Every single comment sends an email. This is really annoying when you're making multiple comments on a single pull request.
* no multi-line (block) comments
Usually I want to comment on a series of lines in a commit, not a single one.
* Can't hide comments on the diff page after they've been added.
Once someone puts a bunch of comments on the diff page, it's basically unusable, because you can't see the diff anymore.
commit 7e091a06e41070c005b2bbfa6f4b15c91dbfa3d5
Author: Richie Vos <>
Date: Mon Jun 11 18:16:25 2012 -0500
Deleting the new order object
diff --git a/app/controllers/admin/transactional_email_controller.rb b/app/controllers/admin/transactional_email_controller.rb
index fae3b0f..8142498 100644
# Proposed benefits:
# * more verbose, but you can see more clearly all the "stuff" your method is using
# * easier to re-use methods, since they're not coupled to instance var names
# * less room for concurrency issues, since all state transforms would be in the top methods
class User
def gender
# when we can, we do something like this:
in_parallel do |hydra|
hydra.push client.get_x(:user_id => 1, :id => 2) do |response|
@x = response.processed_response if response.success?
hydra.push client.get_y(:user_id => 1, :id => 3) do |response|
@y = response.processed_response if response.success?
end # at the end of the block it fires the requests in parallel and ... blocks