Skip to content

Instantly share code, notes, and snippets.

View RichardKnop's full-sized avatar
🎯
Focusing

Richard Knop RichardKnop

🎯
Focusing
View GitHub Profile
@RichardKnop
RichardKnop / machinery.go
Created June 26, 2017 14:12
Machinery example: group of 100 tasks
package main
import (
"fmt"
"os"
"time"
"github.com/RichardKnop/machinery/v1"
"github.com/RichardKnop/machinery/v1/config"
"github.com/RichardKnop/machinery/v1/log"
@RichardKnop
RichardKnop / query_planner.markdown
Created February 27, 2021 21:24 — forked from hgmnz/query_planner.markdown
PostgreSQL query plan and SQL performance notes

Types of index scans

Indexes

Sequential Scan:

  • Read every row in the table
  • No reading of index. Reading from indexes is also expensive.
@RichardKnop
RichardKnop / golang-tls.md
Created May 26, 2017 13:31 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@RichardKnop
RichardKnop / accounting.sql
Created January 5, 2017 06:55 — forked from NYKevin/accounting.sql
Basic double-entry bookkeeping system, for PostgreSQL.
CREATE TABLE accounts(
id serial PRIMARY KEY,
name VARCHAR(256) NOT NULL
);
CREATE TABLE entries(
id serial PRIMARY KEY,
description VARCHAR(1024) NOT NULL,
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0),
-- Every entry is a credit to one account...
@RichardKnop
RichardKnop / merge_sort.go
Last active February 24, 2019 19:20
Merge Sort
package main
import (
"fmt"
)
func main() {
items := []int{4, 202, 3, 9, 6, 5, 1, 43, 506, 2, 0, 8, 7, 100, 25, 4, 5, 97, 1000, 27}
sortedItems := mergeSort(items)
fmt.Println(sortedItems)
package main
import (
"fmt"
)
func main() {
items := []int{4, 202, 3, 9, 6, 5, 1, 43, 506, 2, 0, 8, 7, 100, 25, 4, 5, 97, 1000, 27}
shellshort(items)
fmt.Println(items)
@RichardKnop
RichardKnop / comb_sort.go
Last active July 12, 2017 03:42
Comb Sort
package main
import (
"fmt"
)
func main() {
items := []int{4, 202, 3, 9, 6, 5, 1, 43, 506, 2, 0, 8, 7, 100, 25, 4, 5, 97, 1000, 27}
combsort(items)
fmt.Println(items)
@RichardKnop
RichardKnop / bubble_sort.go
Last active July 12, 2017 03:39
Bubble Sort
package main
import (
"fmt"
)
func main() {
items := []int{4, 202, 3, 9, 6, 5, 1, 43, 506, 2, 0, 8, 7, 100, 25, 4, 5, 97, 1000, 27}
bubbleSort(items)
fmt.Println(items)
@RichardKnop
RichardKnop / insertion_sort.go
Last active July 12, 2017 03:29
Insertion Sort
package main
import (
"fmt"
)
func main() {
items := []int{4, 202, 3, 9, 6, 5, 1, 43, 506, 2, 0, 8, 7, 100, 25, 4, 5, 97, 1000, 27}
insertionSort(items)
fmt.Println(items)
@RichardKnop
RichardKnop / selection_sort.go
Last active July 12, 2017 03:29
Selection Sort
package main
import (
"fmt"
)
func main() {
items := []int{4, 202, 3, 9, 6, 5, 1, 43, 506, 2, 0, 8, 7, 100, 25, 4, 5, 97, 1000, 27}
selectionSort(items)
fmt.Println(items)