Useful general purpose scripts written in Bash or Python
Description Script gets selected number of lines from one file and append those lines to other file.
Usage:
appendText <inputFile> <outputFile> <numberOfLines>
- inputFile - files where lines should be get from
- outputFile - files where lines should be appended to
- outputFile - number of lines from inputFile which should be appended
to outputFile
Example:
appendText input.txt output.txt 2
- This will copy first 2 lines from input file and will append them to output.txt
Description Script which can assure that some application is still working. If application crashes, this script restart it.
Configuration: There are few configuration variables withing application_controller file which should be set up:
- CHECKINGPERIOD - interval (in seconds) where controller check whether application is working
- MYEMAIL - email where notification about application crash and restarting should be send (you have to have configured mail app to receive mail notifications)
Usage:
application_controller <APPLICATION_NAME>
- APPLICATION_NAME - name of application which should be checked by controller.
Example:
application_controller asterisk
If we select asterisk APPLICATION_NAME then our script will check if asterisk is still working. If asterisk crashes, this controller restarts asterisk.
Description Doing backup of selected file copying it and appending .bkp to the name. It simplifying working with copies of file when we would like to override it temporary.
Usage:
bkp <fileName>
- fileName - name of file which should be backed up
Example:
bkp input.txt
This will copy input.txt file to input.txt.bkp, so we can test something with input.txt file having it backed up.
Description Appliation allows change dependencies and version of dependencies in .deb file
Usage:
change_dependencies_in_debs <debFile.deb>
- debFile.deb - deb file where we would like to change dependencies
Example:
change_dependencies_in_debs skype.deb
After invoking above command application will extract skype.deb and will open
control file (file where dependencies are saved) in vim editor. You can change
those dependencies and save control file. After that, script will create
skype.deb.modified.deb containing modified dependencies.
Description Changes selected text to another selected text in all files in selected directory recursively.
Usage:
change_text_recursively <dir> <replaceeText> <replacerText>
- dir - directory which will be search (recursively) for files to exchange replaceeText text
- replaceeText - old text which should be replaced
- replacerText - new text which should be put instred of replaceeText
Example:
change_text_recursively ./myDir before after
Execution of this example will search word before in all files being within myDir
and replace each occurance of that word with after text.
Description Changes extension of selected files in current directory.
Usage:
changeExtension <oldExtension> <newExtension>
- oldExtension - old extension of files which should be replaced
- newExtension - new extension which should be assigned to files having oldExtension
Example:
changeExtension JPG jpg
Invoking of this example will change all files from current directory having extension
'JPG' to files to files having extension 'jpg'
Description This script allows connect remote resources (ex. hard drive or directory) through SSHFS protocol.
Configuration: before we will use this script we need to configure them. There are 5 options to configure at the beginning of script code:
- SERVER_USER - username of remote computer which we would like to use to connect remote resources through SSH
- SERVER_IP - IP address of remote computer which we would like to connect through SSH
- SERVER_PATH - path of resources on remote maching which we would like to connect through SSH
- MOUNT_POINT - local point where remote resources should be connect to
- OPTIONS - additional options of SSH connection
Usage:
connectSSHFSRemoteResource
This usage will connect remote resources according to SERVER_USER, SERVER_IP,
SERVER_PATH configuration to selected MOUNT_POINT on local computer.
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description Create SVN repository for selected PROJECT_NAME on local server's directory /home/svn/PROJECT_NAME
Usage:
createSVNRepository PROJECT_NAME
- PROJECT_NAME - name of project and directory of SVN repository
Example:
createSVNRepository usefulScripts
This creates SVN repository in directory /home/svn/usefulScripts.
Repository is ready to check in and check out without authentication.
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example:
Description TODO
Usage:
Example:
Output of example: