Skip to content

Instantly share code, notes, and snippets.

View jeanfbrito's full-sized avatar
🌱
Seeding the future!

Jean Brito jeanfbrito

🌱
Seeding the future!
View GitHub Profile
load 'deploy'
load 'deploy/assets' # Assets pipeline for Rails application
load 'config/deploy'
@jeanfbrito
jeanfbrito / server.md
Last active December 19, 2015 00:18
Ubuntu with Nginx + Ruby 2.0.0 + PostgreSQL 9.2 + Passenger + Papistrano

Ubuntu with Nginx + Ruby 2.0.0 + PostgreSQL 9.1 + Passenger + Papistrano

Update the system

sudo apt-get update

Install some dependencies

How to use a PS3 controller on Mac OS X 10.7 (Lion)

  1. Open Apple menu -> System Preferences -> Bluetooth and disable Bluetooth on Mac as well as any other nearby Macs or devices which will try to pair with and confuse the controller.

  2. Reset PS3 controller by inserting paperclip into pinhole near L2 button.

  3. Connect PS3 controller to Mac with USB cable.

  4. Enable Bluetooth.

// The received message is stored in 'msg'
// It will have at least a 'payload' property:
// console.log(msg.payload);
// The 'context' object is available to store state
// between invocations of the function
// context = {};
//expects JSON payload and destination specified in topic
var key = "your api key here";
-- Your access point's SSID and password
local SSID = "greenhouse"
local SSID_PASSWORD = "senhasupersecreta"
local DEVICE = "undefined"
local temperature = 27.5
local timesRunned = 0
-- configure ESP as a station
wifi.setmode(wifi.STATION)
wifi.sta.config(SSID,SSID_PASSWORD)
@jeanfbrito
jeanfbrito / bh1750.lua
Last active February 1, 2016 03:49
ESP8266 BH1750FVI Test
-- ***************************************************************************
-- BH1750 module for ESP8266 with nodeMCU
-- BH1750 compatible tested 2015-1-22
--
-- Written by xiaohu
--
-- MIT license, http://opensource.org/licenses/MIT
-- ***************************************************************************
local moduleName = ...
local M = {}
@jeanfbrito
jeanfbrito / main.js
Created February 17, 2016 17:04
Xadow ADXL345 + OLED display working
// Load accelerometer
var adxl345 = require('jsupm_adxl345');
// Instantiate on I2C bus
var adxl = new adxl345.Adxl345(0);
// Initialize the hardware device
var screen = new (require("jsupm_i2clcd").SSD1308)(0, 0x3C);
// Displays a message on the OLED display
@jeanfbrito
jeanfbrito / README.md
Created August 21, 2016 04:22 — forked from foosel/README.md
First experiments with NodeMCU to publish the current settings of my adjustable height working desk to MQTT

First experiments with NodeMCU to publish the current settings of my adjustable height working desk to MQTT.

NodeMCU can be found here: https://github.com/nodemcu/nodemcu-firmware

Note that you'll need a current version with support for floats (which the ultrasonic sensor library utilizes), I'm using 0.9.5 2015-03-18 with float support myself.

Support for the HC-SR04 sensor in NodeMCU can be found here: https://github.com/sza2/node_hcsr04

I provided my slightly adjusted version which makes measuring a non-blocking afair, allowing for callbacks when the measurement completes.

@jeanfbrito
jeanfbrito / restAPI.markdown
Created October 31, 2016 15:54 — forked from iksose/restAPI.markdown
Creating a REST API using Node.js, Express, and MongoDB

###Creating a REST API using Node.js, Express, and MongoDB

####Installing Node.js

Go to http://nodejs.org, and click the Install button. Run the installer that you just downloaded. When the installer completes, a message indicates that Node was installed at /usr/local/bin/node and npm was installed at /usr/local/bin/npm. At this point node.js is ready to use. Let’s implement the webserver application from the nodejs.org home page. We will use it as a starting point for our project: a RESTful API to access data (retrieve, create, update, delete) in a wine cellar database.

Create a folder named nodecellar anywhere on your file system. In the wincellar folder, create a file named server.js.

@jeanfbrito
jeanfbrito / 00.howto_install_phantomjs.md
Created December 18, 2016 23:30 — forked from julionc/00.howto_install_phantomjs.md
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev