script – Copiar node de una response y pegarlo en una request con groovy

mi duda es la siguiente, estoy intentando hacer un script con groovy para copiar una parte del codigo xml, es decir, un nodo con sus hijos, y pegarlo en una request de otro servicio soap ejemplo:

<Edit_Mensaje>
     <a:Mensaje>
          <b:Remitente>
               <c:Nombre>Nombre del remitente</c:Nombre>
               <c:Mail> Correo del remitente </c:Mail>
          <b:/Remitente>
          <b:Destinatario>
               <c:Nombre>Nombre del destinatario</c:Nombre>
               <c:Mail>Correo del destinatario</c:Mail>
          </b:Destinatario>  
     </a:Mensaje>
</Edit_Mensaje>

y pegar el a:mensaje en una request de un servicio diferente.

Muchas gracias.

linux – script shell que ejecuta programa que requiere toma dos archivos de entrada

Quiero desarrollar un script shell que llame a un programa que requiere dos archivos de entrada.
La cuestión está en que, no es solo una pareja la tiene que procesar, sino x numero de parejas que se encuentran en el mismo directorio.

En el directorio tengo por ejemplo:

1nt.fa 2aa.fa 2nt.fa 2aa.fa 3nt.fa 3aa.fa 4nt.fa 4aa.fa 5nt.fa 5aa.fa

la linea de comandos del programa es la siguiente:

xvfb-run ete3 build -a 1aa.fa -n 1nt.fa -o mix_types -w standard_fasttree --clearall --nt-switch-threshold 0.0

Y lo que intente fue lo siguiente, pero no funciono.

#!/bin/bash
aa='eteanalysis/*.aa.fa'
nt='eteanalysis/*.nt.fa'
for f in eteanalysis/; do
    xvfb-run ete3 build
    -a $aa
    -n $nt
    -w standard_fasttree
    --clearall
    --nt-switch-threshold 0.0
    -o mixed_types/${f%.fasta}.ete3
done

Alguna idea?…También lo he intentado con parallel pero tampoco me funciono

Selenium web-scraper script, python – Code Review Stack Exchange

I have created a small selenium script that checks for available times to write a test for a drivers license. The program runs every minute and takes approx 50 seconds to run. I have noticed that it’s quite unstable, and do not preform optimally because the web-page loads elements dynamically. Even if I use seleniums wait I am unable to optimise it fully as connectivity vary on my wifi, and may lead to longer loading times than expected. Feedback on error-handling and code optimisation for greater stability would be highly appreciated and how to schedule the task to run without a back-log of jobs waiting to be executed as memory is small on my mac-book air 2013.

import datetime
import schedule
import threading

from datetime import date

import smtplib
import time

import multiprocessing as mp

from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait



def selenium_get_time(ort):
    """Checks if time is available for a county"""
    options = Options()
    options.headless = True
    driver = webdriver.Chrome(chrome_options=options, executable_path='/Users/andreas/.wdm/chromedriver/83.0.4103.39/mac64/chromedriver')

    
    driver.get("https://fp.trafikverket.se/boka/#/search/dIccADaISRCIi/5/0/0/0")
    element = WebDriverWait(driver, 40).until(EC.element_to_be_clickable((By.CLASS_NAME, "form-control")))
    driver.find_element_by_xpath("//select(@id='examination-type-select')/option(@value='3')").click()
    driver.find_element_by_xpath("//select(@id='language-select')/option(@value='13')").click()
    driver.find_element_by_id('id-control-searchText').clear()
    inputElement = driver.find_element_by_id("id-control-searchText")
    inputElement.send_keys(ort)
    inputElement.send_keys(Keys.ENTER)
    # time.sleep(10)
    
    try:
        element = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//div(@class='col-sm-3 text-center')/button(@data-bind='click:$parent.select')")))
        first_time = driver.find_element_by_xpath("//div(@class='col-xs-6')/strong")
        return first_time.text
    except (NoSuchElementException, TimeoutException) as e:
        driver.close()
        if NoSuchElementException:
            print('Nothing found for: ', ort, ' NoElemFound')
            driver.close()
            driver.quit()
        else:
            print('Nothing found for: ', ort, ' TimedOut')
            driver.close()
            driver.quit()

