Skip to content

Instantly share code, notes, and snippets.

View raybesiga's full-sized avatar

Ray Besiga raybesiga

View GitHub Profile
@raybesiga
raybesiga / restart_bluetooth.sh
Created January 17, 2019 12:48 — forked from nicolasembleton/restart_bluetooth.sh
Restart Bluetooth Daemon on Mac OS X without restarting
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@raybesiga
raybesiga / gist:c3601b30d8f07ea9545ace3ea6e0964a
Created August 13, 2018 19:09
Symlinking jekyll build to static folder
ln -s /var/www/prod/{project}/_site /var/www/prod/static_files/{project}
@raybesiga
raybesiga / scp-remote-local
Created August 13, 2018 05:58
Using SCP from remote to 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
@raybesiga
raybesiga / script.sh
Created July 11, 2018 16:03 — forked from vielhuber/script.sh
PostgreSQL: Backup and restore pg_dump with password on command line #sql
# best practice: linux
nano ~/.pgpass
*:5432:*:username:password
chmod 0600 ~/.pgpass
# best practice: windows
edit %APPDATA%\postgresql\pgpass.conf
*:5432:*:username:password
# linux
@raybesiga
raybesiga / manual deployment script django project
Created June 26, 2018 14:32
Manual deployment script for django project on Ubuntu production server
ssh server
cd /var/www/prod/{project}
source /opt/venvs/{project}/bin/activate
sudo -u www-data git pull origin master
python manage.py collectstatic
sudo supervisorctl restart {project}
@raybesiga
raybesiga / Python3 Virtualenv Setup.md
Created April 25, 2018 15:42 — forked from pandafulmanda/Python3 Virtualenv Setup.md
Setting up and using Python3 Virtualenv on Mac

Python3 Virtualenv Setup

Requirements
  • Python 3
  • Pip 3
$ brew install python3
@raybesiga
raybesiga / python3virtualenvmacsetup.md
Last active December 19, 2017 20:36
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
raybesiga / time_to_read_article
Created February 17, 2016 14:59
Time to read article
{% assign minutes = content | number_of_words | divided_by: 180 %}
{% if minutes == 0 %}
{% assign minutes = 1 %}
{% endif %}
@raybesiga
raybesiga / gist:0ad45684f189e9c41689
Created February 8, 2016 07:31 — forked from digitaljhelms/gist:4287848
Git/GitHub branching standards & conventions

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch
@raybesiga
raybesiga / Create Teachers Weekly Script
Last active December 11, 2015 11:28
Management command to generate new scripts
import datetime
import logging
import itertools
from logging import handlers
from django.core.management.base 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