Skip to content

Instantly share code, notes, and snippets.

Avatar

Michel Luiz Milezzi michelmilezzi

View GitHub Profile
@svett
svett / compress.go
Last active Jul 29, 2021
ZIP archives in Golang
View compress.go
import (
"archive/zip"
"io"
"os"
"path/filepath"
"strings"
)
func zipit(source, target string) error {
zipfile, err := os.Create(target)
@fphilipe
fphilipe / exclude.sql
Last active Jun 10, 2021
PostgreSQL EXCLUDE constraint
View exclude.sql
CREATE EXTENSION btree_gist;
CREATE TABLE room_reservations (
room_id integer,
reserved_at timestamptz,
reserved_until timestamptz,
canceled boolean DEFAULT false,
EXCLUDE USING gist (
room_id WITH =, tstzrange(reserved_at, reserved_until) WITH &&
) WHERE (not canceled)
@staltz
staltz / introrx.md
Last active Jul 30, 2021
The introduction to Reactive Programming you've been missing
View introrx.md
@soheilhy
soheilhy / nginxproxy.md
Last active Jul 29, 2021
How to proxy web apps using nginx?
View nginxproxy.md

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@hgmnz
hgmnz / query_planner.markdown
Created Mar 23, 2011
PostgreSQL query plan and SQL performance notes
View query_planner.markdown

Types of index scans

Indexes

Sequential Scan:

  • Read every row in the table
  • No reading of index. Reading from indexes is also expensive.