Skip to content

Instantly share code, notes, and snippets.

@olupotd
olupotd / gist:7655081
Created November 26, 2013 08:29
A simple commanding manager for your apps.
#!flask/bin/python
from migrate.versioning import *
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from app import db
import os.path
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
@olupotd
olupotd / Client_Server_Communicatio
Created December 2, 2013 07:20
A simple technique of retrieving all the document keys in a couchdb app
import java.io.*
class Client_Server_Communication
{
private static String msg = "";
private static Socket socket;
private static ServerSocket sever;
static DataInputStream in;
static DataOutputStream out;
@olupotd
olupotd / DataStructures
Last active December 30, 2015 08:39
Simple Data Structures and Algorithms implementation
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class DataStructures {
//declared an array of
Object[] orderedList = {20,45,51,78,84,91,98};
int[] elems = {10,15,77,92,200};
List<Integer> list = new ArrayList<Integer>();
@olupotd
olupotd / Simple
Last active December 30, 2015 08:49
A much simpler version of the Whole Application. Data structures
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.commons.lang3.ArrayUtils;
/*
NB You shall need the org.apache.commons library installed on your system.
Get it from here or run this http://github.com/olupotd/installApache.sh script
like this if you are using Linux.
wget -c http://mirror.ucu.ac.ug/apache//commons/lang/binaries/commons-lang3-3.1-bin.tar.gz && tar -zxvf commons-lang3-3.1-bin.tar.gz
Go to your project properties and add it to them or just paste the jar files in your libs files in the Java Folder.
@olupotd
olupotd / Bubble
Created December 5, 2013 14:31
Bubble sort in C++
#include<iostream>
using namespace std;
int numb[20];
int i (0), j (0), temp;
int main(int argc, char* argv[])
{
while(i < sizeof(numb)){
numb[i] = i+2;
@olupotd
olupotd / BubbleSort
Created December 5, 2013 14:36
Bubble Sort in C
#include<stdio.h>
int numb[8];
int i, j, temp;
int main(int argc, char* argv[])
{
//populate the array
while(i < sizeof(numb)){
numb[i] = i+2;
@olupotd
olupotd / Selection
Created December 5, 2013 14:41
Selection Sort in C
#include <stdio.h>
int main()
{
int array[100], n, c, d, position, swap;
printf("Enter number of elements\n");
scanf("%d", &n);
@olupotd
olupotd / Insertion
Created December 5, 2013 14:45
Insertion Sort in Brief
Here's the algorithm for this type of sort. please implement it also
so that you can learn. Thanks.
function insertionSort(array A)
for i from 1 to length[A]-1 do
value := A[i]
j := i-1
while j >= 0 and A[j] > value do
A[j+1] := A[j]
j := j-1
@olupotd
olupotd / Binary
Created December 5, 2013 15:12
Binary Search
#include <stdio.h>
int main()
{
int c, first, last, middle, n, search, array[100];
printf("Enter number of elements\n");
scanf("%d",&n);
@olupotd
olupotd / Listing
Created December 5, 2013 16:58
Linked List
import java.util.*;
public class Listing {
LinkedList ll = new LinkedList();
Listing()
{
//adding an item to the list
l.add(3);
l.add(2);