Skip to content

Instantly share code, notes, and snippets.

Avatar

Michel Luiz Milezzi michelmilezzi

View GitHub Profile
@svett
svett / compress.go
Last active Aug 28, 2020
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 Oct 23, 2020
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 Oct 27, 2020
The introduction to Reactive Programming you've been missing
View introrx.md
@soheilhy
soheilhy / nginxproxy.md
Last active Oct 25, 2020
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.
You can’t perform that action at this time.