Skip to content

Instantly share code, notes, and snippets.

@pasindud
pasindud / ussd.php
Created December 26, 2014 16:07
Ideamart USSD Snippet
<?php
$url="http://localhost:7000/ussd/send";
sendUSSD($url,"APP_001","password","Hello World","tel:94771231234","1","mt-cont","440");
function sendUSSD($url,$appid,$password,$message,$address,$seesionid,$ussdOperation,$encoding)
{
$arrayField = array("applicationId" => $appid,
@pasindud
pasindud / sms.php
Created December 26, 2014 16:06
Ideamart SMS Snippet
<?php
$url="http://api.dialog.lk:8080/sms/send"
sendSMS($url,"Hello world","0771231234","APP_000001","password");
function sendSMS ($url,$message,$addresses,$appid,$password){
$req = array("message"=>$message,
"destinationAddresses"=>$addresses,
$appid = "APP_000001";
$apppassword = "password";
try {
$receiver = new SMSReceiver();
$address = $receiver->getAddress();
$message = $receiver->getMessage();
// Setting up CAAS
$cass = new DirectDebitSender("http://127.0.0.1:7000/caas/direct/debit",$appid,$apppassword);
$sender = new SmsSender("http://localhost:7000/sms/send", $appid,$apppassword);
try {
@pasindud
pasindud / proxy.php
Last active August 29, 2015 14:10
Ideamart Proxy
<?php
// Use this like this
// proxy.php?url=
$ch = curl_init( $_GET['url']);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POSTFIELDS, file_get_contents('php://input'));
@pasindud
pasindud / listop_backup
Created September 28, 2014 11:21
listop_backup_installer
http://54.210.239.96:5050/api/v1/npm/install/listop-sms
http://54.210.239.96:5050/api/v1/npm/install/listop-github
http://54.210.239.96:5050/api/v1/npm/install/listop-youtube
http://54.210.239.96:5050/api/v1/npm/install/listopio-rss
http://54.210.239.96:5050/api/v1/npm/install/listop-wolfram
@pasindud
pasindud / listopnpminstaller
Created September 28, 2014 11:11
listop installer
http://54.68.114.161:5050/api/v1/npm/install/listop-sms
http://54.68.114.161:5050/api/v1/npm/install/listop-github
http://54.68.114.161:5050/api/v1/npm/install/listop-youtube
http://54.68.114.161:5050/api/v1/npm/install/listopio-rss
http://54.68.114.161:5050/api/v1/npm/install/listop-wolfram
@pasindud
pasindud / asd
Created September 28, 2014 10:16
list
I need to see my #ec2/ec2publicips
calories in a red bull #wolfram/ask
intercepts of (x^2+2)(x^2-1) #wolfram/ask:processing
recent wso2 blogposts #rss/wso2
jehanr shit sri lankan mothers say #youtube/search
apt-get update
apt-get install git
apt-get install nodejs
apt-get install npm
git clone https://github.com/listopio/varys
var Docker = require('dockerode');
var docker = new Docker({ host: 'http://192.168.59.103' , port : 2375});
docker.run('ncthis/ceresi', [], process.stdout, function (err, data, container) {
console.log(data,container);
docker.listContainers(function (err, containers) {
console.log(containers);
function reciveUssd() {
$array = json_decode(file_get_contents('php://input'), true);
if (!((isset($array['sourceAddress']) && isset($array['message'])))) {
throw new Exception("Some of the required parameters are not provided");
} else {
$responses = array("statusCode" => "S1000", "statusDetail" => "Success");
header("Content-type: application/json");
echo json_encode($responses);
}