Skip to content

Instantly share code, notes, and snippets.

View b4oshany's full-sized avatar

Oshane Bailey b4oshany

View GitHub Profile
@b4oshany
b4oshany / mongodb_installer.sh
Created November 5, 2015 16:55
Install Mongodb on Ubuntu
# Import the public key used by the package management system.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
# Create a list file for MongoDB
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
# Reload local package database.
sudo apt-get update
# Install the MongoDB packages.
@b4oshany
b4oshany / subprocess.php
Created November 21, 2015 16:07
PHP subprocess
<?php
/**
* @author Ashraf M Kaabi
* @name Advance Linux Exec
*/
class Process {
/**
* Run Application in background
*
* @param unknown_type $Command
@b4oshany
b4oshany / christmas_weekend_dates.py
Created January 2, 2016 21:21
Print the next 100 Christmas weekend dates
from datetime import datetime, timedelta, date
dates = []
today = datetime.today()
years = ["25/12/%d" % x for x in xrange(today.year, today.year + 101) if date(x, 12, 25).weekday() == 3]
print years
@b4oshany
b4oshany / .gitignore
Created January 14, 2016 02:27
kotti gitignore
# Ignore files
*.pyc
*.pyo
*.db
*.log
*.swp
*.swo
*~
*.orig
*.eggs
@b4oshany
b4oshany / postgress-install.sh
Last active January 23, 2016 18:43
Postgres Installation Script
#!/bin/bash
# Install postgress server locally
sudo apt-get install postgresql postgresql-contrib
# Install PostGIS, procedural languages, client interfaces, etc
sudo apt-cache search postgres
# Install PGAdmin or Postgres UI, which is similar to PHPMyAdmin.
sudo apt-get install pgadmin3
@b4oshany
b4oshany / binary_search.py
Created March 18, 2016 22:48
Search Algorithm
def binary_search(lst, comparator):
"""Perform a binary search of the given list based on the given comparator
Arguments:
lst (list):
List of items to search through.
comparator (function):
Reference pointer for the function or method. This function should
only accept one parameter which is a signle list item. In addition,
this function should return a boolean value or none.
#!/bin/bash
function base_installer {
# Install virtualenv
if [ -z $(which virtualenv) ]; then \
sudo apt-get install python-virtualenv; \
fi
# Create virtualenv for project
if [ ! -e "bin/pip" ]; then \
virtualenv .
@b4oshany
b4oshany / ctolabel.js
Created April 7, 2016 11:21
chartist
//new chart type LineBar - its a bit like bar and line were slammed together at high speed, not pretty, but they are part of each other now
(function(){
"use strict";
var root = this,
Chart = root.Chart,
helpers = Chart.helpers;
var defaultConfig = {
@b4oshany
b4oshany / install_appengine.sh
Last active May 10, 2016 16:05
Appengine Installer.
#!/bin/bash
APPENGINE_PATH=/usr/local/google_appengine
APPENGINE_APPCFG=/usr/local/google_appengine/appcfg.py
APP_PATH=$(pwd)
USER=$(whoami)
USER_HOME=/home/${USER}
APPENGINE_DLOAD=${USER_HOME}/google_appengine_1.9.37.zip
if [ -z $(which curl) ]; then \
@b4oshany
b4oshany / importer.py
Created September 9, 2016 21:15
Modified zopyx.plone.migration importer script for plone 5
################################################################
# Poor men's Plone export
# (C) 2013, ZOPYX Ltd, D-72074 Tuebingen
################################################################
import os
import shutil
import tempfile
import glob
import transaction