Skip to content

Commit

Permalink
S05-CopyOneFileRepeatedly
Browse files Browse the repository at this point in the history
  • Loading branch information
PyjaErskell committed Aug 20, 2021
1 parent 82442ee commit a694c24
Show file tree
Hide file tree
Showing 6 changed files with 680 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@ECHO OFF
SETLOCAL

SET SC_KAPA_HM=C:\ProgramData\Bichon Frise\Kapa

SET SC_JAVA_HM=%SC_KAPA_HM%\19.11.01\Vindue\x64\Amazon\Corretto\8.232.09.1
SET Path=%SC_JAVA_HM%\jre\bin\server;%Path%

SET SC_PYTHON_HM=%SC_KAPA_HM%\19.01.22\Vindue\x64\Anaconda\5.1.0
SET QT_PLUGIN_PATH=%SC_PYTHON_HM%\Library\plugins
SET SC_JEP_PN=%SC_PYTHON_HM%\Lib\site-packages\jep
SET SC_JEP_JAR_FN=%SC_JEP_PN%\jep-3.7.1.jar
SET PYTHONHOME=%SC_PYTHON_HM%
SET Path=%SC_PYTHON_HM%;%Path%

PUSHD "%~DP0"
CD "%~DP0"

SET SC_MILO_PN=%CD%
CD "%SC_MILO_PN%\..\..\..\.."
SET SC_PYJA_HM=%CD%
FOR %%F IN (%SC_PYJA_HM%\..) DO SET SC_PYJA_NM=%%~NXF
FOR %%F IN (%SC_PYJA_HM%) DO SET SC_PYJA_VR=%%~NXF

POPD

SET SC_ECU_PN=%SC_MILO_PN%\ecu

"%SC_KAPA_HM%\19.01.22\Vindue\x64\Strawberry\5.28.1\perl\bin\perl5.28.1.exe" -CS -I "%SC_MILO_PN%\src\k-09001-perl" "%SC_MILO_PN%\src\k-01001-run-me\SToa.pl" %*
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

export SC_KAPA_HM="/Library/Application Support/Bichon Frise/Kapa"

export SC_JAVA_HM=$SC_KAPA_HM/19.11.01/Mushama/x64/Amazon/Corretto/8.232.09.1
export LD_LIBRARY_PATH=$SC_JAVA_HM/jre/lib/server

export SC_PYTHON_HM=$SC_KAPA_HM/19.01.22/Mushama/x64/Anaconda/5.1.0
export TCL_LIBRARY=$SC_PYTHON_HM/lib/tcl8.6
export QT_PLUGIN_PATH=$SC_PYTHON_HM/plugins
export SC_JEP_PN=$SC_PYTHON_HM/lib/python3.6/site-packages/jep
export SC_JEP_JAR_FN=$SC_JEP_PN/jep-3.7.1.jar
export PYTHONHOME=$SC_PYTHON_HM
export LD_LIBRARY_PATH=$SC_PYTHON_HM/lib:$LD_LIBRARY_PATH

export SC_MILO_PN=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

export SC_PYJA_HM=$( cd "$SC_MILO_PN/../../../.." && pwd )
export SC_PYJA_NM=$( basename "$( cd "$SC_PYJA_HM/.." && pwd )" )
export SC_PYJA_VR=$( basename "${SC_PYJA_HM}" )

export SC_ECU_PN=$SC_MILO_PN/ecu

"/opt/local/bin/perl5.26.3" -CS -I "$SC_MILO_PN/src/k-09001-perl" "$SC_MILO_PN/src/k-01001-run-me/SToa.pl" "$@"
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
//---------------------------------------------------------------
// Global
//---------------------------------------------------------------

GC_DUCK_ST = OYela.ol_st

GC_FOSA = File.separator // (fo)lder (s)ep(a)rator
GC_PASA = File.pathSeparator // (pa)th (s)ep(a)rator

CgFilenameUtils = org.apache.commons.io.FilenameUtils
CgManagementFactory = java.lang.management.ManagementFactory
CgSimpleDateFormat = java.text.SimpleDateFormat

gf_joc = { x_jo -> x_jo .getClass () } // (j)ava (o)bject's (c)lass
gf_cls = { x_cls_nm -> Class .forName (x_cls_nm) } // find class from string
gf_is_instance = { x_jo, x_cls -> x_cls .isInstance x_jo }
gf_sf = { x_format, Object ... x_args -> String .format ( x_format, * x_args ) } // (s)tring (f)ormat
gf_ni = { x_cls, Object ... x_args -> x_cls .newInstance ( * x_args ) } // (n)ew (i)nstance

gf_os_env = { x_key ->
final fu_it = System .getenv x_key
if ( fu_it == null ) { throw new NullPointerException ( "Environment variable not found => ${x_key}" ) }
fu_it
}
gf_os_env_has = { x_key -> System .getenv (x_key) != null }

gf_sys_props = { x_key ->
final fu_it = System .getProperty (x_key)
if ( fu_it == null ) { throw new NullPointerException ( "System property not found => ${x_key}" ) }
fu_it
}
gp_sys_props_set = { x_key, x_value -> System .setProperty ( x_key, x_value ) }

