Skip to content

Instantly share code, notes, and snippets.

View wmantly's full-sized avatar

William Mantly wmantly

View GitHub Profile

Coffee Maker

You will be designing a software implementation of a simple coffee maker. The following hardware needs to be monitored. Write the methods for:

  • The heating element for the boiler. It can be turned on or off.
  • The heating element for the warmer plate. It can be turned on or off.
  • The sensor for the warmer plate. It has three states: warmerEmpty, potEmpty, potNotEmpty.
  • A sensor for the boiler, which determines whether there is water present. It has two states: boilerEmpty or boilerNotEmpty.
  • The Brew button. This is a momentary button that starts the brewing cycle. It has an indicator that lights up when the brewing cycle is over and the coffee is ready.
  • A pressure-relief valve that opens to reduce the pressure in the boiler. The drop in pressure stops the flow of water to the filter. It can be opened or closed.
import sqlite3
class Model:
def __init__( self, **kwargs ):
for key, value in kwargs.items():
setattr( self, key, value )
def __connect():
conn = sqlite3.connect( 'babyorm.db' )
@classmethod
def all(cls,*args):
c.execute('SELECT * FROM {}' .format(cls.__name__))
complete_data = c.fetchall()
column_name = c.description
names_of_columns = []
for i in range(0,len(column_name)):
col = (column_name[i][0])
names_of_columns.append(col)
rows = []
<VirtualHost *:80>
ServerAdmin [email protected]
# ServerName dev.718it.biz
ServerName dev.718it.biz
DocumentRoot /stuff0/dev
<Directory />
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride AuthConfig FileInfo
Require all granted
@wmantly
wmantly / git.sh
Last active August 27, 2015 22:08
# do this when ever u start working on a git repo
git clone https://github....
cd <repo name>
git checkout -b amos
# do this when you have work to add
git add --all :/
git commit -m "what u did here"
git push origin amos
(function(){
window.bbQuery = function(selector){
//can only select one element by id. Make it able to select ids, classes, and by plain tag name ie. "header"
//and return multiple elements when more than one is selected
//example usage: bbQuery("#lol") - bbQuery(".container") - bbQuery("h1")
// checks to see if there are spaces in the selector, then parse it for multi node matches.
if( /\s/.test(selector) ) return new Element( selectors['multi'](selector) );
// breaks the selector match from string, then set what kind of match to perform.
@wmantly
wmantly / install.sh
Last active November 15, 2015 03:22
#!/bin/bash
wget -O install.sh 'https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda3-2.4.0-Linux-x86_64.sh';
chmod +x install.sh;
./install.sh;
def post(self, request):
code = request.POST.get('code').replace('"','\\"')
res = subprocess.getoutput("python3 -c \""+ code + "\"")
context = {'code': code, 'res': res}
return render(request, self.template, context)
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
env/
Color_Off='\e[0m' # Text Reset
# Regular Colors
Black='\e[0;30m' # Black
Red='\e[0;31m' # Red
Green='\e[0;32m' # Green
Yellow='\e[0;33m' # Yellow
Blue='\e[0;34m' # Blue
Purple='\e[0;35m' # Purple
Cyan='\e[0;36m' # Cyan