def convert_time(time_stamp):
    """converts a timestamp"""
    date_time_obj = datetime.datetime.strptime(time_stamp, '%Y-%m-%d %H:%M')
    return date_time_obj

def check_schedule(date, start_date, end_date):
    start_date = datetime.datetime.strptime(start_date, '%Y-%m-%d')
    end_date = datetime.datetime.strptime(end_date, '%Y-%m-%d')
    if start_date <= date <= end_date:
        return True
    else:
        return False

def send_email(first_availible, ort):
    """sends an email"""
    gmailUser = 'nor###rov@###.com'
    gmailPassword = '######'
    recipient = '###########'
    message=msg = 'Första lediga tid i'+' '+ str(ort) +' '+ str(first_availible) +' '+ 'https://fp.trafikverket.se/boka/#/search/SPHHISiPAfhpP/5/0/0/0'

    msg = MIMEMultipart()
    msg('From') = gmailUser
    msg('To') = recipient
    msg('Subject') = "Ledig tid körkortsprov"
    msg.attach(MIMEText(message))

    mailServer = smtplib.SMTP('smtp.gmail.com', 587)
    mailServer.ehlo()
    mailServer.starttls()
    mailServer.ehlo()
    mailServer.login(gmailUser, gmailPassword)
    mailServer.sendmail(gmailUser, recipient, msg.as_string())
    mailServer.close()

def main(ort):
   """main program"""
    first_availible = selenium_get_time(ort)
    if first_availible:
        date = convert_time(first_availible)
        if check_schedule(date, '2020-07-01', '2020-07-05'):
            print('FOUND: ', ort +' '+ first_availible)
            send_email(first_availible, ort)
        else:
            now = datetime.datetime.now()
            dt_string = now.strftime("%H:%M:%S")
            print('Found Nothing for: ', ort, ' ', dt_string)



def run():
    """runs program"""
    ORTER = ('Södertälje', 'Stockholm', 'Järfälla', 'Sollentuna')
    for ort in ORTER:
        main(ort)

def worker():
    """"spans processes for program"""
    p = mp.Process(target=run)
    # run `worker` in a subprocess
    p.start()
    # make the main process wait for `worker` to end
    p.join()
    # all memory used by the subprocess will be freed to the OS




if __name__ == '__main__':

    """schedule to run every minute"""
    schedule.every(55).seconds.do(worker)
    while True:
        try:
            schedule.run_pending()
            time.sleep(1)

        except Exception as e:
            schedule.run_pending()
            time.sleep(1)
    










