Skip to content

Instantly share code, notes, and snippets.

View mchernyavskaya's full-sized avatar

Maryna Cherniavska mchernyavskaya

View GitHub Profile
db.movies.find({$text: {$search: "drama -comedy -action"}}, {"title": 1, "plot": 1, "genres": 1, "_id": 0}).limit(5).sort({ "title": 1 })
[
{
plot: 'A stop-motion animated story about people living in a Sydney apartment complex looking for meaning in their lives.',
genres: [ 'Animation', 'Drama' ],
title: '$9.99'
},
{
plot: 'When Harold, a young white man, learns that his alcoholic, handicapped father is returning home, his frustration turns into racist viciousness against the two black men who work for the family.',
genres: [ 'Drama' ],
db.movies.find({$text: {$search: "drama"}}, {"title": 1, "plot": 1, "genres": 1, "_id": 0}).limit(5).sort({ "title": 1 })
[
{
plot: 'From her childhood bedroom in the Chicago suburbs, an American teenage girl uses social media to run the revolution in Syria. Armed with Facebook, Twitter, Skype and cameraphones, she helps...',
genres: [ 'Documentary', 'Action', 'Drama' ],
title: '#chicagoGirl: The Social Network Takes on a Dictator'
},
{
plot: 'A bank security expert plots with a call girl to rob three safety deposit boxes containing $1.5 million in cash belonging to three very different criminals from a high-tech security bank in Hamburg, Germany.',
genres: [ 'Comedy', 'Crime', 'Drama' ],
Atlas atlas-tlbhpu-shard-0 [primary] sample_mflix> db.movies.findOne()
{
_id: ObjectId("573a1390f29313caabcd4135"),
plot: 'Three men hammer on an anvil and pass a bottle of beer around.',
genres: [ 'Short' ],
runtime: 1,
cast: [ 'Charles Kayser', 'John Ott' ],
num_mflix_comments: 0,
title: 'Blacksmith Scene',
fullplot: 'A stationary camera looks at a large anvil with a blacksmith behind it and one on either side. The smith in the middle draws a heated metal rod from the fire, places it on the anvil, and all three begin a rhythmic hammering. After several blows, the metal goes back in the fire. One smith pulls out a bottle of beer, and they each take a swig. Then, out comes the glowing metal and the hammering resumes.',
set :connector_class, ConnectorsSdk::Base::REGISTRY.connector_class(settings.http['connector'])
@mchernyavskaya
mchernyavskaya / fishFarmCounter.kt
Created December 12, 2021 21:07
Fish Farm Counter - AOC - Day 6
class FishFarmCounter(input: String) {
private val fish = LongArray(NEWBORN_MAX_SEED + 1)
init {
input.split(",")
.filter { it.trim().isNotEmpty() }
.map { it.trim().toInt() }
.forEach {
fish[it]++
}
@mchernyavskaya
mchernyavskaya / Example.txt
Created December 12, 2021 20:56
Fish Farm input - Day 6 AOC
1,5,5,1,5,1,5,3,1,3,2,4,3,4,1,1,3,5,4,4,2,1,2,1,2,1,2,1,5,2,1,5,1,2,2,1,5,5,5,1,1,1,5,1,3,4,5,1,2,2,5,5,3,4,5,4,4,1,4,5,3,4,4,5,2,4,2,2,1,3,4,3,2,3,4,1,4,4,4,5,1,3,4,2,5,4,5,3,1,4,1,1,1,2,4,2,1,5,1,4,5,3,3,4,1,1,4,3,4,1,1,1,5,4,3,5,2,4,1,1,2,3,2,4,4,3,3,5,3,1,4,5,5,4,3,3,5,1,5,3,5,2,5,1,5,5,2,3,3,1,1,2,2,4,3,1,5,1,1,3,1,4,1,2,3,5,5,1,2,3,4,3,4,1,1,5,5,3,3,4,5,1,1,4,1,4,1,3,5,5,1,4,3,1,3,5,5,5,5,5,2,2,1,2,4,1,5,3,3,5,4,5,4,1,5,1,5,1,2,5,4,5,5,3,2,2,2,5,4,4,3,3,1,4,1,2,3,1,5,4,5,3,4,1,1,2,2,1,2,5,1,1,1,5,4,5,2,1,4,4,1,1,3,3,1,3,2,1,5,2,3,4,5,3,5,4,3,1,3,5,5,5,5,2,1,1,4,2,5,1,5,1,3,4,3,5,5,1,4,3
@mchernyavskaya
mchernyavskaya / fishFarmCall.kt
Created December 12, 2021 20:50
Fish Farm calling code - Advent of Code
fun part1(input: List<String>): Long {
return FishFarm(input[0]).plusDays(DAYS)
}
// test if implementation meets criteria from the description, like:
val testInput = readInput("day6/Example_test")
val part1 = part1(testInput)
check(part1 == 5934)
@mchernyavskaya
mchernyavskaya / fishFarm.kt
Created December 12, 2021 20:46
Fish Farm - Advent Of Code - Classes for task 1
const val DAYS = 80
const val MORE_DAYS = 256
const val NEWBORN_MAX_SEED = 8
const val MAX_SEED = 6
class Fish(private var seed: Int = NEWBORN_MAX_SEED) {
fun plusDay(): Fish? {
if (seed == 0) {
seed = MAX_SEED
return Fish()
{
"ServiceArn": "arn:aws:apprunner:us-east-1:973520824978:service/KotLink/c22330b171d24c3e9956a14fdd8cf218",
"SourceConfiguration": {
"ImageRepository": {
"ImageIdentifier": "public.ecr.aws/e4b0r7m1/kotlink:latest",
"ImageConfiguration": {
"RuntimeEnvironmentVariables": {
"SPRING_DATASOURCE_PASSWORD": "censored",
"SPRING_DATASOURCE_URL": "jdbc:postgresql://censored",
"SPRING_DATASOURCE_USERNAME": "postgres",
{
"Service": {
"ServiceName": "KotLink",
"ServiceId": "c22330b171d24c3e9956a14fdd8cf218",
"ServiceArn": "arn:aws:apprunner:us-east-1:973520824978:service/KotLink/c22330b171d24c3e9956a14fdd8cf218",
"ServiceUrl": "piphipj2v4.us-east-1.awsapprunner.com",
"CreatedAt": "2021-11-01T21:27:50+01:00",
"UpdatedAt": "2021-11-01T21:27:50+01:00",
"Status": "RUNNING",
"SourceConfiguration": {