Skip to content

Instantly share code, notes, and snippets.

@4noha
Last active April 27, 2018 01:22
Show Gist options
  • Save 4noha/fa52119780b01d874c6c8acc9d3df38c to your computer and use it in GitHub Desktop.
Save 4noha/fa52119780b01d874c6c8acc9d3df38c to your computer and use it in GitHub Desktop.
# install nvm for system-wide
sudo apt install git
cd /usr/local
git clone git://github.com/creationix/nvm.git nvm
. /usr/local/nvm/nvm.sh
sudo emacs /etc/profile.d/nvm.sh
>
source /usr/local/nvm/nvm.sh
>
visudo
>
#Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Defaults env_keep += "PATH"
>
sudo -s
. /usr/local/nvm/nvm.sh
nvm install v9.11.1
wget https://github.com/nokkii/dash_function/archive/master.zip
unzip master.zip
rm master.zip
mv dash_function-master dash_function
cd dash_function
apt-get install libpcap-dev mysql-server
mysql -u root -p
> for mariaDB
CREATE DATABASE button_listener;
USE button_listener;
CREATE TABLE buttons ( mac_address char(17) UNIQUE, owner text );
CREATE TABLE scripts ( name varchar(191) UNIQUE, mac_address char(17), init text, body text );
use mysql;
update user set authentication_string=password(''), plugin='mysql_native_password' where user='root';
exit
>
service mysql restart
sudo npm init
sudo npm install node-dash-button
sudo npm install mysql
sudo npm install request
emacs dash_function.js
>
const SQL_PASSWORD = '';
button_listener = DashButton( [params.mac_address], "wlan0", null, 'all' );
>
node dash_function.js
# browse http://rasppiurl:8888
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment