Skip to content

Instantly share code, notes, and snippets.

View njokdan's full-sized avatar
🏠
Working from home

Daniel Njoku njokdan

🏠
Working from home
View GitHub Profile
@njokdan
njokdan / app.js
Created January 27, 2022 10:59 — forked from JaniKibichi/app.js
Sample code about uploading pictures to cloudinary using multer - NodeJs ExpressJS Framework
'use strict';
var express = require("express");
var multer = require('multer');
var app = express();
var options = require('./config/config')
var mongoose = require('mongoose');
/* photo manenos */
var cloudinary = require('cloudinary');
@njokdan
njokdan / nginxproxy.md
Created January 27, 2022 10:57 — forked from JaniKibichi/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@njokdan
njokdan / nginx.conf
Created January 27, 2022 10:57 — forked from JaniKibichi/nginx.conf
Configuring Nginx for HTTPS - Ubuntu 16.04 LTS
#Start of server blocks
# HTTP - redirect all requests to HTTPS:
server {
listen 80;
#listen [::]:80 default_server ipv6only=on;
server_name www.another.com another.com;
return 301 https://$server_name$request_uri;
}
@njokdan
njokdan / dbconnect.php
Created January 27, 2022 10:56 — forked from JaniKibichi/dbconnect.php
How to connect a USSD to a MYSQL DB
<?php
//Declare the Connection Credentials
$servername = 'localhost'; //or IP address for DB hosted elsewhere
$username = 'root';
$password = "";
$database = "ussd";
$dbport = 3306;
// Create connection
$db = new mysqli($servername, $username, $password, $database, $dbport);
// Check connection, if there is an error end the USSD connection
@njokdan
njokdan / nginxforvar.conf
Created January 27, 2022 10:56 — forked from JaniKibichi/nginxforvar.conf
https for var/www sites
#Start of server blocks
# HTTP - redirect all requests to HTTPS:
server {
listen 80;
#listen [::]:80 default_server ipv6only=on;
server_name hey.another.com;
return 301 https://$server_name$request_uri;
}
@njokdan
njokdan / nginx-hhvm.conf
Created January 27, 2022 10:55 — forked from JaniKibichi/nginx-hhvm.conf
Nginx Config with HHVM
#Start of server blocks
# HTTP - redirect all requests to HTTPS:
server {
listen 80;
#listen [::]:80 default_server ipv6only=on;
server_name another.com;
return 301 https://$server_name$request_uri;
}
@njokdan
njokdan / atgateway1.php
Created January 27, 2022 10:55 — forked from JaniKibichi/atgateway1.php
Africastalking Gateway 1
<?php
/*
# COPYRIGHT (C) 2014 AFRICASTALKING LTD <www.africastalking.com>
AFRICAStALKING SMS GATEWAY CLASS IS A FREE SOFTWARE IE. CAN BE MODIFIED AND/OR REDISTRIBUTED
UNDER THE TERMS OF GNU GENERAL PUBLIC LICENCES AS PUBLISHED BY THE
FREE SOFTWARE FOUNDATION VERSION 3 OR ANY LATER VERSION
@njokdan
njokdan / atgateway2.php
Created January 27, 2022 10:55 — forked from JaniKibichi/atgateway2.php
Africastalking Gateway with Payments
<?php
/*
# COPYRIGHT (C) 2014 AFRICASTALKING LTD <www.africastalking.com>
AFRICAStALKING SMS GATEWAY CLASS IS A FREE SOFTWARE IE. CAN BE MODIFIED AND/OR REDISTRIBUTED
UNDER THE TERMS OF GNU GENERAL PUBLIC LICENCES AS PUBLISHED BY THE
FREE SOFTWARE FOUNDATION VERSION 3 OR ANY LATER VERSION
@njokdan
njokdan / SMSCallback.php
Created January 27, 2022 10:54 — forked from JaniKibichi/SMSCallback.php
What you have on the callback.
<?php
$Sender = $_POST['from'];
$to = $_POST['to'];
$text = $_POST['text'];
$date = $_POST['date'];
$id = $_POST['id'];
$linkId = $_POST['linkId']; //This works for onDemand subscription products
//Sending Messages using sender id/short code
@njokdan
njokdan / MTSMSCallback.php
Created January 27, 2022 10:54 — forked from JaniKibichi/MTSMSCallback.php
A callback code for Handling MT Shortcodes
<?php
require_once(‘DBConn.php’); //this is your Database connection information, where you also abstract $apiUsername, $apikey
require_once(‘AfricasTalkingGateway.php’);
//next we receive notification from API
//and read in post params to our variables
$apiUsername =’XXXXX’;