Skip to content

Instantly share code, notes, and snippets.

View RamiAwar's full-sized avatar
🎯
Working on Pet, Dataline, and SQLAlchemy stuff

Rami Awar RamiAwar

🎯
Working on Pet, Dataline, and SQLAlchemy stuff
View GitHub Profile
@RamiAwar
RamiAwar / color_spectrum_generator.py
Created October 27, 2023 08:49
Generate very light colors in a spectrum to display as background for columns in an excel or csv. Light enough to show black text in front, different enough to be distinguishable, and lacking a red component to allow for validation errors be highlighted in red.
import colorsys
class ColorGenerator:
def __init__(self, hue=0.2, saturation=0.2, value=0.8):
self.hue = hue # Range [0.0, 1.0]
self.saturation = saturation # Range [0.0, 1.0]
self.value = value # Range [0.0, 1.0]
def get_color(self):
# Convert HSV to RGB

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@RamiAwar
RamiAwar / vite.config.js
Created August 3, 2022 04:09
Vite Config
import { sveltekit } from '@sveltejs/kit/vite';
import path from 'path';
/** @type {import('vite').UserConfig} */
const config = {
plugins: [sveltekit()],
resolve: {
alias: {
$lib: path.resolve('./src/lib')
}
@RamiAwar
RamiAwar / tsconfig.json
Created August 3, 2022 04:08
tsconfig/jsconfig
{
"extends": "./.svelte-kit/tsconfig.json",
"paths": {
"$lib": ["src/lib"],
"$lib/*": ["src/lib/*"]
},
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
@RamiAwar
RamiAwar / .zshrc
Last active July 18, 2022 11:34
Template .zshrc
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
def verify_image(file):
"""Verifies that file is a valid image"""
return file.ext in ("jpg", "jpeg", "png")
def store_file(file):
"""Upload file to storage microservice"""
return storage_service.upload_image(file)
def upload_image(file):
"""API route to upload image"""
def verify_image(file):
"""Verifies that file is a valid image"""
return file.ext in ("jpg", "jpeg", "png")
def store_file(file):
"""Uploads a file to the document storage server, returns URL"""
pass
def upload_image(file):
"""API route to upload image"""
def calculate_stats(exam_results: List[int]) -> Dict[str, float]:
max_score = max(exam_results)
min_score = min(exam_results)
avg_score = sum(exam_results) / len(exam_results)
return {"max": max_score, "min": min_score, "avg": avg_score}
def post_exam_computation(exam_id):
exam_results = db.get(exam_id)
exam_stats = calculate_stats(exam_results)
def calculate_stats(exam_results):
max_score = max(exam_results)
min_score = min(exam_results)
return {"max": max_score, "min": min_score}
def post_exam_computation(exam_id):
exam_results = db.get(exam_id)
exam_stats = calculate_stats(exam_results)
db.save(exam_stats)
def post_exam_computation(exam_id): # Requires exam_id
exam_results = db.get(exam_id) # Requires mocking db
max_score = max(exam_results) # Need exam results
min_score = min(exam_results)
exam_stats = {"max": max_score, "min": min_score}
db.save(exam_stats) # Requires mocking db