Skip to content

Instantly share code, notes, and snippets.

ELECT 'Menores',
SUM(IFNULL(M_Menores,0)) + SUM(IFNULL(S_Menores,0)) + SUM(IFNULL(A_Menores,0)) + SUM(IFNULL(O_Menores,0)) AS cantidad
FROM dev_dashboard
WHERE DATE(Fecha_Inicio) >= DATE(${pStartDate})
AND DATE(Fecha_Inicio) <= DATE(${pEndDate})
AND if('Todas' in (${pLocalizacion}),Localizacion in (SELECT Localizacion
FROM dev_dashboard
WHERE DATE(Fecha_Inicio) >= DATE(${pStartDate})
AND DATE(Fecha_Inicio) <= DATE(${pEndDate})),Localizacion in (${pLocalizacion}))
AND Entidad LIKE (case when ${pEntidad} = 'Todas' then '%' ELSE ${pEntidad} end)
@ravamo
ravamo / openssl
Created January 30, 2023 16:44
command example
openssl req -newkey rsa:4096 \ -nodes -sha256 \ -keyout ~/Docker-Registry/certs/domain.key \ -x509 -days 365 -out ~/Docker-Registry/certs/domain.crt \ -subj "/CN=<CN/FQDN/HOSTNAME>" \ -addext "subjectAltName=DNS:<CN/FQDN/HOSTNAME>"
@ravamo
ravamo / query
Created December 13, 2021 14:50
SELECT 'SENEGAL' AS `Country`,
`a`.`general_data_department_of_operation` AS `Region`,
`a`.`_uri` AS `Instance`,
`a`.`participants_gender_age_male_5` AS `M_Age 0-5`,
`a`.`participants_gender_age_male_6_12` AS `M_Age 6-12`,
`a`.`participants_gender_age_male_13_17` AS `M_Age 13-17`,
`a`.`participants_gender_age_male_18_35` AS `M_Age 18-35`,
`a`.`participants_gender_age_male_36_59` AS `M_Age 36-59`,
`a`.`participants_gender_age_male_60` AS `M_Age 60+`,
`a`.`participants_gender_age_female_5` AS `F_Age 0-5`,
SELECT Localizacion,
CASE
WHEN Localizacion = 'AL_Motril' THEN '36.7489494,-3.5272099'
WHEN Localizacion = 'OP_Almeria' THEN '36.8381400,-2.4597400'
WHEN Localizacion = 'OP_Cadiz' THEN '36.0141945,-5.608092'
WHEN Localizacion = 'OP_Ceuta' THEN '35.8896503,-5.3228365'
WHEN Localizacion = 'OP_Ceurta' THEN '35.8896503,-5.3228365'
WHEN Localizacion = 'OP_Malaga' THEN '36.7269049,-4.430228'
WHEN Localizacion = 'OP_Melilla' THEN '35.2900915,-2.9441166'
WHEN Localizacion = 'OI_Hierro' THEN '27.7290882,-18.0485305'
@ravamo
ravamo / git-hop
Last active November 26, 2021 08:37
error with git
org.apache.hop.core.exception.HopException:
There was an error doing a git pull
https://git.caib.es/ibestat/idatos/n1-sourcelayer: Redirection blocked: redirect https://git.caib.es/ibestat/idatos/n1-sourcelayer/ -> http://git.caib.es/ibestat/idatos/n1-sourcelayer.git/info/refs?service=git-upload-pack not allowed
at org.apache.hop.git.model.UIGit.pull(UIGit.java:477)
at org.apache.hop.git.GitGuiPlugin.gitPull(GitGuiPlugin.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hop.ui.core.gui.BaseGuiWidgets.lambda$getListener$1(BaseGuiWidgets.java:188)
@ravamo
ravamo / .env
Last active November 16, 2021 16:02
log
SSL_TYPE=selfsign
#DOMAIN=localhost
DOMAIN=odk.test.org
SYSADMIN_EMAIL=name@dmain.es
@ravamo
ravamo / git.py
Created August 24, 2021 08:00
AdrianRock
from datetime import time, datetime
import time
import pandas as pd
import dateutil.parser
import dateutil
import requests
from sqlalchemy import create_engine
import sqlite3
@ravamo
ravamo / query
Created March 1, 2021 16:16
query
INSERT INTO DM_EVENTS_AVOD
select
ad_request_created_at
,ad_request_uid_original
,AD_REQUEST_UID
,ROW_NUMBER() OVER (PARTITION BY AD_REQUEST_UID ORDER BY ad_order) as ad_request_uid_order
,channel_name
,ip_addr
,kvp_pod_type
,device_identifier_spotx
SELECT
rch.content_market_id
, rch.global_content_id
, rch.content_id
, rch.rbi_content_id
, cc.original_content_id
, cc.rbi_original_content_id
, rch.content_type
, rch.content_number
, rch.content_title
### DATES TO ITERATE ###
from datetime import datetime, timedelta
# Uses INI_DATE and END_DATE.
# Want to set dates Manually? Uncomment below.
# ***DO NOT FORGET*** to change it back!!!
# AVOD_DATE = "2019-09-25"