Skip to content

Instantly share code, notes, and snippets.

View 17twenty's full-sized avatar

Nick Glynn 17twenty

View GitHub Profile
@17twenty
17twenty / SEO-Guide.md
Last active May 2, 2026 22:35
Creating and building an SEO strategy for your site

Hey guys!

There's a TON of content out there on SEO - guides, articles, courses, videos, scams, people yelling about it on online forums, etc etc..

Most of it, however, is super impractical. If you want to start doing SEO TODAY and start getting results ASAP, you'll need to do a TON of digging to figure out what's important and what's not.

So we wanted to make everyone's lives super easy and distill our EXACT process of working w/ clients into a stupid-simple, step-by-step practical guide. And so we did. Here we are.

A bit of backstory:

@17twenty
17twenty / jsonfilter.go
Last active July 2, 2020 05:10
JSONFilteredByWhitelist filters an incoming JSON payload against a while list then applies the filtered payload to the destination struct.
package types
import (
"encoding/json"
"io"
"reflect"
"strings"
)
// JSONFilteredByWhitelist filters an incoming JSON payload against a while list,
@17twenty
17twenty / camelsnake.go
Created May 26, 2020 07:58
Snake To Camel and Camel To Snake Case In Go Golang
package main
import (
"fmt"
"regexp"
"strings"
)
// Regex
@17twenty
17twenty / demo.go
Created May 21, 2020 07:40
Implementing Custom Marshal / Unmarshal for a custom type (and using an interface)
package main
import (
"bytes"
"encoding/json"
"fmt"
"log"
"os"
"strconv"
)
@17twenty
17twenty / reader.go
Created May 19, 2020 01:54
CGo and Shared Memory
package main
// #include <stdlib.h>
// #include <string.h>
// #include <sys/shm.h>
// #include <sys/types.h>
// #include <stddef.h>
// int my_shm_open(char* filename, int open_flag){
// int shm_id;
// key_t key;
@17twenty
17twenty / the_marshal.go
Created May 7, 2020 07:28
Custom marshal/unmarshal leveraging Scan/Value() for JSON and Database usage
package main
import (
"database/sql/driver"
"encoding/json"
"fmt"
"strings"
)
type paymentOption int64
@17twenty
17twenty / accounting.go
Created March 2, 2020 03:16
Accounting and Formatting for Golang Shopspring decimal library
package quicka
import (
"fmt"
"strings"
"github.com/shopspring/decimal"
)
// FormatMoneyDecimal ...
@17twenty
17twenty / gist:ca503d3be60330e3b3d07799fcdbdc33
Created November 14, 2019 19:03 — forked from chanks/gist:7585810
Turning PostgreSQL into a queue serving 10,000 jobs per second

Turning PostgreSQL into a queue serving 10,000 jobs per second

RDBMS-based job queues have been criticized recently for being unable to handle heavy loads. And they deserve it, to some extent, because the queries used to safely lock a job have been pretty hairy. SELECT FOR UPDATE followed by an UPDATE works fine at first, but then you add more workers, and each is trying to SELECT FOR UPDATE the same row (and maybe throwing NOWAIT in there, then catching the errors and retrying), and things slow down.

On top of that, they have to actually update the row to mark it as locked, so the rest of your workers are sitting there waiting while one of them propagates its lock to disk (and the disks of however many servers you're replicating to). QueueClassic got some mileage out of the novel idea of randomly picking a row near the front of the queue to lock, but I can't still seem to get more than an an extra few hundred jobs per second out of it under heavy load.

So, many developers have started going straight t

@17twenty
17twenty / WorkingRemote.md
Created July 24, 2019 21:02
Top tips for working remotely

Be as available as possible This is probably the best piece of advice I received from a friend prior to starting my new job. Things move quickly back at the home office, and since you’re not there, there’s a built-in delay for someone wishing to communicate with you.

If it always takes hours for someone to get your ear for just a minute, you’ll build a reputation as someone who’s “never around”–even if only subconsciously–among your coworkers.

As a remote employee, you have to work harder at being available to avoid the impression that you’re never available.

Strive to build a reputation as someone who is quick to respond. Be eager to hear the latest developments on projects so that you’re never out of sync with everyone else in your office.

@17twenty
17twenty / readme.md
Created July 22, 2019 04:08
Using golang-migrate AKA mattes/migrate with Docker, Postgres and creating new schemas.

Using golang-migrate AKA mattes/migrate with Docker, Postgres and creating new schemas.

Prerequisites

We use the golang-migrate tool (formerly known as mattes/migrate) - build it with postgres support.

$ go get -v -u -tags 'postgres' github.com/golang-migrate/migrate/cli
$ migrate -h
Usage: migrate OPTIONS COMMAND [arg...]