Skip to content

Instantly share code, notes, and snippets.

Felix Geisendörfer felixge

Block or report user

Report or block felixge

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View linux.sql
SELECT version();
version
----------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 11.5 (Debian 11.5-1.pgdg90+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit
(1 row)
-- Why is this returning true?
-- I think { and [ are considered to sort equally on this machine's `en_US` collation,
-- so the result is the same as `'{' < '{a'`
SELECT '{' < '[a' COLLATE "en_US";
View collate_c_sort_perf.sql
SHOW LC_COLLATE;
lc_collate
-------------
en_US.UTF-8
(1 row)
EXPLAIN ANALYZE
SELECT g::text FROM generate_series(1, 10000) g ORDER BY 1;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------
View main.go
package main
import "fmt"
func main() {
f1 := &Foo{}
f2 := &Foo{}
fmt.Printf("%p = %p\n", f1, f2)
b1 := &Bar{}
View chat.go
package main
import (
"bufio"
"fmt"
"io"
"log"
"net"
"os"
"sync"
View decoder.rb
encoded_in = "\x00\x00\x00\x03aaa\x00\x00\x00\x06Binary\x02\x00\x00\x00\fP\x00\x84A\xEB\xF9~?\x966\xE7\x8A\x00\x00\x00\x03ccc\x00\x00\x00\x06String\x01\x00\x00\x00\x04test\x00\x00\x00\x03zzz\x00\x00\x00\x06Number\x01\x00\x00\x00\a0230.01\x00\x00\x00\x10\xC3\xB6ther_encodings\x00\x00\x00\x06String\x01\x00\x00\x00\x05T\xC3\xBCst"
class EncodedMessage
attr_accessor :data
attr_accessor :md5
def initialize(data, md5)
@data = [data].pack('a*')
@md5 = md5
# TODO(fg) verify md5
View stable-vs-immutable.sql
psql (9.6.3, server 10.1)
WARNING: psql major version 9.6, server major version 10.
Some psql features might not work.
Type "help" for help.
postgres=# CREATE FUNCTION date_round(base_date timestamptz, round_interval INTERVAL) RETURNS timestamptz AS $BODY$
postgres$# SELECT TO_TIMESTAMP((EXTRACT(epoch FROM $1)::INTEGER + EXTRACT(epoch FROM $2)::INTEGER / 2)
postgres$# / EXTRACT(epoch FROM $2)::INTEGER * EXTRACT(epoch FROM $2)::INTEGER)
postgres$# $BODY$ LANGUAGE SQL STABLE;
CREATE FUNCTION
View pg-vs-mapd.md
View context.md
View unfuck_docker.bash
#!/usr/bin/env bash
# see https://github.com/docker/for-mac/issues/668
set -eu
cd ~/Library/Containers/com.docker.docker/Data/database/
git reset --hard
echo false > com.docker.driver.amd64-linux/disk/full-sync-on-flush
git add com.docker.driver.amd64-linux/disk/full-sync-on-flush
git commit -s -m "Unfucked docker"
You can’t perform that action at this time.