Skip to content

Instantly share code, notes, and snippets.

View tebba-von-mathenstein's full-sized avatar

Tyler Bettilyon tebba-von-mathenstein

View GitHub Profile
@tebba-von-mathenstein
tebba-von-mathenstein / auto_engineer_image.py
Created March 30, 2024 17:59
A simple AI Prompt Engineering example with OpenAI
from openai import OpenAI
# Your API key must be saved in an env variable for this to work.
client = OpenAI()
# Get a prompt, embed it into a classification request to GPT
image_subject = input("Subject: ")
image_setting = input("Setting: ")
image_style = input("Style: ")
@tebba-von-mathenstein
tebba-von-mathenstein / explore-dns-part-two.md
Last active January 18, 2021 19:28
An exercise to help you explore DNS and dig.

Explore DNS With Dig

In this exercise you'll learn about DNS by using dig to make DNS queries. These are the primary objectives of this exercise:

  • Expose the different responsibilities of different members of the DNS hierarchy.
  • Explore how different DNS servers respond differently to different DNS queries.
  • Familiarize yourself with the different kinds of DNS record types, and distinguish between them.

dig is a command line tool that comes installed on most unix and linux systems, or can be installed with your favorite package manager. If not, you can use this web interface -- but the user experience is much worse so I strongly suggest you use the command line instead.

@tebba-von-mathenstein
tebba-von-mathenstein / explore-dns-part-two-answers.md
Last active January 18, 2021 19:28
An answer key for part two of exploring DNS

Explore DNS With Dig

In this exercise you'll learn about DNS by using dig to make DNS queries. These are the primary objectives of this exercise:

  • Expose the different responsibilities of different members of the DNS hierarchy.
  • Explore how different DNS servers respond differently to different DNS queries.
  • Familiarize yourself with the different kinds of DNS record types, and distinguish between them.

dig is a command line tool that comes installed on most unix and linux systems, or can be installed with your favorite package manager. If not, you can use this web interface -- but the user experience is much worse so I strongly suggest you use the command line instead.

@tebba-von-mathenstein
tebba-von-mathenstein / explore-dns-part-one.md
Last active March 14, 2024 17:23
An exercise to help you learn about DNS and dig

Explore DNS With Dig

In this exercise you'll learn about DNS by using dig to make DNS queries. These are the primary objectives of this exercise:

  • Expose the different responsibilities of different members of the DNS hierarchy.
  • Explore how different DNS servers respond differently to different DNS queries.
  • Familiarize yourself with the different kinds of DNS record types, and distinguish between them.

dig is a command line tool that comes installed on most unix and linux systems, or can be installed with your favorite package manager. If not, you can use this web interface -- but the user experience is much worse so I strongly suggest you use the command line instead.

@tebba-von-mathenstein
tebba-von-mathenstein / explore-dns-part-one-answers.md
Last active January 18, 2021 19:29
Answer key for the explore DNS part 1 exercise

Explore DNS With Dig

In this exercise you'll learn about DNS by using dig to make DNS queries. These are the primary objectives of this exercise:

  • Expose the different responsibilities of different members of the DNS hierarchy.
  • Explore how different DNS servers respond differently to different DNS queries.
  • Familiarize yourself with the different kinds of DNS record types, and distinguish between them.

dig is a command line tool that comes installed on most unix and linux systems, or can be installed with your favorite package manager. If not, you can use this web interface -- but the user experience is much worse so I strongly suggest you use the command line instead.

1. why does the sun shine
you answer here
3. why is the sky blue
youre answer ehre

Multiplication & Big O

Addition In a Loop

It's easy to write the code for this algorithm:

def multiplication(a, b):
  product = 0
 for _ in range(b):
@tebba-von-mathenstein
tebba-von-mathenstein / callable_number.js
Created June 28, 2017 17:57
Just one odditiy of JS
function CallableNumberGenerator(value, func) {
var selfFunction = function() {
var v = func.apply(null, arguments);
return CallableNumberGenerator(v, func);
}
var callableNumber = selfFunction.bind(null, value);
var value = value;
// Get the user's choice
var userChoice = prompt("Rock, paper, or scissors?");
userChoice = userChoice.toLowerCase();
// Get the computer's choice
var computerChoice = Math.random();
// Teach the computer how to guess rock, paper, or scissors
if(computerChoice < .33) {
computerChoice = "rock";
// Function definition. This creats a function called reverseString
// which accepts one parameter.
function reverseString(inputString) {
var outputString = "";
for(var i = inputString.length - 1; i >= 0; i--) {
var currentChar = inputString[i];
outputString += currentChar;
}