Skip to content

Instantly share code, notes, and snippets.

View waltzfordebby's full-sized avatar

waltzfordebby waltzfordebby

  • Donsol, Sorsogon
View GitHub Profile

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

4.
pipenv install flask-sqlalchemy
python
from flaskblog import db
db.create_all()
from flaskblog import User, Post
user_1 = User(username='Corey', email='C@demo.com', password='password')
db.session.add(user_1)
user_2 = User(username='JohnDoe', email='jd@demo.com', password='password')
db.session.add(user_2)
@waltzfordebby
waltzfordebby / pipenv_cheat_sheet.md
Created January 28, 2019 00:28 — forked from bradtraversy/pipenv_cheat_sheet.md
Pipenv cheat sheet for common commands

Pipenv Cheat Sheet

Install pipenv

pip3 install pipenv

Activate

pipenv shell
https://forums.linuxmint.com/viewtopic.php?f=47&t=265925&p=1445406&hilit=phpmyadmin#p1445406
https://www.a2hosting.com/kb/developer-corner/mysql/managing-mysql-databases-and-users-from-the-command-line
cd /etc/apache2/sites-available
cp 000-default.conf <name_of_site>.conf
sudo gedit <name_of_site>.conf
Add the path for virtual host
sudo a2enmod rewrite
sudo a2ensite <name_of_site>.conf
sudo service apache2 restart
sudo gedit /etc/hosts
enter the created site
127.0.0.1 <name_of_site>.conf
To install postgresql
sudo apt-get install postgresql-10
To check the command you can use for postgresql
service postgresql
postgresql commands
service postgresql status = check the status
C
Login in to postgresql
Installing environment
python3 -m venv ./venv = to create virtual environment
pip3 freeze = to check the package installed on your environment or global
source ./venv/bin/activate = to activate virtual environment (you dont need to use python3, you can now use python)
deactivate = to get out of virtual environment
Installing Django
pip install django
django-admin = helps you customize django
django-admin startproject <projectname> . = create django project inside the current directory
@waltzfordebby
waltzfordebby / bash-cheatsheet.sh
Created June 14, 2018 07:38 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04