Skip to content

Instantly share code, notes, and snippets.

View svilensabev's full-sized avatar

Svilen Sabev svilensabev

  • Belgium
View GitHub Profile
@svilensabev
svilensabev / resolv.conf
Created April 12, 2021 19:56
resolv.conf
search argo.svc.cluster.local svc.cluster.local cluster.local
nameserver 8.8.8.8
options ndots:5
@svilensabev
svilensabev / gist:713584cd30133969f395d1333563031e
Created March 9, 2020 15:05
PostgreSQL timeslots, rrulesets and booking timetables
-- First create schema/data data for tests
DROP TABLE api.slot CASCADE;
CREATE TABLE api.slot (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
name TEXT,
latitude NUMERIC,
longitude NUMERIC,
geog geography(Point, 4326) DEFAULT NULL
@svilensabev
svilensabev / gist:4f06eedf58665214279063c76e326980
Created March 4, 2020 11:36
PostgreSQL function to find points in distance
BEGIN;
CREATE OR REPLACE FUNCTION api.geog_points_in_distance(latitude NUMERIC, longitude NUMERIC, distance NUMERIC)
RETURNS JSON
SECURITY DEFINER
LANGUAGE PLPGSQL STABLE
SET search_path TO PUBLIC, api
AS $$
DECLARE
_lat NUMERIC DEFAULT latitude::NUMERIC;
@svilensabev
svilensabev / gist:2b38e11db8561db1a187e574ec62d536
Last active March 4, 2020 12:00
PostGIS Geography points - test
DROP TABLE api.geog_point;
CREATE TABLE api.geog_point (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
name TEXT,
latitude NUMERIC,
longitude NUMERIC,
geog geography(Point, 4326) DEFAULT NULL
);
@svilensabev
svilensabev / gist:09279694e6f3db9cc33f1f85398b3bda
Created March 4, 2020 11:33
PostGIS Geometry points - test
DROP TABLE api.geom_point;
CREATE TABLE api.geom_point (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
name TEXT,
latitude NUMERIC,
longitude NUMERIC,
geom geometry(Point, 4326) DEFAULT NULL
);
@svilensabev
svilensabev / DevOps-paper.md
Last active November 27, 2019 10:14
DevOps paper

DevOps


1. Provisioning staging VPS

Secure server

  • Firewall
  • SSH configuration
@svilensabev
svilensabev / postgres-cheatsheet.md
Created February 23, 2018 12:47 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)