Skip to content

Instantly share code, notes, and snippets.

@greenkey
greenkey / JDBC_guide_SoapUI.md
Created February 29, 2016 17:09
How to easily use JDBC in a SoapUI Test Case

How to easily use JDBC in a SoapUI Test Case

Choose the DB and get the JDBC driver

First we need to know to which DBMS we want to connect. You can find all the supported driver in the JDBC Driver List page of the SoapUI website. Take note of the Driver name, i.e. oracle.jdbc.driver.OracleDriver and download the .jar file.

Put the jar file in the ext directory, it should be in ithe same folder as the SoapUI start script. In Linux, you can find it in this way:

@greenkey
greenkey / sql_parametric.vbs
Last active February 25, 2016 12:43
VBScript, ADO and query parameters (question marks), a handy function
' inspired by:
' http://stackoverflow.com/questions/2557606/how-do-i-associate-parameters-to-command-objects-in-ado-with-vbscript
' http://stackoverflow.com/questions/10352211/vba-ado-connection-and-query-parameters
' The function takes three parameters: ADOConnection; sql (string); params, an Array() of parameters
Function sqlOperationParametric(ADOConnection,sql,params)
Dim Cm, Pm, i, p
Set Cm = CreateObject("ADODB.Command")
With Cm
@greenkey
greenkey / ddl_audit.sql
Last active February 6, 2018 14:21
Oracle DDL audit - made simple
CREATE TABLE ddl_log (
operation VARCHAR2(30),
obj_owner VARCHAR2(30),
obj_name VARCHAR2(30),
obj_type VARCHAR2(30),
sql_text CLOB,
attempt_by VARCHAR2(30),
attempt_dt DATE,
user_name VARCHAR2(50),
@greenkey
greenkey / proxied_chrome.sh
Created December 22, 2015 18:54
Use this as a launcher to have a chromium that uses a quick socks proxy via SSH
#!/bin/bash
PROXY_IP=192.168.1.100
PROXY_PORT=4444
ssh -N -D $PROXY_PORT $PROXY_IP &
ID=$!
chromium-browser --proxy-server="socks://127.0.0.1:$PROXY_PORT"
kill $ID
@greenkey
greenkey / waitUntilSQL.vbs
Created April 29, 2015 16:10
vbscript: Execute an SQL query until the result is as expected
' executes the query to the DB while the results is not as expected
' the query MUST return at least one record with a field named CHECK_VAL
' the loop will stop when CHECK_VAL = check_val (Function parameter)
' or when the timeout is reached (milliseconds)
' the return value will be True (check ok) or False (timeout reached)
' waitBetweenQueries is the milliseconds to wait between the query execution
Function waitUntilSQL(connection, sql, check_val, timeout, waitBetweenQueries)
Dim response, startTime
' default values
If IsEmpty(timeout) Then timeout = 60000
@greenkey
greenkey / urlencode.vbs
Created April 29, 2015 08:31
vbscript: URLEncode
' Encode special characters of a string
' this is useful when you want to put a string in the URL
' inspired by http://stackoverflow.com/questions/218181/how-can-i-url-encode-a-string-in-excel-vba
Public Function URLEncode( StringVal )
Dim i, CharCode, Char, Space
Dim StringLen
StringLen = Len(StringVal)
ReDim result(StringLen)
@greenkey
greenkey / Oracle_String_To_Array_and_Query.sql
Last active August 29, 2015 14:18
The problem: you have a comma separated string that you have to use for a query.
DECLARE
a dbms_utility.uncl_array;
len PLS_INTEGER;
input_string STRING(999) := '0099905666,0099905667,0099905668,0099905669';
my_code STRING(99);
BEGIN
-- add a letter to make it works
input_string := 'x' || Replace(input_string,',',',x');
-- convert the string in an array
dbms_utility.Comma_to_table(input_string, len, a);
@greenkey
greenkey / export_schema.sql
Last active August 29, 2015 14:18
Export Oracle Schema
set long 10000000
set head off
set echo off
set pagesize 0
set verify off
set feedback off
SET LINESIZE 32000
COL ddl FORMAT A32000
spool schema.sql
@greenkey
greenkey / ssh-regsrv.sh
Last active February 25, 2016 12:46 — forked from anonymous/ssh-regsrv.sh
#!/bin/bash
if [ ! -f ~/.ssh/id_rsa.pub ]; then
ssh-keygen
fi
echo "Server host:"
read SRV
echo "User on the server host:"
@greenkey
greenkey / renameImage.sh
Created February 14, 2015 17:32
rename images based on EXIF data, move it in proper directory
#!/bin/bash
# usage:
# $0 path/to/image/or/dir path/to/destination/dir
#
# the file will be renamed using EXIF data:
# YYYYMMDD-image_name
#
# if the second parameter is specified, a directory structure will be created:
# path/to/destination/dir/YYYY/YYYY-MM/image_new_name