Skip to content

Instantly share code, notes, and snippets.

View andrija-zikovic's full-sized avatar
🏠
Working from home

Andrija Žiković andrija-zikovic

🏠
Working from home
View GitHub Profile
#include <cs50.h>
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
int convert(string input);
int main(void)
{
import string
word = input("Greeting: ")
word = word.lower()
if word[:5] == 'hello':
print("$0")
elif word[0] == 'h':
print("$20")
else:
print("$100")
@andrija-zikovic
andrija-zikovic / app.py
Created May 26, 2023 10:50
CS50/birthdays
import os
from cs50 import SQL
from flask import Flask, flash, jsonify, redirect, render_template, request, session
# Configure application
app = Flask(__name__)
# Ensure templates are auto-reloaded
app.config["TEMPLATES_AUTO_RELOAD"] = True
// BMP-related data types based on Microsoft's own
#include <stdint.h>
// Aliases for C/C++ primitive data types
// https://msdn.microsoft.com/en-us/library/cc230309.aspx
typedef uint8_t BYTE;
typedef uint32_t DWORD;
typedef int32_t LONG;
typedef uint16_t WORD;
#include <cs50.h>
#include <stdio.h>
#include <string.h>
const int BITS_IN_BYTE = 8;
void print_bulb(int bit);
int main(void)
{
#include <cs50.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
int only_digits(string text);
int rotate(char c, int n);
int main(int argc, string argv[])
#include <cs50.h>
#include <stdio.h>
int get_cents(void);
int calculate_quarters(int cents);
int calculate_dimes(int cents);
int calculate_nickels(int cents);
int calculate_pennies(int cents);
int main(void)
AATGAATGAATGAATGAATGAATGAATGAATGAATGAATGAATGAATGAATGGTTAAAGCCAAGTGGAAGTTGACGAGCTACGGCACAGGTACCCTATACATACGGTAAATGAGTCGGAGGTTGTGGGTTTAAAGTAAGTCCCCGCTCAACATTCAGCAGACCCTCGAAGTGGGCCCTAAAATCGTGTTGCTAACGCTCCGGACCTGACCCCGAGCTTGGCTCCTAATTGTGTACTCTCTCCAACCAAGCAGCGTACCAACGCGGCAACCAGAGCGAAGCTGTACACGTCGATCATCGTTACGCCTCTACTCGATAGTCGTAGAAACTTGTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTTTTTTTCTGCGGTTGGTAGCTCTAACTGTCATCGTATTCGCGAATACCTCAGATATAAGCTCCAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAAGTGAATGCACGAGAGTGTTATAGCAGATATCCCCGCTGATCCGGCTGCCGAGGAGGTGGGCATGTGACGTTATGCACTACACAGCTACTACCAAGGTCTTCTGCGGGAAAGGATAGACAAACCGGCAACTCCGCGAGGTCGCGGACTTAGTATTGCGACGGCGTCCTAATCGGCTGGATTTGCGGTTTGTTGGCGTTAGTCCAAAGGTG
UPDATE shows SET title = "How I Met Your Mother" WHERE title LIKE "How i met your mother";
UPDATE shows SET title = "Adventure Time" WHERE title LIKE "Adventure Time";
UPDATE shows SET title = "Arrow" WHERE title LIKE "Arrow";
UPDATE shows SET title = "Avatar: The Last Airbender" WHERE title LIKE "Avatar: The Last Airbender";
UPDATE shows SET title = "Community" WHERE title LIKE "Community";
UPDATE shows SET title = "Family Guy" WHERE title LIKE "Family Guy";
UPDATE shows SET title = "Friends" WHERE title LIKE "Friends";
UPDATE shows SET title = "Game of Thrones" WHERE title LIKE "Game of Thrones" OR title LIKE "Got";
UPDATE shows SET title = "Gilmore Girls" WHERE title LIKE "Gilmore Girls";
UPDATE shows SET title = "Grey’s Anatomy" WHERE title LIKE "Grey’s Anatomy" OR title LIKE "Grey%";
@andrija-zikovic
andrija-zikovic / log.sql
Created May 26, 2023 11:02
CS50/fiftyville
-- Keep a log of any SQL queries you execute as you solve the mystery.
SELECT description FROM crime_scene_reports WHERE year = '2021' AND day = '28' AND month = '7' AND street = 'Humphrey Street';
-- Theft of the CS50 duck took place at 10:15am at the Humphrey Street bakery. Interviews were conducted today with three witnesses who were present at the time – each of their interview transcripts mentions the bakery.
SELECT * FROM interviews WHERE year = '2021' AND day = '28' AND month = '7' AND transcript LIKE '%bakery%' ;
-- | 161 | Ruth | 2021 | 7 | 28 | Sometime within ten minutes of the theft, I saw the thief get into a car in the bakery parking lot and drive away. If you have security footage from the bakery parking lot, you might want to look for cars that left the parking lot in that time frame.
-- | 162 | Eugene | 2021 | 7 | 28 | I don't know the thief's name, but it was someone I recognized. Earlier this morning, before I arrived at Emma's bakery, I was walking by the ATM on Leggett