Skip to content

Instantly share code, notes, and snippets.

View jbfarez's full-sized avatar

Jean-Baptiste Farez jbfarez

View GitHub Profile
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active July 18, 2024 22:25
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@obolton
obolton / elb-nodejs-ws.md
Last active November 12, 2023 11:49
Configuring an AWS Elastic Load Balancer for a Node.js application using WebSockets on EC2

AWS ELB with Node.js and WebSockets

This assumes that:

  • You are using Nginx.
  • You want to accept incoming connections on port 80.
  • Your Node.js app is listening on port 3000.
  • You want to be able to connect to your Node.js instance directly as well as via the load balancer.

####1. Create load balancer

@oinopion
oinopion / read-access.sql
Created October 5, 2016 13:00
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
@QuingKhaos
QuingKhaos / 15-acme-operations.tf
Last active August 8, 2020 18:56
Terraform initialization of AWS sub account
// Configure AWS provider
variable "acme_operations" {
default = "ACCOUNTID"
}
provider "aws" {
alias = "acme_operations"
profile = "acme_operations"
region = "${var.aws_default_region}"
shared_credentials_file = "./credentials"
@troyfontaine
troyfontaine / 1-setup.md
Last active July 17, 2024 22:30
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

@jhchabran
jhchabran / heetch_SA_nov_2017.md
Last active April 20, 2018 14:08
Heetch Stars & Articles #1
@StevenACoffman
StevenACoffman / goGetPrivate.md
Last active July 13, 2024 20:27 — forked from dmitshur/gist:6927554
How to `go get` private repos using SSH key auth instead of password auth.

Set GOPRIVATE to match your github organization

I keep fixing this up, but if it fails for you, check if these are better maintained https://tip.golang.org/cmd/go/#hdr-Configuration_for_downloading_non_public_code and https://golang.org/ref/mod#private-modules.

Cloning the repo using one of the below techniques should work correctly but you may still be getting an unrecognized import error.

As it stands for Go v1.13, I found in the doc that we should use the GOPRIVATE variable like so:

GOPRIVATE=github.com/ORGANISATION_OR_USER_NAME go get -u -f github.com/ORGANISATION_OR_USER_NAME/REPO_NAME

The 'go env -w' command (see 'go help env') can be used to set these variables for future go command invocations.