gf_str_is_valid_date = { x_str, x_format ->
def fv_is_valid = true
try { CgSimpleDateFormat .newInstance (x_format) .with { it .setLenient (false); it .parse (x_str) } } catch (_) { fv_is_valid = false }
fv_is_valid
}

gf_exception_to_list = { x_ex ->
final fu_list = [ x_ex .toString () ]
x_ex .stackTrace .each { fu_list << it .toString () }
fu_list
}

gf_classpaths = { -> ClassLoader.systemClassLoader.URLs .collect { it .toString () } .sort () }

gf_elapsed = { x_st, x_et ->
final fu_pd = new org.joda.time.Interval ( x_st.time, x_et.time ) .toPeriod ()
fu_pd .with { String .format '%02d-%02d-%02d %02d:%02d:%02d.%03d', years, months ,days, hours, minutes, seconds, millis }
}

gf_jep = { x_include_pn -> new jep.Jep ( false, x_include_pn ) }

__gap_make_globals = { -> this.binding.variables .each { x2_key, x2_value -> if ( ! x2_key .startsWith ('_') ) { Object.metaClass."$x2_key" = x2_value } } }
__gap_make_globals ()

//---------------------------------------------------------------
// Your Source
//---------------------------------------------------------------

1
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#---------------------------------------------------------------
# Global
#---------------------------------------------------------------

use v5.26;
use strict;
use warnings;

use File::Basename;

BEGIN { $ENV {'SC_DUCK_PN'} = dirname (__FILE__); }

use i191210::G010;

#---------------------------------------------------------------
# Your Source
#---------------------------------------------------------------

use Getopt::Long;
use POSIX qw(strftime);
use File::Copy;

sub sp_body {
my ( $pu_success, $pu_in_fn, $pu_times, $pu_out_pn ) = sf_get_options ();
return unless $pu_success;
GC_LOG -> info ( "Input file => ${\ $pu_in_fn }" );
GC_LOG -> info ( "Repeating times => ${\ $pu_times }" );
GC_LOG -> info ( "Output path => ${\ $pu_out_pn }" );
die 'No such input file !!!' unless gf_if $pu_in_fn;
die 'Non positive repeating times !!!' unless $pu_times > 0;
die 'No such output path !!!' unless gf_id $pu_out_pn;
GC_LOG -> info ( 'Copying the file repeatedly ...' );
my $pu_px_dt = strftime "%y%m%d-%H%M%S", localtime ( time () );
my $pu_times_fmt = '%0' . length ($pu_times) . 'd';
my $pu_in_bn = gf_bn $pu_in_fn;
for ( 1..$pu_times ) {
my $bu2_px_cnt = jf_sf ( "$pu_times_fmt-$pu_times_fmt", $pu_times, $_ );
my $bu2_out_bn = "$pu_px_dt $bu2_px_cnt $pu_in_bn";
my $bu2_out_fn = gf_pj $pu_out_pn, $bu2_out_bn;
GC_LOG -> info ( " $bu2_out_bn -> $pu_out_pn" );
die "Cannot copy to $bu2_out_fn ... !!!" unless copy $pu_in_fn, $bu2_out_fn;
}
}

sub sf_get_options {
my $fu_help;
my $fu_in_fn;
my $fu_times;
my $fu_out_pn;

if ( scalar @ARGV < 1 ) { sp_usage (); return GC_FALSE; }
{
$SIG{__WARN__} = sub { die ($_[0]) };
GetOptions ( 'help|h' => \$fu_help, 'in=s' => \$fu_in_fn, 'times=i' => \$fu_times, 'out=s' => \$fu_out_pn );
}
if ( defined ($fu_help) ) { sp_usage (); return GC_FALSE; }
die 'Input file not given !!!' unless defined ($fu_in_fn);
die 'Repeating times not given !!!' unless defined ($fu_times);
die 'Output path not given !!!' unless defined ($fu_out_pn);
die 'Unrecognized arguments : ' . join ( ' ', @ARGV ) if scalar @ARGV > 0;
( GC_TRUE, $fu_in_fn, $fu_times, $fu_out_pn );
}

sub sp_usage {
GC_LOG -> info ( 'Usage :' );
GC_LOG -> info ( ' -in input file' );
GC_LOG -> info ( ' -times repeating times' );
GC_LOG -> info ( ' -out output path' );
GC_LOG -> info ( ' -help show usage' );
}

sub sp_main {
gp_run (\&sp_body);
}


sp_main ();
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#---------------------------------------------------------------
# Global
#---------------------------------------------------------------

import sys

sys.dont_write_bytecode = True

import os

os.environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = '1' # High-DPI Support in Qt 5.6

import platform
from PyQt5 import QtCore

GC_PYTHON_VR = platform .python_version ()
GC_PYQT_VR = QtCore .qVersion ()

#---------------------------------------------------------------
# Your Source
#---------------------------------------------------------------

def sf_hello ( x_str, x_no ) : return 'Hello {} !!!' .format ( x_str * x_no )
def sf_sum ( * x_args ) : return sum (x_args)

Loading

0 comments on commit a694c24

Please sign in to comment.