Skip to content

Instantly share code, notes, and snippets.


Ray Besiga raybesiga

View GitHub Profile
raybesiga / unload-keyboard
Last active Aug 29, 2015 — forked from JohnMurray/unload-keyboard
Disable Mac OS X Keyboard (built-in only)
View unload-keyboard
# Unload the keyboard so I can use my external keyboard
# and not worry about accidentally pressing buttons on
# the built-in. This may not be a problem for you but, you
# should see my desk sometimes (Oh no!!) ;-)
sudo kextunload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/
raybesiga / gist:6ed1a9bcaf079df67ee6
Created Nov 2, 2015 — forked from TimFletcher/gist:034e799c19eb763fa859
Django template filter to add attributes to form fields
View gist:6ed1a9bcaf079df67ee6
# From
from django import template
register = template.Library()
def add_attributes(field, css):
attrs = {}
definition = css.split(',')
raybesiga / Create Teachers Weekly Script
Last active Dec 11, 2015
Management command to generate new scripts
View Create Teachers Weekly Script
import datetime
import logging
import itertools
from logging import handlers
from import BaseCommand
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from django.core.mail import send_mail
from django.conf import settings
from django.template import Context, Template
raybesiga / gist:0ad45684f189e9c41689
Created Feb 8, 2016 — forked from digitaljhelms/gist:4287848
Git/GitHub branching standards & conventions
View gist:0ad45684f189e9c41689


Quick Legend

Instance Branch Description, Instructions, Notes
View time_to_read_article
{% assign minutes = content | number_of_words | divided_by: 180 %}
{% if minutes == 0 %}
{% assign minutes = 1 %}
{% endif %}
raybesiga /
Last active Dec 19, 2017
Python3 setup and virtualenvs the easy way

Setting up Python3

$ brew install python3

You should then check which version is installed

$ python3 --version

Once Python3 is installed, it comes with Pip3

raybesiga / Python3 Virtualenv
Created Apr 25, 2018 — forked from pandafulmanda/Python3 Virtualenv
Setting up and using Python3 Virtualenv on Mac
View Python3 Virtualenv

Python3 Virtualenv Setup

  • Python 3
  • Pip 3
$ brew install python3
raybesiga / manual deployment script django project
Created Jun 26, 2018
Manual deployment script for django project on Ubuntu production server
View manual deployment script django project
ssh server
cd /var/www/prod/{project}
source /opt/venvs/{project}/bin/activate
sudo -u www-data git pull origin master
python collectstatic
sudo supervisorctl restart {project}
raybesiga /
Created Jul 11, 2018 — forked from vielhuber/
PostgreSQL: Backup and restore pg_dump with password on command line #sql
# best practice: linux
nano ~/.pgpass
chmod 0600 ~/.pgpass
# best practice: windows
edit %APPDATA%\postgresql\pgpass.conf
# linux
raybesiga / scp-remote-local
Created Aug 13, 2018
Using SCP from remote to local
View scp-remote-local
## To copy a file from remote to local
`scp user@remote:/foo/bar/folder /home/bar/folder`
## To copy a folder from remote to local
`scp -r user@remote:/foo/bar/folder /home/bar/folder`
This uses a recursive copy