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
import { SkyMass } from "@skymass/skymass"; // "@skymass/skymass": "^0.3.7"
import "dotenv/config";
import pgPromise from "pg-promise";
const db = await initDB(); // pgp(process.env["CONNECTION_DB"]);
const sm = new SkyMass({ key: process.env["SKYMASS_KEY"] });
//
// function to initialize the database - Some random names, numbers and other stuff so it will be a 'full table'
@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: