Skip to content

Instantly share code, notes, and snippets.

View Hamleyburger's full-sized avatar
🦍

Alma Hamleyburger

🦍
View GitHub Profile
@Hamleyburger
Hamleyburger / buy.html
Created May 19, 2020 13:18
Html/Jinja template for a "buy" form
{% extends "layout.html" %} {% block title %} Buy {% endblock %} {% block main
%}
<div>
<form action="/buy" method="post">
<! –– search bar –– >
<div class="input-group">
<input
type="text"
class="form-control"
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField, BooleanField
from wtforms.validators import DataRequired, Length, EqualTo, ValidationError
from .models import User
def uniqueUser(form, field):
if User.get(field.data):
raise ValidationError('Sorry. That name is already taken')
class RegistrationForm(FlaskForm):
@Hamleyburger
Hamleyburger / import.py
Last active January 4, 2021 17:44
Solution for pset7 houses, CS50 2020
import sqlite3
import csv
import sys
def main():
# checking argv (that there's one and it's a csv)
if (len(sys.argv) != 2):
sys.exit("Usage: import.py file.csv")
@Hamleyburger
Hamleyburger / recover.c
Created September 2, 2019 20:28
My solution to CS50 recover.
#include <stdio.h>
#include <stdlib.h>
#include <cs50.h>
#include <stdint.h>
#include <ctype.h>
typedef uint8_t byte;
bool isjpg(byte *block);
@Hamleyburger
Hamleyburger / questions.md
Created August 5, 2019 14:59
Q&A whodunit cs50

Questions

What's stdint.h?

A header file that contains int types of specified widths and corresponding macros.

What's the point of using uint8_t, uint32_t, int32_t, and uint16_t in a program?

uint8_t is the most space saving way to store a positive int from 0-255(255 requires 8 bits). Must be positive because the "signed" is what enables the use of -/+ signs as the first bit. All these types of int have specific sizes, so you use them when you need to make sure a variable has aa specific amount of space allocated.

@Hamleyburger
Hamleyburger / crack
Created July 29, 2019 14:28
My attempt at crack, cs50
#include <cs50.h>
#include <stdio.h>
#include <crypt.h>
#include <string.h>
#include <math.h>
void allpossible1(string hash, string salt);
void allpossible2(string hash, string salt);