Skip to content

Instantly share code, notes, and snippets.

View richievos's full-sized avatar

Richie Vos richievos

View GitHub Profile
@richievos
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.
@richievos
richievos / 1_MyCounter.java
Created November 4, 2012 22:35
Simple hadoop example
import java.io.IOException;
import java.util.*;
import java.util.regex.Pattern;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.conf.*;
import org.apache.hadoop.io.*;
import org.apache.hadoop.util.*;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;

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

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.

Pros:

  • 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
@richievos
richievos / 0-problem.md
Last active May 22, 2020 04:38
absoluteValuesSumMinimization

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.

Example

#####################################
# Main implementation
#####################################
def compress(string)
return "" if string.empty?
result = ""
cur_char = nil
count = 0

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.

Prompt1

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