Coder Social home page Coder Social logo

automationworks's Introduction

AutomationWorks

Journey of Automation

For this journey we will use #!/usr/bin/env python3

We start with "Modules" as these are important components of code reuse concept. The modules are basically collection of .py files. The python files inside of a modules contain different functions. These functions can be called using the module name and . or dot notation followed by the function name.

One thing to remember, to use the module to be recognised by an interpreter we need to include " init.py " file.

Lets write some basic script to check disk usage and cpu usage. Preview the disk_cpu.py file.

diff and patch Cheat Sheet diff diff is used to find differences between two files. On its own, it’s a bit hard to use; instead, use it with diff -u to find lines which differ in two files: diff -u diff -u is used to compare two files, line by line, and have the differing lines compared side-by-side in the same output. See below:

~$ cat menu1.txt Menu1:

Apples Bananas Oranges Pears

~$ cat menu2.txt Menu:

Apples Bananas Grapes Strawberries

~$ diff -u menu1.txt menu2.txt --- menu1.txt 2019-12-16 18:46:13.794879924 +0900 +++ menu2.txt 2019-12-16 18:46:42.090995670 +0900 @@ -1,6 +1,6 @@ -Menu1: +Menu:

Apples Bananas -Oranges -Pears +Grapes +Strawberries

Patch Patch is useful for applying file differences. See the below example, which compares two files. The comparison is saved as a .diff file, which is then patched to the original file!

~$ cat hello_world.txt Hello World ~$ cat hello_world_long.txt Hello World

It's a wonderful day! ~$ diff -u hello_world.txt hello_world_long.txt --- hello_world.txt 2019-12-16 19:24:12.556102821 +0900 +++ hello_world_long.txt 2019-12-16 19:24:38.944207773 +0900 @@ -1 +1,3 @@ Hello World + +It's a wonderful day! ~$ diff -u hello_world.txt hello_world_long.txt > hello_world.diff ~$ patch < hello_world.diff patching file hello_world.txt ~$ cat hello_world.txt Hello World

It's a wonderful day!

automationworks's People

Contributors

busyb0x avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.