This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Promise = require('bluebird') | |
var fs = require('fs'); | |
Promise.promisifyAll(fs); | |
fs.readFile("bb", function(err, data) { | |
if (err) return next(err); | |
fs.writeFile("bba", data, function() { | |
console.log("File written"); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Receiver{ | |
final GpioController gpio; | |
final GpioPinDigitalOutput pin; | |
{ | |
gpio = GpioFactory.getInstance(); | |
pin = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Relay"); | |
} | |
public void run(String message){ | |
System.out.println("Message received "+message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void run() { | |
dhtSensor.read(); | |
float temperature = dhtSensor.getTemperature(false); | |
int humidity = dhtSensor.getHumidity(); | |
try { | |
String message = "Temperature:" + Float.toString(temperature); | |
String humidityMsg = "Humidity:" + Integer.toString(humidity); | |
mqttClient.publish(1,message.getBytes()); | |
} catch (MqttException e) { | |
e.printStackTrace(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"memory_info": { | |
"sdram_p_volate": 1.23, | |
"sdram_c_volate": 1.2, | |
"used_memory": 150163456, | |
"shared_memory": 0, | |
"total_memory": 459505664, | |
"sdram_i_volate": 1.2, | |
"cached_memory": 100642816, | |
"memory_buffers": 15024128, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sensible_time() { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var data = sheet.getActiveRange().getValues(); | |
for (var i = 0; i < data.length; i++) { | |
for (var j = 0; j < data[i].length; j++) { | |
if (data[i][j]) { | |
var range = sheet.getRange(24+i, j+1); | |
time = data[i][j]; | |
var mins = ~~(time / 60); | |
var secs = time % 60; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getAddress = function(transport){ | |
var process = require("process"), | |
host = process.getProperty('server.host'), | |
ip = process.getProperty('carbon.local.ip'); | |
var log = new Log(); | |
var port; | |
if(transport=="http"){ | |
port = process.getProperty('mgt.transport.http.proxyPort'); | |
if(!port){ | |
//can use http.port as well |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var url = "https://api.twitter.com/1/statuses/user_timeline.json"; | |
var data = { include_entities:true,include_rts:true,screen_name:"wso2",count:1 }; | |
var twitterJson = get(url, data ,"json", function(data, xhr){ | |
print(data); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Merge development branch to master branch | |
function merge_projects(){ | |
# Path to child project | |
cd /Users/dulitharasangawijewantha/Development/WSO2/apps/mdm | |
git checkout master | |
git pull origin master | |
git merge $1 | |
git push origin master | |
} | |
# Get updates from master for child projects in parent project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PRODUCT_HOME="$1" | |
IOS_CERTS="$2" | |
IP="$3" | |
PRODUCT_CONF="$4" | |
CONFIG_FILE="./openssl_custom.cnf" | |
TEMP_FOLDER="./temp" | |
PUSH_CERT="`echo $IOS_CERTS`pushcert.pfx" | |
PUSH_PASS="" | |
MDM_CERT="`echo $IOS_CERTS`PlainCert.pfx" | |
MDM_PASS="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.script.ScriptEngine; | |
import javax.script.ScriptEngineManager; | |
import javax.script.ScriptException; | |
public class RhinoEngine { | |
public static void main(String[] args) { | |
ScriptEngineManager mgr = new ScriptEngineManager(); | |
ScriptEngine engine = mgr.getEngineByName("JavaScript"); | |
try { | |
engine.put("name", args[0]); |