```

How to make this Google Sheets script dynamic?

I’m working in a script to paste a table on the same sheet, in my code I’m only pasting the table on the row A18

function NewQuote() {
 var ss = SpreadsheetApp.getActive();
  ss.getRange("A18").activate();
 ss.getRange('A1:F14').copyTo(ss.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
};

I want to make this value dynamic and pasting the table on the next available row.

sharepoint online – How to deploy from powershell script using github actions?

I am trying to deploy to siteCollection appcatalog on each push to my github repository using github actions. Saw that it’s possible using Office 365 CLI action, but that only allows tenant admins to deploy.

Before I run the powershell script I build and create the .sppkg file.
So I used PowerShell’s SharePointPnPPowerShellOnline Module in github actions. I was able to connect to the site.

I’m not able to find a way to access the .sppkg file and deploy it to the site

Below is my code

Install-Module -Name SharePointPnPPowerShellOnline -Force -Verbose -Scope CurrentUser

$siteUrl = "https://test.sharepoint.com"
$username = "xyz@abc.com" 
$password = "myPassword"      

$encpassword = ConvertTo-SecureString -String $password -AsPlainText -Force
$cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $username, $encpassword

Connect-PnPOnline -Url $siteUrl -Credentials $cred

Write-Host "logged in"

#code to access the sppkg file and deploy it to the site collection appcatalog

--------------------------------------------------------------------------------
$getTheSPPKGFile = *************

Add-PnPApp -Path $theSPPKGFile -Publish -Overwrite
--------------------------------------------------------------------------------

Any search is resulting to tenant admin approach. I don’t have tenant admin access, only site collection admin access.

Thank you

javascript – Como colocar html dentro do meu script js?

Estou com um script em que duplica e remove os meus inputs em meu form, estou tentando acrescentar html nele, para ficar superficialmente mais “bonitos/organizados” quando os inputs forem duplicados, porém não consigo.

Exemplo:

ex

A linha vermelha seria o html separando os inputs duplicados.

Código:

 <div id="origem">
          <form> //Aqui o meu formulário </form>
 </div> 

   <div id="destino"><!-- Aqui vai ser duplicado os inputs --></div>

   <i class="ti-minus" style="float: right; cursor: pointer;" onclick="removerCampos(this);"></i>
   <i class="ti-plus" style="float: right; cursor: pointer;" onclick="duplicarCampos();"></i>

    <script> // Duplicar & Remover inputs
        function duplicarCampos(){
        var clone = document.getElementById('origem').cloneNode(true);
        var destino = document.getElementById('destino');
        destino.appendChild (clone);
        
        var camposClonados = clone.getElementsByTagName('input');
        
        for(i=0; i<camposClonados.length;i++){
            <br> // Tentei colocar esses espaçamentos aqui, porém, não funciona...
            camposClonados(i).value = '';
            </br>
        }
    }
    
    function removerCampos(id){
        var node1 = document.getElementById('destino');
        node1.removeChild(node1.childNodes(0));
    }
    </script>

Como posso fazer para adicionar algum html dentro do meu for?

Sou bem leigo com js, agradeço a compreensão…

Google Drive Proxy Player Script V3 | Proxies-free

Dear Wjunction Users,

Google Drive Proxy Player Script V3

Play video Google Drive Url on your website with New Google Drive Player, Bypass Limit View With Multi Backup 5 URLs, and Dashboard Admin. Fully Encrypted Output Link Streaming.

PRODUCT DESCRIPTION:

New Google Drive Player, Bypass Limit View With Multi Backup helps you to stream video files stored on Google Drive in a fully customizable way, you will have full control over the player. The HD option is Fake!, if you find the HD Options in this player that are just fake HD Options, thanks.
.
Product Features:

  • Support Google Photos & Google Drive Videos
  • JW Player
  • Player & Download Pages Available
  • Option For Bulk Links Generation
  • Add Single/Multiple Subtitles
  • Download & Share Buttons Available
  • Video Quality Settings Available
  • Add Pop + Banner Advertisements
  • Advanced Yet Easy Controls
  • Awesome Admin Dashboard
  • Affordable One-Time Payment

BUY NOW – $18

If You need anyone script PM Me

 

linux – Bash script to mirror XWindow to remote SSH host

The source code within this question aims to provide a short-cut for mirroring a local XWindow (or session) to a remote host via SSH port forwarding, eg…

x11vnc-push-xwindow --id=none raspberrypi

The ReadMe file contains more detailed instructions for setup, but the TLDR is…

mkdir -vp ~/git/hub/rpi-curious
cd ~/git/hub/rpi-curious

git clone --recurse-submodules git@github.com:rpi-curious/x11vnc-push-xwindow.git
cd x11vnc-push-xwindow
ln -s "${PWD}/x11vnc-push-xwindow" "${HOME}/bin/"
x11vnc-push-xwindow raspberrypi
## Select a XWindow, or use `--id=none` to mirror entire session
# x11vnc-push-xwindow --id=none raspberrypi
q
# Ctrl^c

I wrote this project because it helps my own posture to look up at my remote device’s screen, and currently everything seems to function as intended, but as always there’s room for improvement.

Questions

  • Are there any obvious mistakes?

  • Any features that are both missing and necessary?

  • Is there a better way to fully terminate the connection when q is pressed? Currently this is a two-step process of pressing q then Ctrlc to quit and then terminate the connection.


Source Code

Note, source code for this question is maintained on GitHub at rpi-curious/x11vnc-push-xwindow, what is included here are the scripts and shared functions required to test/review without need of any Git fanciness.

x11vnc-push-xwindow

#!/usr/bin/env bash


## Find true directory script resides in, true name, and true path
__SOURCE__="${BASH_SOURCE(0)}"
while (( -h "${__SOURCE__}" )); do
    __SOURCE__="$(find "${__SOURCE__}" -type l -ls | sed -n 's@^.* -> (.*)@1@p')"
done
__DIR__="$(cd -P "$(dirname "${__SOURCE__}")" && pwd)"
__NAME__="${__SOURCE__##*/}"
__AUTHOR__='S0AndS0'
__DESCRIPTION__='Pushes/mirrors selected XWindow to remote via SSH port forwarding'


## Source module code within this script
source "${__DIR__}/shared_functions/modules/argument-parser/argument-parser.sh"
source "${__DIR__}/shared_functions/modules/trap-failure/failure.sh"


trap 'failure "LINENO" "BASH_LINENO" "${BASH_COMMAND}" "${?}"' ERR


__license__(){
    local _date_year="$(date +'%Y')"
    cat <<EOF
${__DESCRIPTION__}
Copyright (C) ${_date_year:-2020} ${__AUTHOR__:-S0AndS0}

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, version 3 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.
EOF
}


usage() {
    local _message="${1}"
    cat <<EOF
${__DESCRIPTION__}


## Augments ${__NAME__%.*} responds to


--help | -h

    Prints this message and exits


--x11vnc-listen-port="${_x11vnc_listen_port}"

    Default '5900', port that x11vnc will serve XWindow session on 'localhost' for this device.

    Note, if listen port is already in use then session will be reused, otherwise a new session will be initialized.


--vnc-viewer-port="${_vnc_viewer_port}"

    Default '5900', port that remote host will connect to on their relative 'localhost' to view forwarded XWindow session.

    Note, if 'xscreensaver' is detected on remote host, then it will be disabled until x11vnc session is terminated


--vnc-viewer-name="${_vnc_viewer_name}"

    Default 'vncviewer', executable name of VNC Viewer.

    Note, if troubles are had when using a VNC Viewer other than 'vncviewer', please try 'vncviewer' before opening a new Issue.


--id="${_id}"

    Default 'pick', XWindow ID to forward to remote host.

    Note, if set to 'none' then entire XWindow session will be forwarded.


${_target_host:-<target-host>}

    Required, remote SSH host that XWindow session will be forwarded to.


## Example


${__NAME__} raspberrypi
EOF

    (( "${#_message}" -gt '0' )) && {
        printf >&2 'n## Error: %sn' "${_message}"
    }
}


## Defaults
_target_host=''
_x11vnc_listen_port='5900'
_vnc_viewer_port='5900'
_id='pick'
_vnc_viewer_name='vncviewer'


## Save passed arguments and acceptable arguments to Bash arrays
_passed_args=("${@:?No arguments provided}")
_acceptable_args=(
    '--help|-h:bool'
    '--x11vnc-listen-port:alpha_numeric'
    '--vnc-viewer-port:alpha_numeric'
    '--id:alpha_numeric'
    '--target-host:path-nil'
)


## Pass arrays by reference/name to the `argument_parser` function
argument_parser '_passed_args' '_acceptable_args'
_exit_status="$?"


## Print documentation for the script and exit, or allow further execution
((_help)) || ((_exit_status)) && {
    usage
    exit "${_exit_status:-0}"
}

(("${#_target_host}")) || {
    usage 'Missing target host parameter'
    exit 1
}


## Note, '-shared' with '-forever' and '-threads' or '-once' may be wanted
##  in addition to the following options
_x11vnc_server_opts=(
    '-quiet'
    '-noshared'
    '-viewonly'
    '-noremote'
    '-nobell'
    '-nosel'
    '-noprimary'
    '-nosetprimary'
    '-noclipboard'
    '-nosetclipboard'
    # '-disablefiletransfer'  ## Un-comment for older versions
    '-cursor' 'most'
    '-noipv6'
    '-allow' '127.0.0.1'
    '-autoport' "${_x11vnc_listen_port}"
    '-listen' '127.0.0.1'
    '-nopw'
    '-nossl'
    '-bg'
)

(( "${_id}" =~ 'none' )) || {
  _x11vnc_server_opts+=(
    '-id' "${_id}"
  )
}


_vnc_viewer_opts=(
    '-viewonly'
    '-fullscreen'
    "localhost::${_vnc_viewer_port}"
)


grep -q -- "${_x11vnc_listen_port}" <<<"$(netstat -plantu 2>/dev/null)" || {
    printf '# Running: x11vnc %sn' "${_x11vnc_server_opts(*)}"
    x11vnc ${_x11vnc_server_opts(@)}
}


initialize_connection() {
    ssh -R localhost:${_vnc_viewer_port}:localhost:${_x11vnc_listen_port} "${_target_host}" <<EOF
    reinitalize_xscreensaver(){
        echo 'Resuming: xscreensaver'
        DISPLAY=:0 xscreensaver -no-splash 2>&1 >/dev/null &
        sleep 3
        DISPLAY=:0 xscreensaver-command -activate
    }


    initalize_viewer(){
        _xscreensaver_time="$(DISPLAY=:0 xscreensaver-command -time 2>&1)"
    (( "${_xscreensaver_time}" =~ 'no screensaver is running' )) || {
            trap 'reinitalize_xscreensaver' RETURN SIGINT SIGTERM EXIT
            echo 'Halting: xscreensaver'
            DISPLAY=:0 xscreensaver-command -deactivate
            DISPLAY=:0 xscreensaver-command -exit
        }

        printf 'Starting: $(which ${_vnc_viewer_name}) %sn' "${_vnc_viewer_opts(*)}"
    DISPLAY=:0 $(which ${_vnc_viewer_name}) ${_vnc_viewer_opts(@)}
        return "${?}"
    }

    initalize_viewer
EOF
}


initialize_connection &
_connection_pid="$!"

printf 'Press %s to quit...n' "q"
while read -n1 -r _input; do
    case "${_input,,}" in
        q)
            printf 'Killing PID %in' "${_connection_pid}"
            kill "${_connection_pid}"
            sleep 2
            printf 'Please use Ctrl^c to exit!'
        ;;
    esac

    sleep 1
done

shared_functions/modules/argument-parser/argument-parser.sh

#!/usr/bin/env bash


# argument-parser.sh, source it in other Bash scripts for argument parsing
# Copyright (C) 2019  S0AndS0
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation; version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.


shopt -s extglob


_TRUE='1'
_DEFAULT_ACCEPTABLE_ARG_LIST=('--help|-h:bool' '--foo|-f:print' '--path:path-nil')


arg_scrubber_alpha_numeric(){ printf '%s' "${@//(^a-z0-9A-Z)/}"; }


arg_scrubber_regex(){ printf '%s' "$(sed 's@.@\.@g' <<<"${@//(^(:print:)$'t'$'n')/}")"; }


arg_scrubber_list(){
    printf '%s' "$(sed 's@..*@.@g; s@--*@-@g' <<<"${@//(^a-z0-9A-Z,+_./@:-)/}")"
}


arg_scrubber_path(){
    printf '%s' "$(sed 's@..*@.@g; s@--*@-@g' <<<"${@//(^a-z0-9A-Z ~+_./@:-)/}")"
}


arg_scrubber_posix(){
    _value="${@//(^a-z0-9A-Z_.-)/}"
    _value="$(sed 's@^(-_.)@@g; s@(-_.)$@@g; s@..*@.@g; s@--*@-@g' <<<"${_value}")"
    printf '%s' "${_value::32}"
}


return_scrubbed_arg(){
    _raw_value="${1}"
    _opt_type="${2:?## Error - no option type provided to return_scrubbed_arg}"
    case "${_opt_type}" in
        'bool'*)  _value="${_TRUE}"      ;;
        'raw'*)   _value="${_raw_value}" ;;
        'path'*)  _value="$(arg_scrubber_path "${_raw_value}")"  ;;
        'posix'*) _value="$(arg_scrubber_posix "${_raw_value}")" ;;
        'print'*) _value="${_raw_value//(^(:print:))/}"          ;;
        'regex'*) _value="$(arg_scrubber_regex "${_raw_value}")" ;;
        'list'*)  _value="$(arg_scrubber_list "${_raw_value}")"  ;;
        'alpha_numeric'*) _value="$(arg_scrubber_alpha_numeric "${_raw_value}")" ;;
    esac

    if (( "${_opt_type}" =~ ^'bool'* )) || (( "${_raw_value}" == "${_value}" )); then
        printf '%s' "${_value}"
    else
        printf '## Error - return_scrubbed_arg detected differences in valuesn' >&2
        return 1
    fi
}


argument_parser(){
    local -n _arg_user_ref="${1:?# No reference to an argument list/array provided}"
    local -n _arg_accept_ref="${2:-_DEFAULT_ACCEPTABLE_ARG_LIST}"
    _args_user_list=("${_arg_user_ref(@)}")
    unset _assigned_args
    for _acceptable_args in ${_arg_accept_ref(@)}; do
        ## Take a break when user supplied argument list becomes empty
        (( "${#_args_user_list(@)}" == '0' )) && break
        ## First in listed acceptable arg is used as variable name to save value to
        ##  example, '--foo-bar fizz' would transmute into '_foo_bar=fizz'
        _opt_name="${_acceptable_args%%(:|)*}"
        _var_name="${_opt_name#*(-)}"
        _var_name="${_var_name#*(-)}"
        _var_name="_${_var_name//-/_}"
        ## Divine the type of argument allowed for this iteration of acceptable args
        case "${_acceptable_args}" in
            *':'*) _opt_type="${_acceptable_args##*(:)}" ;;
            *)     _opt_type="bool"                      ;;
        esac
        ## Set case expressions to match user arguments against and for non-bool type
        ##  what alternative case expression to match on.
        ##  example '--foo|-f' will also check for '--foo=*|-f=*'
        _arg_opt_list="${_acceptable_args%%:*}"
        _valid_opts_pattern="@(${_arg_opt_list})"
        case "${_arg_opt_list}" in
            *'|'*) _valid_opts_pattern_alt="@(${_arg_opt_list//|/=*|}=*)" ;;
            *)     _valid_opts_pattern_alt="@(${_arg_opt_list}=*)"        ;;
        esac
        ## Attempt to match up user supplied arguments with those that are valid
        for (( i = 0; i < "${#_args_user_list(@)}"; i++ )); do
            _user_opt="${_args_user_list(${i})}"
            case "${_user_opt}" in
                ${_valid_opts_pattern})     ## Parse for script-name --foo bar or --true
                    if (( "${_opt_type}" =~ ^'bool'* )); then
                        _var_value="$(return_scrubbed_arg "${_user_opt}" "${_opt_type}")"
                        _exit_status="${?}"
                    else
                        i+=1
                        _var_value="$(return_scrubbed_arg "${_args_user_list(${i})}" "${_opt_type}")"
                        _exit_status="${?}"
                        unset _args_user_list($(( i - 1 )))
                    fi
                ;;
                ${_valid_opts_pattern_alt}) ## Parse for script-name --foo=bar
                    _var_value="$(return_scrubbed_arg "${_user_opt#*=}" "${_opt_type}")"
                    _exit_status="${?}"
                ;;
                *)                          ## Parse for script-name direct_value
                    case "${_opt_type}" in
                        *'nil'|*'none')
                            _var_value="$(return_scrubbed_arg "${_user_opt}" "${_opt_type}")"
                            _exit_status="${?}"
                        ;;
                    esac
                ;;
            esac
            if ((_exit_status)); then return ${_exit_status}; fi
            ## Break on matched options after clearing temp variables and re-assigning
            ##  list (array) of user supplied arguments.
            ## Note, re-assigning is to ensure the next looping indexes correctly
            ##  and is designed to require less work on each iteration
            if ( -n "${_var_value}" ); then
                declare -g "${_var_name}=${_var_value}"
                declare -ag "_assigned_args+=('${_opt_name}="${_var_value}"')"
                unset _user_opt
                unset _var_value
                unset _args_user_list(${i})
                unset _exit_status
                _args_user_list=("${_args_user_list(@)}")
                break
            fi
        done
        unset _opt_type
        unset _opt_name
        unset _var_name
    done
}

Note, the source code for argument-parser.sh is a Git Submodule maintained on GitHub at bash-utilities/argument-parser, and can be cloned individually via…

mkdir -vp ~/git/hub/bash-utilities
cd ~/git/hub/bash-utilities

git clone git@github.com:bash-utilities/argument-parser.git

shared_functions/modules/trap-failure/failure.sh

#!/usr/bin/env bash


# Bash Trap Failure, a submodule for other Bash scripts tracked by Git
# Copyright (C) 2019  S0AndS0
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation; version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.


## Outputs Front-Mater formatted failures for functions not returning 0
## Use the following line after sourcing this file to set failure trap
##    trap 'failure "LINENO" "BASH_LINENO" "${BASH_COMMAND}" "${?}"' ERR
failure(){
    local -n _lineno="${1:-LINENO}"
    local -n _bash_lineno="${2:-BASH_LINENO}"
    local _last_command="${3:-${BASH_COMMAND}}"
    local _code="${4:-0}"

    ## Workaround for read EOF combo tripping traps
    ((_code)) || {
      return "${_code}"
    }

    local _last_command_height="$(wc -l <<<"${_last_command}")"

    local -a _output_array=()
    _output_array+=(
        '---'
        "lines_history: (${_lineno} ${_bash_lineno(*)})"
        "function_trace: (${FUNCNAME(*)})"
        "exit_code: ${_code}"
    )

    (( "${#BASH_SOURCE(@)}" -gt '1' )) && {
        _output_array+=('source_trace:')
        for _item in "${BASH_SOURCE(@)}"; do
            _output_array+=("  - ${_item}")
        done
    } || {
        _output_array+=("source_trace: (${BASH_SOURCE(*)})")
    }

    (( "${_last_command_height}" -gt '1' )) && {
        _output_array+=(
            'last_command: ->'
            "${_last_command}"
        )
    } || {
        _output_array+=("last_command: ${_last_command}")
    }

    _output_array+=('---')
    printf '%sn' "${_output_array(@)}" >&2
    exit ${_code}
}

Note, the source code for failure.sh is a Git Submodule maintained on GitHub at bash-utilities/trap-failure, and can be cloned individually via…

mkdir -vp ~/git/hub/bash-utilities
cd ~/git/hub/bash-utilities

git clone git@github.com:bash-utilities/trap-failure.git

PYTHON ejecutar script cada cierto tiempo y al mismo tiempo ejecutar lo que queda del scrip

¿Cómo están?.

Tenía dos dudas con Python sobre ejecutar un script basado en el tiempo.
Por ejemplo, el script se ejecuta todos los días a una hora determinada (obviamente, puedo crear un Def y luego un time.sleep()) calculando la hora.

Pero ahora vienen las dudas:
¿Cómo puedo hacer para que este script mientras está en “suspensión” siga ejecutando el resto del código?
¿Cómo puedo calcular el tiempo que tarda un script en ejecutarse? (Se me ocurre en usar un datetime al principio y otra al final, restándolos) ¿hay otra forma?

pongo un ejemplo para que se entienda

import time

def ejecutaScript():
    print ('aca va el codigo numero 1')
    time.sleep(100)

while True:
    ejecutaScript()

for i in range(10):
    print('aca seguria un segundo codigo")

Para entender, el código uno que se ejecutará cada (100 segundos). pero mientras espero estos 100 segundos me gustaría continuar ejecutando el resto del código (me refiero al código número dos).
Y la segunda pregunta. Me gustaría saber cuanto demora todo el código en correr.

Saludos y que tengan un excelente día

How to use this google api console developer tools script for copy clone youtube watch later playlist?

How to use this google api console developer tools script for copy clone youtube watch later playlist? The instructions are old. Now google api console developer tools looks different so i cant find correct way to implement it.

Youtube API – How to copy the WatchLater List