Skip to content

Instantly share code, notes, and snippets.

this is just a tenth comment

this is just a ninth comment

this is just a eighth comment

this is just a seventh comment

this is just a sixth comment

@albertywu
albertywu / gpt2.java
Created May 9, 2023 22:33
corrected java code from gpt4
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import reactor.core.publisher.Flux;
import reactor.test.StepVerifier;
import software.amazon.awssdk.services.location.LocationAsyncClient;
import software.amazon.awssdk.services.location.model.Place;
import software.amazon.awssdk.services.location.model.SearchPlaceIndexForTextResponse;
@albertywu
albertywu / gpt.java
Created May 9, 2023 22:28
gpt-generated tests
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import reactor.core.publisher.Flux;
import reactor.test.StepVerifier;
import software.amazon.awssdk.services.location.LocationAsyncClient;
import software.amazon.awssdk.services.location.model.Place;
import software.amazon.awssdk.services.location.model.SearchPlaceIndexForTextResponse;
@albertywu
albertywu / findFullName.java
Created May 5, 2023 16:59
Get full name from nickname
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class NicknameToName {
private static final Map<String, String> NICKNAME_TO_NAME_MAP;
static {
NICKNAME_TO_NAME_MAP = new HashMap<>();
@albertywu
albertywu / clibuddy.md
Last active April 15, 2023 02:00
A specification for clibuddy

I want to create a python CLI tool called 'clibuddy' that uses the 'click' library.

The CLI tool will wrap another command, and will either 1) print out detailed information of what failed or 2) attempt to fix errors any time the wrapped command fails with exit code > 0.

Structure of CLI app:

clibuddy --tool="tools/mytool.py" --explain mytool ...mytool_args
clibuddy --tool="tools/mytool.py" --fix mytool ...mytool_args
@albertywu
albertywu / sqlcsv
Last active June 21, 2022 17:56
sqlcsv - run sql on your csv
# Usage:
# sqlcsv foo.csv foo 'select count(*) from foo;'
#
# Requirement:
# brew install sqlite
function sqlcsv {
local file="$1"
local table="$2"
local cmd="$3"

using latest version 0.9.0

  1. works without cluster_id
resource "buildkite_pipeline" "wua-test-no-cluster" {
  name = "wua-testing-no-cluster"
  description = "testing creating a pipeline without cluster"
  repository = "gitolite@code.uber.internal:mobile/android"
  default_branch = "main"
  steps = file("./pipelines/mobile-release/metro-minion-build-release-apk-android.yml")
@albertywu
albertywu / jira_cli.md
Last active November 1, 2021 20:11
jira_cli.md
go install github.com/ankitpokhrel/jira-cli/cmd/jira@latest
export JIRA_API_TOKEN=$(usso -ussh t3 -print)
jira setup

# Add to startup script:
jira()
{
	unset -f jira
	JIRA_API_TOKEN=$(usso -ussh t3 -print)
const o = { foo: 1, bar: 2 }
const a = [1, 2, 3]
// iterate over keys in object
for (prop of Object.keys(o)) {
console.log(prop)
}
// iterate over values in object
for (value of Object.values(o)) {