Skip to content

Instantly share code, notes, and snippets.

# app/services/PushNotifier
def self.sendPush(user)
@message = get_message()
if user.notification_data_id.present?
@notification_data = NotificationData.find(user.notification_data_id)
Webpush.payload_send(endpoint: @notification_data.endpoint,
message: @message,
p256dh: @notification_data.p256dh_key,
auth: @notification_data.auth_key,
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install build-essential cmake pkg-config
$ sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
//Update existings packages
$ sudo apt-get update
$ sudo apt-get upgrade
//Install developers tools, including cmake
$ sudo apt-get install build-essential cmake pkg-config
//Install some image I/O packages for loading images
$ cd ~
//download and unzip opencv
$ wget -O opencv.zip https://github.com/Itseez/opencv/archive/3.1.0.zip
$ unzip opencv.zip
//download and unzip opencv contributions
$ wget -O opencv_contrib.zip https://github.com/Itseez/opencv_contrib/archive/3.1.0.zip
// install pip
$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python get-pip.py
// install virtualenv
$ sudo pip install virtualenv virtualenvwrapper
$ sudo rm -rf ~/.cache/pip
# virtualenv and virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
//If you are using python 2
$ mkvirtualenv cv -p python2
//If you are using python 3
$ mkvirtualenv cv -p python3