Skip to content

Instantly share code, notes, and snippets.

View mfekadu's full-sized avatar
📖
Studying

Michael Fekadu mfekadu

📖
Studying
View GitHub Profile
DROP VIEW IF EXISTS Professor_Teaches_Section;
CREATE VIEW Professor_Teaches_Section AS SELECT * FROM (
SELECT first_name, last_name, phone_number, research_interests, email, prof_alias_id, prof_email_alias, id_sections, section_name, instructor, alias, title, phone, office, `type`, days, `start`, `end`, location, department
FROM (
SELECT * FROM Professors
JOIN (SELECT id AS prof_alias_id, substring_index(email, "@", 1) AS prof_email_alias FROM Professors) AS ProfAlias
ON Professors.id = ProfAlias.prof_alias_id
) AS ProfWithAlias
JOIN Sections
ON Sections.alias = ProfWithAlias.prof_email_alias
@mfekadu
mfekadu / tasks.py
Last active March 4, 2020 19:44
My tasks.py that I'll use until https://github.com/pyinvoke/invoke/issues/704 is fixed
"""
Source: https://gist.github.com/mfekadu/ceaa65dd158bd45dcfadbbda17b83b03
"""
from invoke import task
import os
import webbrowser
try:
from StringIO import StringIO ## for Python 2
except ImportError:
@mfekadu
mfekadu / tasks.py
Last active February 26, 2020 00:33
All the useful invokes that I like https://www.pyinvoke.org
from invoke import task
import os
import webbrowser
try:
from StringIO import StringIO ## for Python 2
except ImportError:
from io import StringIO ## for Python 3
@mfekadu
mfekadu / app.py
Last active February 4, 2021 23:01 — forked from DmitryBe/app.py
SQLAlchemy quick start for MySQL
# http://bytefish.de/blog/first_steps_with_sqlalchemy/
# https://docs.sqlalchemy.org/en/13/
# https://www.sqlalchemy.org/library.html
# ^ if 1.3 is not current release
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
from datetime import datetime, timedelta
from sqlalchemy import Table, Column, Integer, String, DateTime, ForeignKey
from sqlalchemy.orm import relationship, backref
@mfekadu
mfekadu / snake.html
Last active October 2, 2019 21:06
A simple janky snake game with vanilla javascript and html && sorta mobile friendly
<html>
<head>
<title>Snake</title>
<!-- the follwing line of code optimizes for mobile screens -->
<meta name="viewport" content="width=device-width, user-scalable=no">
<style>
button {
background-color: #4CAF50; /* Green */
border: none;
import numpy as np
# define the neural network architecture
# Input Data
a_0 = [1, 2]
inputs = a_0
#Layer 1
weights_1 = [[-2.0, 1.5],
[ 1.5, -1.0],
.DS_Store
@mfekadu
mfekadu / zhrl
Last active March 6, 2019 03:43
ZHRL programming language implemented in Rust for fun (also Elixir implementation here ... https://github.com/mfekadu/ZHLR3-elixir)