Skip to content

Instantly share code, notes, and snippets.

@ynonp
ynonp / starter.py
Created July 27, 2023 14:02
generator-send-part1
import random
import sys
from typing import NewType
BPResult = tuple[int, int]
BPNumber = NewType('BPNumber', int)
ALL_OPTIONS = [n for n in range(1000, 99999) if len(str(n)) == len(set(str(n)))]
def guesses():
@ynonp
ynonp / 01-syntax-lab.md
Last active July 27, 2023 12:24
01-syntax

Python Syntax Exercises

  • Create a Python program that asks the user to tyep their age in years, and the program will convert and print their age in months.

  • Create a Python program that asks the user to type their age in months, and the program will convert and print their age in years.

  • Create a Python program to check the complexity of a password: It should ask the user for a word and verify the word contains a lowercase letter, an uppercase letter and a number.

  • Write a Python program that takes a number from the user and print the word "Boom" if that number divides by 7 or contains the digit 7

evenings_ok=(
"Pesach I"
"Pesach VII"
"Shavuot I"
"Tish'a B'Av"
"Rosh Hashana II"
"Yom Kippur"
"Sukkot I"
"Shmini Atzeret"
)
CREATE TABLE test (x integer, y integer);
INSERT INTO test(x, y) VALUES(10, 20);
INSERT INTO test(x, y) VALUES(10, 20);
INSERT INTO test(x, y) VALUES(10, 20);
@ynonp
ynonp / clojurescript-useeffect.cljs
Created February 18, 2022 18:42
ClojureScript useEffect example
(ns reagent-useeffect-demo.core
(:require
[reagent.core :as r]
[react :as react]
[cljs.core.async :refer [go]]
[cljs.core.async.interop :refer-macros [<p!]]
[reagent.dom :as rdom]))
(defn use-pokemon [id]
(let [[data set-data] (react/useState {})

Lab: Hello Vue

[ ] Create a first Vue app in Vite. Change the text to show your name.

[ ] Change the background color to a color you like

[ ] Add a new component that prints Hello <your name>. Add it to the page multiple times to see the message repeated.

[ ] Add a new component that shows an image.

# App port to run on
PORT=3000
# The name of the site where Kutt is hosted
SITE_NAME=Kutt
# The domain that this website is on
DEFAULT_DOMAIN=localhost:3000
# Generated link length
defmodule Day22_2 do
def read_input do
File.read!("input/day22.txt")
|> String.split("\n\n", trim: true)
|> Enum.map(fn deck_str ->
deck_str
|> String.split("\n", trim: true)
|> Enum.drop(1)
|> Enum.map(&String.to_integer/1)
end)
defmodule Day21 do
def read_input do
File.read!("input/day21.txt")
|> String.split("\n", trim: true)
end
def ingredients_list(line) do
[ingredients_str, _alergens_str] = String.split(line, [" (contains ", ")"], trim: true)
String.split(ingredients_str, " ", trim: true)
end