Skip to content

Instantly share code, notes, and snippets.

View reselbob's full-sized avatar

Bob Reselman reselbob

View GitHub Profile

The objective of this track is to learn how to inject data dynamically at test time using just-in-time data.

You'll emulate user input that is typically added in a track's challenge manually using a solve script that will be verified later in a check script.

In this first challenge, you're going to get a random word from an online resource and then assign that random word to an environment variable that you'll persist in the /root/.bashrc file. Saving the environment variable to the /root/.bashrc file will makes its value available later on.

The online resource you'll use to get a random word is an API published by https://wordnik.com. You'll need to register to the site and get an API key in order to have the website provide a random word. You'll add the API to the URL that you'll call using a curl command. The command you'll use to get the random word is:

SECRET_MESSAGE=$(curl -s 'https://api.wordnik.com/v4/words.json/randomWord?api_key=<YOUR_API_KEY> | jq -r '.word')
@reselbob
reselbob / AmazingMessageRepeater.sol
Created March 25, 2023 20:54
Solidity Smart Contracts for OOP Developers
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9.0;
import "./MessageRepeater.sol";
contract AmazingMessageRepeater is MessageRepeater {
function repeatMessage(uint256 repetitions) public view virtual override returns (string[] memory){
string[] memory arr;
for (uint i = 0; i < repetitions; i++) {
arr = addElementToStringArray(arr, toUpperCase(getMessage()));
@reselbob
reselbob / simple-graphql-schema.gql
Last active June 17, 2022 18:27
simple-graphql-schema
enum Level {
LOW
MEDIUM
HIGH
}
enum Season {
SUMMER
AUTUMN
@reselbob
reselbob / simple-grpc-schema.proto
Last active June 10, 2022 12:15
simple-grpc-schema
syntax = "proto3";
package simpleapi;
enum Season {
SUMMER = 0;
AUTUMN = 1;
WINTER = 2;
SPRING = 3;
}
@reselbob
reselbob / seat-saver.graphql
Created January 13, 2021 02:59
A sample GraphQL type defintion file
const {gql} = require('apollo-server');
module.exports = gql`
"""A custom scalar that returns time data as JavaScript Date object"""
scalar Date
scalar Object
enum SeatStatus {
"""The seat is in the process of being released from RESERVED or SOLD status"""
RELEASING
@reselbob
reselbob / simple-grpc-schema.proto
Created January 10, 2021 18:28
A sample of a gRPC proto file
syntax = "proto3";
package seatsaver;
option objc_class_prefix = "SEATSAVER";
/* Describes a customer associated with a seat. */
message Customer {
string firstName = 1;
string lastName = 2;
@reselbob
reselbob / airport-code-spec.yaml
Created January 10, 2021 18:12
An example of an OpenAPI/ Swagger 2.0 REST specification
---
swagger: "2.0"
info:
description: A super great RESTful API that allows developers to lookup the codes for all the major international airports. Also, the API allows adminstrators to add a new airport code as needed.
version: 0.0.9
title: Airport Codes Lookup API
contact:
email: reselbob@gmail.com
license:
name: Apache 2.0
@reselbob
reselbob / cncf-grpc-usage-analysis.md
Last active September 29, 2020 00:20
An analysis of which CNCF Graduated Project use gRPC

How Many CNCF Graduated Project uses gRPC?

Of the 11 graduated projects listed below 9 use gRPC

Methodology

The method used to determine if a project uses gRPC is to run the cloc line code analysis tool on the each of the code repository in GitHub of each of the projects graduated by the CNCF as listed here as of September 28, 2020. The only proejct that was omitted is TUF because it is a specification only.

cloc analyzes all the code in the repo and organizes the results according to file type. Also, it inspects each file discovered and analyzes the file and reports the number lines in the file, as blank, comment and active.

Cloc is invoked using the following command that executes a shell script.