Skip to content

Instantly share code, notes, and snippets.

View spidezad's full-sized avatar

Tan Kok Hua spidezad

  • Seagate Technology
View GitHub Profile
@spidezad
spidezad / Sublime text for python IDE
Last active February 19, 2020 06:42
Sublime text Configure for python IDE
# youtube ref
https://www.youtube.com/watch?v=t2A_4gWzg8c
# terminal in sublime text
https://www.youtube.com/watch?v=sRxpxFDGLXI
# Configure terminus --key binding only work in windows
https://github.com/James231/Terminals-In-Sublime-Text
# command palatte --> install packages --> terminus
@spidezad
spidezad / BasicDjangoSimpleProject
Last active January 16, 2020 15:19
djangoBasic
## From Django Tutorial
# Create Project
django-admin startproject mysite
# Create Apps
python manage.py startapp polls
# Add app to settings.py
@spidezad
spidezad / django_static_files
Last active January 15, 2020 13:53
Django static files Notes
# update settings.py for new app
# create views.py in app
# create urls.py in app
# update urls.py in main
# add in various html template in app_name/templates
# for the html template
{% load static %}
# specifying a static file
<link rel="stylesheet" type="text/css" href="{% static 'appsname/style.css' %}">
@spidezad
spidezad / psql commands
Created December 15, 2019 14:55
PSQL Commands
# Start PostgreSQL server
pg_ctl -D /usr/local/var/postgres start
# list all database
\l
# help on all commands
\?
# connect to database
@spidezad
spidezad / gist:99e889feea264144ccf3317c27c33a6d
Created December 9, 2019 14:25
Mac OS virtualenv Python issue
#pip suddenly not working (SSL related)
brew reinstall python3
link: https://stackoverflow.com/questions/58280484/ssl-module-in-python-is-not-available-on-osx
# if python2 on os
curl https://bootstrap.pypa.io/get-pip.py | sudo python2
# git clone and pip install requirements
git clone https://github.com/eleanorstrib/deploying-django.git
pip install -r requirements.txt
@spidezad
spidezad / gist:0b94db32fbb40f98b5160dd2e4abd602
Created December 3, 2019 14:53
Installing Postgres on Mac
Ref: https://medium.com/@Umesh_Kafle/postgresql-and-postgis-installation-in-mac-os-87fa98a6814d
# Remove previous versions of PostgreSQL
brew uninstall --force postgresql
# Delete all Files of Postgres
rm -rf /usr/local/var/postgres
# Install Postgres with Homebrew
brew install postgres
@spidezad
spidezad / gist:7bf2a7e6af3392b1e6ee5ea6591b35ce
Last active November 27, 2019 15:04
VirtualEnvWrapper Notes
https://virtualenvwrapper.readthedocs.io/en/latest/
pip install virtualenvwrapper
mkvirtualenv env1
lssitepackages #see new packages
workon env1
echo $VIRTUAL_ENV
# make virtualenv with python3
mkvirtualenv env1 --python=python3
sns.heatmap(df.isnull(), yticklabels=False, cbar = False, cmap = 'viridis')
from keras.utils import np_utils
from sklearn.preprocessing import LabelEncoder
labelenc = LabelEncoder()
y_enc = labelenc.fit_transform(y)
y_onehot = np_utils.to_categorical(y_enc)
y_onehot