Skip to content

Instantly share code, notes, and snippets.

View mmowbray's full-sized avatar

Maxwell Mowbray mmowbray

  • Montreal, QC
View GitHub Profile
@mmowbray
mmowbray / tesla_price_watcher.py
Last active February 14, 2024 20:34
Tesla price watcher 2023
from celery import shared_task
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from django.core.mail import send_mail
from django.conf import settings
TESLA_URL = 'https://www.tesla.com/en_CA/inventory/new/my?TRIM=LRAWD&PAINT=BLACK&ADL_OPTS=TOWING&arrangeby=plh&zip=h4r0j1&range=200'
'''
>centris-property-checker.py<
@Author: Maxwell Mowbray
@Email: mmowbray@mentlegen.com
@Date: February 2021
@Description:
This script will periodically check a Centris personal link for new properties.
When a new property appears, the user is notified with a popup.
'''
Maxwell Mowbray 2020
This simple program traverses an acyclic, weighted, and directed graph of flights across Canada.
It finds all of the valid paths from the source to the destination city, and prints all the hops and the total time.
'''
# edge
'''
>tesla-inventory-price-scraper.py<
@Author: Maxwell Mowbray
@Email: mmowbray@mentlegen.com
@Date: April 2020
@Description:
This script scrapes Tesla's car inventory website and alerts the user if a car under a certain price appears.
It can easily be adapted to do other things with the results, such as alert you when a specific car with a specific trim/color/wheel size appears in inventory.
public class FizzBuzz {
public static void main(String[] args) {
String output;
for(int i = 1; i <= 100; i++){
if(i % 3 == 0 || i % 5 == 0){
output = "";
@mmowbray
mmowbray / gist:6ef1d6be2fe1ecfcff66
Last active September 24, 2016 19:34
Get image u,v from screen touch
//put this just before the 'break;' of switch 'case MotionEventActions.Down:' in MapView
float u = (_lastTouchX-_translateX)/(_map.CurrentFloor.Image.IntrinsicWidth*_scaleFactor) + 0.50f;
float v = (_lastTouchY-_translateY)/(_map.CurrentFloor.Image.IntrinsicHeight*_scaleFactor) + 0.50f;
Log.Wtf("map_press", String.Format("Map Touched: (u,v):({0},{1}", u, v));
<rdf:RDF
xmlns = "http://www.example.com/university#"
xml:base = "http://www.example.com/university#"
xmlns:rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs= "http://www.w3.org/2000/01/rdf-schema#"
xmlns:xsd = "http://www.w3.org/2001/XMLSchema#"
>
<!-- RDF Schema (Domain Model) -->
int image_width = 4;
int image_height = 5;
for (int y = 0; y < image_height - 1; y++) {
for (int x = 0; x < image_width - 1; x++) {
System.out.println("(" + ((y * image_width) + x) + "," + ((y * image_width) + x + 1) + "," + (x + ((y+1) * image_width)) + ")"); //top triangle indices
System.out.println("(" + ((y * image_width) + x + 1) + "," + (x + 1 + ((y+1) * image_width)) + "," + (x + ((y+1) * image_width)) + ")"); //bottom triangle indices
}
@mmowbray
mmowbray / GetTreeView.cs
Last active August 29, 2015 14:12
Convert a list of paths into its corresponding hierarchical tree (in XML). Can be used for webpages.
// This method accepts a list of strings, where each string is a path (eg. "home/user/max/pic.png")
// and creates a hierarchical XML tree out of them
using System.Collections.Generic;
using System.Xml.Linq;
using System.Linq;
public string GetTreeViewXml(List<string> paths)
{
XDocument doc = new XDocument(new XElement("ul"));
@mmowbray
mmowbray / Recursion249.java
Last active August 29, 2015 14:00
249 Winter 2014 Recursion
// --------------------------------------------------------------------------------------------------------
// Recursion249.java
// Written by: Maxwell Mowbray
// For COMP 249 Section PP - Tutorial PB - Winter 2014.
// These are the questions from the COMP 249 final which dealt with recursion
// --------------------------------------------------------------------------------------------------------
public class Recursion249
{
public static int count = 0;