Skip to content

Instantly share code, notes, and snippets.

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -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)
-- ==========================================
-- 1. CREACIÓN DE TABLAS
-- ==========================================
CREATE TABLE clientes (
id SERIAL PRIMARY KEY,
nombre VARCHAR(100),
email VARCHAR(100),
telefono VARCHAR(20),
fecha_registro TIMESTAMP DEFAULT CURRENT_TIMESTAMP
@josepereza
josepereza / docker.md
Created February 14, 2026 17:11
Docker y docker compose cheat sheets

Docker Cheat Sheet — Containerization Platform

Complete Docker reference — images, containers, volumes, networks, Compose, Dockerfile, and multi-stage builds.

Images

docker images                        # List images
docker pull nginx:latest             # Pull image
docker build -t myapp:1.0 .         # Build from Dockerfile
@josepereza
josepereza / sql window functions.md
Created February 6, 2026 10:30
SQL WINDOW FUNCTIONS

SQL Window Functions Examples

This gist provides practical examples of SQL window functions to enhance your data analysis skills. Through these examples, you'll learn how to use various window functions to perform complex calculations like ranking, running totals, moving averages, and more.

1. Assign Row Numbers

SELECT id, salesperson, amount,
       ROW_NUMBER() OVER(ORDER BY amount DESC) AS row_num
FROM sales;
@josepereza
josepereza / postgres-query.md
Last active February 3, 2026 11:34
postgresql
@josepereza
josepereza / angular-infinite-scroll-cdk.md
Created October 2, 2020 13:42
Infinite Virtual Scroll with the Angular CDK

title: Infinite Virtual Scroll with the Angular CDK lastmod: 2018-10-21T18:16:07-07:00 publishdate: 2018-10-21T18:16:07-07:00 author: Jeff Delaney draft: false description: Build an Infinite Virtual Scroll with the Angular CDK tags: - angular

  • animation
const fetch = require('node-fetch')
/**********************************************************************************
OPCION TRADICIONAL
**********************************************************************************/
function getNombre(username){
const url = `https://api.github.com/users/${username}`
fetch(url)
.then( res => res.json() )
.then( json => { console.log(json.name) })
@josepereza
josepereza / GIT -guia rapida
Created March 18, 2020 07:38
GIT guia rapida
==========================================================================================
========== GIT – Guía rápida ==========
==========================================================================================
------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------

How to use Materialize CSS in Angular 7-8-9

  • Install the materialize-css node package in your application.
npm install materialize-css --save
  • Open angular.json file & add below styles & scripts.
  "styles": [
         "./node_modules/materialize-css/dist/css/materialize.css",