Sunday, April 26, 2020

AWS Lambda using Python

AWS HOWTO
https://docs.aws.amazon.com/lambda/latest/dg/getting-started.html


AWS repository
https://github.com/awsdocs/aws-lambda-developer-guide


Check prerequisities

[dave@dave ~]$ aws --version

aws-cli/2.0.1 Python/3.7.3 Linux/5.5.16-200.fc31.x86_64 botocore/2.0.0dev5

[dave@dave ~]$ python --version

Python 3.7.6

 



Python Lambda

import json

 
def lambda_handler(event, context):

    # TODO implement

    return {

        'statusCode': 200,

        'body': json.dumps('Hello from Lambda!')

    }



Get lambda in AWS CLI

[dave@dave aws-lambda-developer-guide]$  aws lambda get-function --function-name dave-test-function

{

    "Configuration": {

        "FunctionName": "dave-test-function",

        "FunctionArn": "arn:aws:lambda:eu-central-1:45454545454:function:dave-test-function",

        "Runtime": "python3.8",

        "Role": "arn:aws:iam::45454545:role/dave-lambda-role-test",

        "Handler": "lambda_function.lambda_handler",

        "CodeSize": 299,

        "Description": "",

        "Timeout": 3,

        "MemorySize": 128,

        "LastModified": "2020-04-26T07:53:06.901+0000",

        "CodeSha256": "45454545454545",

        "Version": "$LATEST",

        "TracingConfig": {

            "Mode": "PassThrough"

        },

        "RevisionId": "454545454545",

        "State": "Active",

        "LastUpdateStatus": "Successful"

    },

    "Code": {

        "RepositoryType": "S3",

        "Location": "https://awslambda-eu-cent-1-tasks.s3.eu-central-1.amazonaws.com/snapshots/454534345656/dave-test-function-456544562342423424"

    }

}

 

Thursday, April 9, 2020

Install Oracle WebLogic Server 14.1.1.0.0 on Fedora Linux

Download
https://www.oracle.com/middleware/technologies/fusionmiddleware-downloads.html

Documentation
https://docs.oracle.com/en/middleware/standalone/weblogic-server/14.1.1.0/index.html

Weblogic JDK 11 Certification

Oracle WebLogic Server 14c (14.1.1.0.0) is certified for use with JDK 11.

Supported configurations https://www.oracle.com/middleware/technologies/fusion-certification.html


Oracle JDK 11 download https://www.oracle.com/java/technologies/javase-jdk11-downloads.html

Install Oracle JDK 11 via rpm ( dnf fails on missing dependencies)

[dave@dave Downloads]$ sudo rpm -ivh  jdk-11.0.6_linux-x64_bin.rpm

warning: jdk-11.0.6_linux-x64_bin.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY

Verifying...                          ################################# [100%]

Preparing...                          ################################# [100%]

Updating / installing...

   1:jdk-11.0.6-2000:11.0.6-ga        ################################# [100%]

 

Change Java version for system

sudo alternatives --config java

There are 3 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
   1           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.fc31.x86_64/jre/bin/java)
 + 2           /usr/java/jdk1.8.0_231-amd64/jre/bin/java
*  3           /usr/java/jdk-11.0.6/bin/java

Enter to keep the current selection[+], or type selection number: 3


Verify Java version

$ java -version
java version "11.0.6" 2020-01-14 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.6+8-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.6+8-LTS, mixed mode)


Install Weblogic 14.1


$ java -jar fmw_14.1.1.0.0_wls.jar  
Launcher log file is /tmp/OraInstall2020-04-09_10-35-56AM/launcher2020-04-09_10-35-56AM.log. 
Extracting the installer . . . . . Done 
Checking if CPU speed is above 300 MHz.   Actual 2754.936 MHz    Passed 
Checking monitor: must be configured to display at least 256 colors.   Actual 16777216    Passed 
Checking swap space: must be greater than 512 MB.   Actual 8015 MB    Passed 
Checking temp space: must be greater than 300 MB.   Actual 7027 MB    Passed 
Preparing to launch the Oracle Universal Installer from /tmp/OraInstall2020-04-09_10-35-56AM 
 


Start  domain

Starting WLS with line:

/usr/java/jdk-11.0.6/bin/java -server   -Xms256m -Xmx512m -XX:CompileThreshold=8000 -cp /app/weblogic/wlserver/server/lib/weblogic-launcher.jar -Dlaunch.use.env.classpath=true -Dweblogic.Name=AdminServer -Djava.security.policy=/app/weblogic/wlserver/server/lib/weblogic.policy  -Djava.system.class.loader=com.oracle.classloader.weblogic.LaunchClassLoader  -javaagent:/app/weblogic/wlserver/server/lib/debugpatch-agent.jar -da -Dwls.home=/app/weblogic/wlserver/server -Dweblogic.home=/app/weblogic/wlserver/server      weblogic.Server

 

Sunday, April 5, 2020

Fedora - convert DVD

 RPM Fusion


These tools require non-free resource - enable RPM Fusion

https://rpmfusion.org/Configuration/ 

 Install non-free packages for DVD


sudo dnf install rpmfusion-free-release-tainted

sudo dnf install libdvdcss
 Install various packages for sound and video
 

sudo dnf groupupdate multimedia --setop="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin

sudo dnf groupupdate sound-and-video

    Whole DVD backup


    sudo dnf install dvdbackup 
    
    ============================================================================================================================================================ 
     Package                              Architecture                      Version                                     Repository                         Size 
    ============================================================================================================================================================ 
    Installing: 
     dvdbackup                            x86_64                            0.4.2-13.fc31                               fedora                             62 k 



    EXAMPLES
    
           dvdbackup -I
    
                  gathers information about the DVD.  /dev/dvd is the default device tried - you need to use -i if your device name is different.
    
     
           dvdbackup -M
    
                  backups the whole DVD.  This action creates a valid DVD-Video structure that can be burned to a DVD-/+R(W) with help of genisoimage.
    
     
           dvdbackup -F
    
                  backups the main feature of the DVD.  This action creates a valid DVD-Video structure of the feature title set.  Note that this  will  not
    
                  result in an image immediately watchable - you will need another program like dvdauthor to help construct the IFO files.
    
     
                  dvdbackup defaults to get the 16:9 version of the main feature if a 4:3 is also present on the DVD.  To get the 4:3 version use -a 0.
    
     
                  dvdbackup makes it best to make a intelligent guess what is the main feature of the DVD - in case it fails please send a bug report.
    
     

     

     Using VLC

    https://linuxconfig.org/how-to-rip-dvds-with-vlc#h3-how-to-rip-a-dvd-to-your-hard-drive-with-vlc

     Using Handbrake


    https://linuxconfig.org/how-to-convert-video-formats-on-linux


    sudo dnf install handbrake
    
    
    ================================================================================
    
     Package        Arch        Version           Repository                   Size
    
    ================================================================================
    
    Installing:
    
     HandBrake      x86_64      1.3.1-1.fc31      rpmfusion-free-updates      434 kPaste your text here.
    


    sudo dnf install handbrake-gui
    
    
    ================================================================================
    
     Package           Arch       Version          Repository                  Size
    
    ================================================================================
    
    Installing:
    
     HandBrake-gui     x86_64     1.3.1-1.fc31     rpmfusion-free-updates     3.5 M
    


    Subtitle edit
    https://github.com/SubtitleEdit/subtitleedit/releases