Skip to content

Instantly share code, notes, and snippets.

View scanbix's full-sized avatar

Mindaugas scanbix

View GitHub Profile
@scanbix
scanbix / bash_sqlplus.sh
Created April 3, 2018 06:39
Bash template for SQL plus DDL in Oracle
#!/bin/bash
# Purpose:
# Author: Full_name <email@>
# Note :
# Last updated on : 2018-03-05
# -----------------------------------------------
sqlplus -S /nolog <<EOF
--connect user/pass
@cleanup_database_tables.sql
@scanbix
scanbix / sqlplus_ddl_template.sql
Created April 3, 2018 06:48
SQLPLUS template for DDL scripts in Oracle database
set echo on
set feed on
set time on
set timing off
set lines 300
set trims on
set define off
set sqlblanklines on
set serveroutput on size unlimited
@scanbix
scanbix / bash_file_exist1.sh
Created May 18, 2018 14:21
Bash. Check if file exists wildcard only
if [[ -e $PMSourceFileDir\Clients\MyCompany\*fileName.txt ]]
then
echo "File exist"
return 0
else
@scanbix
scanbix / regex.txt
Last active August 1, 2023 10:28
regex decimal validation
Reference: https://stackoverflow.com/questions/12117024/decimal-number-regular-expression-where-digit-after-decimal-is-optional
You need a regular expression like the following to do it properly:
/^[+-]?((\d+(\.\d*)?)|(\.\d+))$/
The same expression with whitespace, using the extended modifier (as supported by Perl):
/^ [+-]? ( (\d+ (\.\d*)?) | (\.\d+) ) $/x
or with comments:
/^ # Beginning of string
@scanbix
scanbix / informatica_parameter_file_template.txt
Created January 23, 2020 08:06
informatica_parameter_file_template
[DI_RA_Prices.WF:wf_P_TR_FXRates_0905.ST:session_name]
$$ResponseFileName =rt_fxrates_0905_
@scanbix
scanbix / windows batch snippets
Last active May 26, 2021 09:58
Windows batch snippets
:: Empty file
copy /y NUL EmptyFile.txt >NUL
:: Error handling
somecommand > log.txt 2>&1 | someothercommand
somecommand 2>&1 | someothercommand
:: Check if file exists
if exist \\somefile.txt (
echo file exists
-- Old powershell version call from command task in infa
powershell -executionpolicy bypass -File "$PMRootDir\check_directory_access_infa.ps1" > "$PMRootDir\check_directory_access_infa.log" 2>&1
-- PowerShell exit sample code
# some logic to set $hasError variable.
if ($hasError) {
Write-Host has errors
exit 1
} else {
# powershell
git config --list --show-origin
##
## https://stackoverflow.com/questions/7335420/global-git-ignore
##
# ignore dirs/files in all user's local git repositories
git config --global core.excludesFile "$Env:USERPROFILE\.gitignore"
#review the setting
git config --global core.excludesFile
-- Deep copy
CREATE OR REPLACE TABLE table1_deep_copy AS SELECT * FROM table1;
-- Shallow copy
CREATE OR REPLACE TABLE table1_shallow_copy LIKE table1;
-- Temporary - for current session. Cannot be cloned.
CREATE TEMPORARY TABLE cust_temp AS SELECT * FROM customers;
-- Transient - multisession, does not use fail-safe storage.
CREATE TRANSIENT TABLE cust_temp AS SELECT * FROM customers;
-- Clone
python -m venv .venv
.\.venv\Scripts\activate
python -m pip install --upgrade pip
deactivate
python -m pip install -r requirements.txt
python -m pip freeze