Skip to content

Instantly share code, notes, and snippets.

View glynnforrest's full-sized avatar

Glynn Forrest glynnforrest

View GitHub Profile
@shantanugadgil
shantanugadgil / important_links_for_consul_and_nomad.txt
Last active May 9, 2021 14:54
Important links for Consul and Nomad
@thecatontheflat
thecatontheflat / .docker-private-registry-with-read-write-control.md
Created June 10, 2019 15:19
Run docker private registry with read/write access control
@gentoomaniac
gentoomaniac / create_token.groovy
Created February 7, 2019 10:38
Create new style api tokens in jenkins via groovy script
import jenkins.model.User
import jenkins.security.ApiTokenProperty
import jenkins.security.apitoken.ApiTokenStore
def env = System.getenv()
// get the user object
User jjbUser = User.get(env.JENKINS_USER_NAME)
// Verify that it has a ApiTokenProperty and create one if not (not sure if required, playing save here)
@vudaltsov
vudaltsov / FixPostgreSQLDefaultSchemaListener.php
Last active June 27, 2024 16:45
Doctrine PostgreSQL Default Schema Fix For Symfony
<?php
declare(strict_types=1);
namespace App\Doctrine\EventListener;
use Doctrine\DBAL\Schema\PostgreSQLSchemaManager;
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
final class FixPostgreSQLDefaultSchemaListener
@rraval
rraval / postgres-collation.md
Last active December 6, 2023 16:25
PostgreSQL collation is a massive footgun

This is a slightly stripped down version from our internal bug tracker. The point of posting this publicly is part FYI, part peer review. I'm hoping someone can look at this, disagree, and tell me all the downsides of using the C locale or point out things I've misunderstood. The Recommendations section in particular is contextualized by our database serving a SaaS product for users from many different locales, thus making locale a render level concern. YMMV, caveat emptor, etc.


Collation defines the character ordering for textual data. For Postgres, https://www.postgresql.org/docs/current/static/locale.html:

The locale settings influence the following SQL features:

  • Sort order in queries using ORDER BY or the standard comparison operators on textual data
  • The upper, lower, and initcap functions
@greenbrian
greenbrian / vault-token-role-via-api.sh
Last active January 23, 2024 15:10
HashiCorp Vault Token Role overview
# start vault in dev mode
VAULT_UI=true vault server -dev -dev-root-token-id="password"
# write some secrets for our example usage
curl --request POST \
--silent \
--header "X-Vault-Token: password" \
--header "Content-Type: application/json" \
--data '{ "options": { "cas": 0 }, "data": { "username": "administrator", "password": "hunter2" } }' \
http://127.0.0.1:8200/v1/secret/data/dev | jq '.'
@asukakenji
asukakenji / 0-go-os-arch.md
Last active July 24, 2024 05:41
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@marklr
marklr / nginx.conf
Created April 25, 2017 11:43
Lua Preproc
http {
# ...
# 51Degrees data file; should be updated regularly.
51D_filePath /data/51Degrees-PremiumV3_2.dat;
51D_cache 0; # crucial - otherwise crashes might occur
lua_need_request_body on;
upstream backend {
least_conn;
keepalive 32;
@wojteklu
wojteklu / clean_code.md
Last active July 24, 2024 12:04
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules