Skip to content

Instantly share code, notes, and snippets.

View renatoargh's full-sized avatar
🚀

Renato Gama renatoargh

🚀
View GitHub Profile
var DeviceClient = require('tago').DeviceClient,
myDevice = new DeviceClient('YOUR-DEVICE-KEY', {
baseUrl: 'http://fabiorosa.gammasoft.com.br'
});
request = require('request');
function updateTemp(){
request.get('http://api.wunderground.com/api/YOUR-API-KEY/conditions/q/NY/New_York.json', function(err, res, body) {
if(err) {
return;
express = require("express")
request = require("request")
BufferList = require("bufferlist").BufferList
app = express.createServer(express.logger(), express.bodyParser())
app.get "/", (req, res) ->
if req.param("url")
url = unescape(req.param("url"))
request
uri: url
encoding: 'binary'
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
@renatoargh
renatoargh / mysql-installation-script.sh
Last active August 29, 2015 14:01
MySql installation script for AmazonLinux EC2
cd
sudo yum upgrade -y
sudo yum install mysql -y
sudo yum install mysql-server -y
sudo /etc/init.d/mysqld start
mysqladmin -u root password 'Senha'
sudo chkconfig mysqld on
# my.cnf should be located at; /etc/my.cnf
# add the following line to
@renatoargh
renatoargh / confNginx.nginx
Last active August 29, 2015 14:01
Configuração básica do NGINX
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@renatoargh
renatoargh / nodejs.sh
Last active August 29, 2015 14:02
Raspberry PI nodejs installation
Com um pi novo, é preciso fazer é inicialmente instalar o SO,
para isso é necessário ligar o pi a um teclado e um monitor, e fazer o boot
com o cartao de memoria contendo o NOOBS.
Depois disso, ainda com o teclado e monitor ligados é necessário configurar o rasp para
aceitar conexões SSH, apartir do comando `raspi-config`.
Depois disso toda a instalação e configuração pode ser feita via SSH.
É importante configurar um hostname adequado

End of the line
CTRL + E

Start of the line
CTRL + A

Jump cursor a word fowards/backwards
OPTION + LEFT or OPTION + RIGHT

var parsers = require("serialport").parsers;
var SerialPort = require("serialport").SerialPort;
var serialPort = new SerialPort("/dev/ttyUSB0", {
parser: parsers.readline("\n"),
databits: 7,
baudrate: 4800
}, false); // this is the openImmediately flag [default is true] - se setado para false é necessario chamar .open manualmente
serialPort.open(function () {
function GetEmailParts( strEmail ){
// Set up a default structure with null values
// incase our email matching fails.
var objParts = {
user: null,
domain: null,
ext: null
};
// Get the parts of the email address by leveraging
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script>