Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
"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
flinox / mdm_purge.py
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
View mdm_purge.py
# ------------------------------------------------------------------------------
# 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: https://www.informatica.com/br/products/master-data-management.html
#
# ##### 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
flinox / docker_without_sudo.sh
Last active May 18, 2019
Run docker without sudo on Linux
View docker_without_sudo.sh
# Run Docker without sudo
sudo gpasswd -a $USER docker
sudo setfacl -m user:$USER:rw /var/run/docker.sock
@flinox
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
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
flinox / kafka_create_topic.sh
Created Feb 19, 2019
Kafka: To create a topic kafka
View kafka_create_topic.sh
# 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
flinox / consume_message_avro_through_api.sh
Last active Feb 19, 2019
Kafka: Consume message in avro format of a kafka topic with api of confluent REST proxy
View consume_message_avro_through_api.sh
-- CREATE CONSUMER
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
flinox / produce_message_avro_through_api.sh
Last active Feb 19, 2019
Kafka: Produce message in avro format on a kafka topic through confluent REST proxy
View produce_message_avro_through_api.sh
-- PRODUCE MESSAGE AVRO
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\":\"br.com.flinox\",\"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
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: https://www.dba-scripts.com/scripts/diagnostic-and-tuning/troubleshooting/database-activity-log_history/
-- 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
select round(avg(LOG_SWITCHES)) LOG_SWITCHES, DAY
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
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;
-- NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
-- undo_management string AUTO
-- undo_retention integer 60000
SELECT * FROM OWNER.TABLE_NAME
You can’t perform that action at this time.