Skip to content

Instantly share code, notes, and snippets.

View greenido's full-sized avatar
🏃‍♂️
Running with a big smile

Ido Green greenido

🏃‍♂️
Running with a big smile
View GitHub Profile
@greenido
greenido / QA.java
Created April 12, 2023 04:28
This program asks the user for their name, age, and favorite color. It then prints a report to the console.
import java.util.Scanner;
/**
* This program asks the user for their name, age, and favorite color.
* It then prints a report to the console.
*/
public class QA {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
@greenido
greenido / openai-simple-text-translation-call.js
Created March 20, 2023 18:13
An openai API example of using the DaVinci engine for language translation
const axios = require('axios');
const API_KEY = 'your_api_key_here';
const API_URL = 'https://api.openai.com/v1/';
async function translateText(text, targetLanguage) {
const response = await axios.post(`${API_URL}engines/davinci/translate`, {
text,
target_language: targetLanguage,
}, {
headers: {
@greenido
greenido / openai-simple-image-recongnition-call.js
Created March 20, 2023 18:12
An example on how to leverage OpenAI API for image recognition
const axios = require('axios');
const API_KEY = 'your_api_key_here';
const API_URL = 'https://api.openai.com/v1/';
async function recognizeImage(image_url) {
// We are passing in a URL of an image as data and making a POST
// request to the OpenAI API, and the response will contain information
// about what is in the picture.
@greenido
greenido / openai-simple-text-call.js
Created March 20, 2023 18:10
OpenAI simple text call
const axios = require('axios');
// You should use dotenv - but for the easy of use I put it here.
const API_KEY = 'your_api_key_here';
const API_URL = 'https://api.openai.com/v1/';
const prompt = 'how can I bake a good bread?';
async function generateText(prompt) {
  const response = await axios.post(`${API_URL}engines/davinci-codex/completions`, {
    prompt,
@greenido
greenido / openai-simple-call.js
Created March 19, 2023 23:35
A simple call to openai API
const { Configuration, OpenAIApi } = require("openai");
async function main() {
const configuration = new Configuration({
apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
const completion = await openai.createCompletion({
@greenido
greenido / adventofcode_com_2022_day_21_part1.js
Created December 21, 2022 20:46
The monkeys are back! You're worried they're going to try to steal your stuff again, but it seems like they're just holding their ground and making various monkey noises at you. Eventually, one of the elephants realizes you don't speak monkey and comes over to interpret. As it turns out, they overheard you talking about trying to find the grove;…
//
// https://adventofcode.com/2022/day/21
//
// Author: @greenido
// Date: 21-Dec-2022
//
const fs = require('fs')
const monkeys = new Map();
//
@greenido
greenido / Best_TV_Shows_2022.md
Created December 15, 2022 01:15
Best TV Shows 2022

Illustration by Andrew B. Myers

Television felt big in 2022—not just in the number of shows that débuted (a staggering legion, no doubt) but in the spectacle on display. This was especially apparent in the I.P.-amped fantasy realm. “The Lord of the Rings: The Rings of Power,” on Amazon Prime Video, earned the dubious distinction of becoming the most expensive series ever made, with a production budget reportedly topping a billion dollars. Its closest rival, HBO’s “House of the Dragon,” featured too many flying lizards to count, and threatened to resuscitate the monoculture that was eulogized alongside “Game of Thrones.” Meanwhile, the “Star Wars” series “Andor,” on Disney+, made planet-hopping akin to boarding a rocket-propelled Greyhound bus.

It’s unclear how much longer TV will stay bulky and bloated; Wall Street’s souring on streaming in the past several months portends a contraction in the entertainment industry that’s already begun, with the shelving of some films and the whittling down of on-demand

import { SkyMass } from "@skymass/skymass";
const sm = new SkyMass({ key: "XXX" });
sm.page("/hello_world", (ui) => {
const name = ui.string("name", {
label: "Please type your name",
});
ui.show(`Hello, ${name.val || "World"}!`);

Keybase proof

I hereby claim:

  • I am greenido on github.
  • I am greenido (https://keybase.io/greenido) on keybase.
  • I have a public key ASAxT8jI-pWizVOfT8zsrWDVvYzkgcTzriKZEDsiel5KJQo

To claim this, I am signing this object:

@greenido
greenido / games-to-play.md
Last active May 16, 2021 23:46
Some of the best games out there are free and could be used with friends and family.

🎉

Name Why you should play it? Online version Comments
Settlers Of Catan Negotiation and trading – fun fun fun https://www.catan.com/game/catan-universe Free/Paid.My favorite.
Among Us A classic from the NRiB OGs https://store.steampowered.com/app/945360/Among_Us/ Free.A Fun one with co-workers as well.
Draw battle Show your super power drawing skills https://drawbattle.io/ Free
Jackbox.tv Great production value, variety of modes, easy drop in/drop out https://jackbox.tv/ Paid
Poker Tons of clients out there! Would probably work best as directly advertised poker game night. Black Tie not required but encouraged https://www.pokernow.club/ Many more options
Escape Room There’s a few self-run online escape rooms that I’ve annecdotally heard are quite fun (better than some chaperoned virtual escape rooms) Many options – Google will help hereHere is one example Free/Paid.A great way to learn about your friends…