Skip to content

Instantly share code, notes, and snippets.

View vmleon's full-sized avatar

Victor Martin vmleon

  • Oracle
  • Ireland
View GitHub Profile
@vmleon
vmleon / Dockerfile
Last active August 27, 2019 13:54
Dockerfile Spring Boot application
FROM openjdk:jre-alpine
WORKDIR /app
COPY libs libs/
COPY resources resources/
COPY classes classes/
ENTRYPOINT ["java", "-cp", "/app/resources:/app/classes:/app/libs/*", "space.vmleon.MyApplication"]
HEALTHCHECK CMD wget --quiet --tries=1 --spider http://localhost:8080/actuator/health || exit 1
EXPOSE 8080
@vmleon
vmleon / .vimrc
Last active January 23, 2020 00:07
Vim config file
set nocompatible
" Turn on syntax highlighting
syntax on
" Show line numbers
set number
" Show file stats
set ruler
@vmleon
vmleon / docker-bench-security.sh
Created July 7, 2020 16:02
Kubernetes Security
#!/bin/bash
docker run -it --net host --pid host --cap-add audit_control \
-e DOCKER_CONTENT_TRUST=$DOCKER_CONTENT_TRUST \
-v /var/lib:/var/lib \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /usr/lib/systemd:/usr/lib/systemd \
-v /etc:/etc --label docker_bench_security \
docker/docker-bench-security:latest
@vmleon
vmleon / cloud-generic.yaml
Created August 24, 2020 16:14
OKE Ingress Controller
kind: Service
apiVersion: v1
metadata:
name: ingress-nginx
namespace: ingress-nginx
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
spec:
type: LoadBalancer
@vmleon
vmleon / sdo_query_nn_example.sql
Last active January 14, 2021 16:18
Find the 5 customers closest to the warehouse whose warehouse ID is 3.
SELECT BRANCH_NAME
FROM
BRANCHES B,
WAREHOUSES W
WHERE
W.WAREHOUSE_NAME = 'Odessa Warehouse'
AND SDO_NN(B.GEOMETRY, W.GEOMETRY, 'sdo_num_res=5 unit=km', 1) = 'TRUE';
@vmleon
vmleon / spatial_warehouse_branches_insert_example.sql
Last active January 14, 2021 16:27
Oracle Spatial Example: Warehouses and Branches, insert statements
CREATE TABLE WAREHOUSES (WAREHOUSE_NAME VARCHAR2(30), LAT NUMBER, LON NUMBER);
CREATE TABLE BRANCHES (BRANCH_NAME VARCHAR2(30),ZIPCODE VARCHAR2(5), LAT NUMBER, LON NUMBER, BRANCH_TYPE VARCHAR2(30));
INSERT INTO WAREHOUSES VALUES ('Amarillo Warehouse',35.532226,-101.557617);
INSERT INTO WAREHOUSES VALUES ('Odessa Warehouse',31.334871,-102.062988);
INSERT INTO WAREHOUSES VALUES ('San Antonio Warehouse',29.496987,-98.833007);
INSERT INTO WAREHOUSES VALUES ('Waco Warehouse',31.27855,-97.097167);
INSERT INTO BRANCHES VALUES('Marshall Branch','75672',32.50555,-94.35579,'WHOLESALE');
INSERT INTO BRANCHES VALUES('Eagle Pass Branch','78852',28.6865,-100.47394,'RETAIL');
INSERT INTO BRANCHES VALUES('Cleburne Branch','76033',32.42166,-97.38356,'WHOLESALE');
INSERT INTO BRANCHES VALUES('Paris Branch','75460',33.66771,-95.5678,'RETAIL');
@vmleon
vmleon / spatial_warehouse_branches_clean_example.sql
Last active January 14, 2021 16:16
Oracle Spatial Example: Warehouses and Branches, clean statements
DROP TABLE BRANCHES;
DROP TABLE WAREHOUSES;
DELETE FROM USER_SDO_GEOM_METADATA;
@vmleon
vmleon / spatial_warehouse_branches_alter_example.sql
Last active January 14, 2021 16:29
Oracle Spatial Example: Warehouses and Branches, alter statements
ALTER TABLE WAREHOUSES ADD (GEOMETRY SDO_GEOMETRY);
ALTER TABLE BRANCHES ADD (GEOMETRY SDO_GEOMETRY);
UPDATE WAREHOUSES SET
GEOMETRY = SDO_GEOMETRY(2001, 4326, SDO_POINT_TYPE(LON, LAT, NULL), NULL, NULL);
UPDATE BRANCHES SET
GEOMETRY = SDO_GEOMETRY(2001, 4326, SDO_POINT_TYPE(LON, LAT, NULL), NULL, NULL);
@vmleon
vmleon / spatial_warehouse_branches_index_example.sql
Last active January 14, 2021 16:30
Oracle Spatial Example: Warehouses and Branches, index statements
INSERT INTO USER_SDO_GEOM_METADATA VALUES ('WAREHOUSES', 'GEOMETRY',
SDO_DIM_ARRAY(
SDO_DIM_ELEMENT('x', -180, 180, 0.05),
SDO_DIM_ELEMENT('y', -90, 90, 0.05)
),
4326 -- Code for Latitude/Longitude coordinate
);
INSERT INTO USER_SDO_GEOM_METADATA VALUES ('BRANCHES', 'GEOMETRY',
SDO_DIM_ARRAY(
@vmleon
vmleon / spatial_warehouse_branches_big_query_example.sql
Created January 14, 2021 16:13
Oracle Spatial Example: Warehouses and Branches, big query
SELECT
BRANCH_NAME,
ROUND(SDO_NN_DISTANCE(1), 2) DISTANCE_KM
FROM
BRANCHES B,
WAREHOUSES W
WHERE W.WAREHOUSE_NAME = 'Odessa Warehouse'
AND SDO_NN(B.GEOMETRY, W.GEOMETRY, 'sdo_num_res=5 unit=km', 1) = 'TRUE'
ORDER BY DISTANCE_KM;