Skip to content

Instantly share code, notes, and snippets.

"I don't want to believe. I want to know" - Carl Sagan

flinox flinox

"I don't want to believe. I want to know" - Carl Sagan
View GitHub Profile
flinox /
Last active Nov 27, 2019
A python script to to purge inactive records of many different sources from informatica MDM calling the service SIF ExecuteBatchDelete
# ------------------------------------------------------------------------------
# v1.0 - 2019-08-13 - Created by: Fernando Lino Di Tomazzo Silva
# v2.0 - 2019-11-27 - Updated by: Fernando Lino Di Tomazzo Silva
# Script para realizar expurgo de registros logicamente inativos das BO's do MDM da INFORMATICA.
# Mais informacoes sobre MDM da INFORMATICA em:
# ##### PRE REQS ######
# 1) Ter uma tabela criada que será usada para carregar os ID's dos registros para expurgar, Ex.:
# create table CMX_ORS.TB_PURGE_AUX
flinox /
Last active May 18, 2019
Run docker without sudo on Linux
# Run Docker without sudo
sudo gpasswd -a $USER docker
sudo setfacl -m user:$USER:rw /var/run/docker.sock
flinox / get_date_from_unix_epoch_value.sql
Created Feb 25, 2019
Oracle: Get the date from a unix epoch value
View get_date_from_unix_epoch_value.sql
select to_date('19700101','YYYYMMDD'+ ( 1 / 24 / 60 / 60 / 1000* <value_unix_epoch> from dual;
flinox / check_collation_sql_server.sql
Created Feb 21, 2019
SQL: Check the collation of the database SQL Server
View check_collation_sql_server.sql
Select ServerProperty('Collation')
flinox /
Created Feb 19, 2019
Kafka: To create a topic kafka
# partitions, how many files to store messages of topics
# replication-factor, how many copies of topics must store ( Ex.: number of nodes )
kafka-topics --zookeeper <zookeeper>:2181 --create --topic <topic-name> --partitions 3 --replication-factor 3
flinox /
Last active Feb 19, 2019
Kafka: Consume message in avro format of a kafka topic with api of confluent REST proxy
curl --request POST \
--url http://{{hostname_rest_proxy}}:8082/consumers/consumer-group-x \
--header 'content-type: application/vnd.kafka.v2+json' \
--data '{
"name": "client_x",
"format": "avro",
"auto.offset.reset": "latest",
"auto.commit.enable": "false"
flinox /
Last active Dec 6, 2020
Kafka: Produce message in avro format on a kafka topic through confluent REST proxy
curl --request POST \
--url http://{{hostname_rest_proxy}}:8082/topics/topic-name \
--header 'accept: application/vnd.kafka.v2+json, application/vnd.kafka+json, application/json' \
--header 'content-type: application/vnd.kafka.avro.v2+json' \
--data '{
"value_schema": "{\"namespace\":\"\",\"name\":\"course\",\"type\":\"record\",\"doc\":\"This schema defines a course\",\"aliases\":[\"class\",\"school\"],\"fields\":[{\"name\":\"course_source\",\"doc\":\"The system source of course\",\"type\":\"string\"},{\"name\":\"course_code\",\"doc\":\"The code of the course\",\"type\":\"int\"},{\"name\":\"course_name\",\"doc\":\"Name of the course\",\"type\":\"string\"},{\"name\":\"course_type\",\"doc\":\"Type of the course\",\"type\":\"string\"}]}",
"records": [
"value": {"course_source": "system_A", "course_code": 10, "course_name": "Information Systems", "course_type": "G"}
flinox / analyze_v$log_history.sql
Created Feb 15, 2019
Oracle: Analyze database statistics based on v$log_history
View analyze_v$log_history.sql
-- Source:
-- You can adapt the query to your needs, you just have to change the way you format the date to be able to drilldown to the precision you want.
-- Oracle PL/SQL
from (
select to_char(trunc(first_time), 'Day') DAY, TRUNC(FIRST_TIME, 'DDD'), count(*) LOG_SWITCHES
from v$log_history
group by TRUNC(FIRST_TIME, 'DDD'), to_char(trunc(first_time), 'Day')
order by 2
flinox / select_state_table_in_time.sql
Last active Feb 15, 2019
Oracle: Select the state of table from a specific moment on time
View select_state_table_in_time.sql
-- To know what time limit in time to get the state of table on Oracle
-- In this case, 60000 seconds, ~ 18 hrs
show parameter undo;
------------------------------------ ----------- ------------------------------
-- undo_management string AUTO
-- undo_retention integer 60000