Skip to content

Instantly share code, notes, and snippets.

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

John Kagga jokamjohn

🏠
Working from home
View GitHub Profile
@jokamjohn
jokamjohn / Carbon PHP Time Methods
Last active October 1, 2015 20:09
Php Carbon Extension for the Date.....Some of the cool methods
<?php
require 'vendor/autoload.php';
/**
* Created By John Kagga
* Some of the carbon time methods
* Play around with them
*
**/
use Carbon\Carbon;
@jokamjohn
jokamjohn / kannel.conf
Created October 8, 2015 08:32 — forked from tobiasmcnulty/kannel.conf
Sample Kannel configuration for talking to RapidSMS server
#
# CONFIGURATION FOR USING SMS KANNEL WITH RAPIDSMS
#
# For any modifications to this file, see Kannel User Guide
# If that does not help, see Kannel web page (http://www.kannel.org) and
# various online help and mailing list archives
#
# Notes on those who base their configuration on this:
# 1) check security issues! (allowed IPs, passwords and ports)
# 2) groups cannot have empty rows inside them!
@jokamjohn
jokamjohn / subscribe.php
Created October 19, 2015 08:01
Code to subscribe a number on the AfricasTalking API
<?php
require_once "AfricasTalkingGateway.php";
//Specify your credentials
$username = "myAfricasTalkingUsername";
$apiKey = "myAfricasTalkingAPIKey";
// Specify the number that you want to subscribe
// Please ensure you include the country code (+254 for Kenya in this case)
<?php
require_once(‘AfricasTalkingGateway.php’);
//next we receive notification from API
//and read in post params to our variables
$apiUsername =config('sms.username');
$apikey =config('sms.api_key');
@jokamjohn
jokamjohn / complex.java
Created November 16, 2015 13:07
Complex number class
/*************************************************************************
* Compilation: javac Complex.java
* Execution: java Complex
*
* Data type for complex numbers.
*
* The data type is "immutable" so once you create and initialize
* a Complex object, you cannot change it. The "final" keyword
* when declaring re and im enforces this rule, making it a
* compile-time error to change the .re or .im fields after
@jokamjohn
jokamjohn / DFT.java
Created November 16, 2015 16:48
Method one. Try following up
/**
* Created by jokamjohn on 11/16/2015.
*/
//This is a sample program to calculate a DFT Coefficients using the formula
import java.util.Scanner;
public class DFT
{
double real, img;
public DFT()
@jokamjohn
jokamjohn / Test.java
Created November 16, 2015 16:49
Method two...Looks promising
/**
* Created by jokamjohn on 11/16/2015.
*/
public final class Test {
/*
* Computes the discrete Fourier transform (DFT) of the given vector.
* All the array arguments must have the same length.
*/
@jokamjohn
jokamjohn / complex.java
Created November 16, 2015 16:51
The complex number class
/*************************************************************************
* Compilation: javac Complex.java
* Execution: java Complex
*
* Data type for complex numbers.
*
* The data type is "immutable" so once you create and initialize
* a Complex object, you cannot change it. The "final" keyword
* when declaring re and im enforces this rule, making it a
* compile-time error to change the .re or .im fields after
@jokamjohn
jokamjohn / network.java
Created January 6, 2016 10:19
Check for network connectivity on android
/**
* Checking for network access
*
* @return boolean
*/
protected boolean isOnline()
{
ConnectivityManager manager = (ConnectivityManager)
getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = manager.getActiveNetworkInfo();
@jokamjohn
jokamjohn / Install Cloud9 on local or remote computer, server, or raspberry pi This gist will help you install Cloud9 on your local or remote computer, server, or even your raspberry pi. Many people are having issues at the time of this Gist's creation.
Complete installation process:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y python-software-properties python make build-essential g++ curl libssl-dev apache2-utils git libxml2-dev
sudo apt-get update
sudo apt-get upgrade
cd ~
mkdir git
cd ~/git