Skip to content

Instantly share code, notes, and snippets.

Nicholas Cole ncole458

Block or report user

Report or block ncole458

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ncole458 /
Created Sep 15, 2019
PostgreSQL Cheatsheet

change to postgres user and open psql prompt

sudo -u postgres psql postgres

list databases

postgres=# \l

list roles

ncole458 / .gitignore
Created Mar 4, 2019
Python/Django .gitignore
View .gitignore
### Virtualenv
### PyCharm
### Python
# test .encode() and str()
a_string = 'test éurope'
print('a_string normal: ', a_string)
a_string = 'test éurope'
print('a_string utf-8 encoded: ', a_string.encode('utf-8')) # utf-8 is default so .encode() is same result
print('a_string ascii encoded: ', a_string.encode('ascii', 'replace')) # with error, i.e. replace, ignore etc.
print('a_string str: ', str(a_string))
company = 'éuropean company'
pro_comp_name = 'a løng campaigné name'
ncole458 / Ember.js
Created Oct 18, 2018
Ember.js fix node/bower cache issues
View Ember.js
# sometimes Ember builds break due to npm &/or bower cache, node changes etc.
# running below usually fixing any cache issues
rm -rf node_modules/ bower_components/ tmp/ dist/
npm cache clear
bower cache clear
npm install && bower install
ember s
ncole458 / ssl.txt
Last active Sep 15, 2018
TLS/SSL Certificate Generation & Installation
View ssl.txt
# create the cert key request
openssl req -newkey rsa:2048 -nodes -keyout -out
# concat the bundle and certs
cat domain_com.crt > website-bundle.crt
# SSL checker for after install
ncole458 / docker.txt
Last active Oct 15, 2018
Docker commands
View docker.txt
# view container instances
docker container ls
# activate instance, i.e. nginx, django etc.
docker exec -i -t be821b60fa28 /bin/bash
ncole458 / remote-my-sql-ec2-etc.txt
Created Jun 4, 2018
Grant remote access to MySQL database
View remote-my-sql-ec2-etc.txt
# Edit /etc/mysql/my.cnf, and change the binding address to
bind-address =
# then restart mysql server
$ sudo /etc/init.d/mysql restart
ncole458 / default
Created May 2, 2018
React app breaks on refresh NGINX
View default
# update the location blocks try_files in your /sites-available/default
location / {
try_files $uri $uri/ /index.html$is_args$args;
ncole458 / mime.types
Last active Apr 18, 2018
Fix Nginx fonts not working
View mime.types
# add below to /etc/nginx/mime.types
application/x-font-ttf ttc ttf;
application/x-font-otf otf;
application/font-woff woff;
application/font-woff2 woff2;
application/ eot;
# add below to /sites/available/your-site
location ~* \.(eot|otf|ttf|woff|woff2)$ {
add_header Access-Control-Allow-Origin *;
ncole458 / cli.txt
Last active May 19, 2018
WordPress FTP permissions on VPS/EC2 etc
View cli.txt
# allow WP to FTP/access core/plugin folders
sudo chown -R www-data /var/www/html
# always set back when done
sudo chown -R sammy /var/www/html
# restart PHP on Ubuntu
sudo service php7.0-fpm restart
You can’t perform that action at this time.