Skip to content

Instantly share code, notes, and snippets.

@brygom
brygom / gist:edc88062a341c40e825f44f1817e5b0d
Created July 5, 2016 01:03 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@brygom
brygom / install_psql_php.sh
Created December 14, 2016 04:00 — forked from doole/install_psql_php.sh
Install PostgreSQL PHP extensions on Mac OS X
#!/bin/bash
# Install Xcode Command Line Tools first (required)
xcode-select --install
# Check PHP version `php --version`
PHP_VER=$(php -v | head -1 | awk '{ print $2 }')
# Extensions directory (default: empty string)
EXT_DIR=""
@brygom
brygom / fullquery
Created March 13, 2017 18:44 — forked from OllieJones/fullquery
Fast nearest-location finder for SQL (MySQL, PostgreSQL, SQL Server)
SELECT zip, primary_city,
latitude, longitude, distance
FROM (
SELECT z.zip,
z.primary_city,
z.latitude, z.longitude,
p.radius,
p.distance_unit
* DEGREES(ACOS(COS(RADIANS(p.latpoint))
* COS(RADIANS(z.latitude))
@brygom
brygom / gist:50110a29b2916c4fee5b8dced55e528f
Created January 24, 2018 19:09 — forked from ruckus/gist:2293434
Basic setup of WAL-E for continuous archiving and recovery

WAL-E needs to be installed on all machines, masters and slaves.

How to install WAL-E

Only one machine, the master, writes WAL segments via continuous archiving. The configuration for the master postgresql.conf is:

archive_mode = on
archive_command = 'envdir /etc/wal-e.d/env wal-e wal-push %p'
archive_timeout = 60
@brygom
brygom / centos.install.boost.md
Created June 11, 2018 15:46 — forked from 1duo/centos.install.boost.md
Install Boost library from source on CentOS 7.
wget https://cfhcable.dl.sourceforge.net/project/boost/boost/1.54.0/boost_1_54_0.tar.gz
wget https://phoenixnap.dl.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.tar.gz
wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.gz
wget https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz
  • Unzip
@brygom
brygom / mongo-docker.bash
Created December 8, 2018 04:41 — forked from davideicardi/mongo-docker.bash
Running mongodb inside a docker container (with mongodb authentication)
# Create a container from the mongo image,
# run is as a daemon (-d), expose the port 27017 (-p),
# set it to auto start (--restart)
# and with mongo authentication (--auth)
# Image used is https://hub.docker.com/_/mongo/
docker pull mongo
docker run --name YOURCONTAINERNAME --restart=always -d -p 27017:27017 mongo mongod --auth
# Using the mongo "localhost exception" (https://docs.mongodb.org/v3.0/core/security-users/#localhost-exception)
# add a root user
@brygom
brygom / README-Template.md
Created April 21, 2019 05:34 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@brygom
brygom / logger.ts
Created October 15, 2020 02:01 — forked from jkyoutsey/logger.ts
ngx logger class for consistent logging. Based on angular/cli's use of environments.
import { Injectable } from '@angular/core';
import { environment } from '@environments/environment';
/**
* Class of static methods to allow for consistent console logging.
* @export
*/
@Injectable({
providedIn: 'root'
@brygom
brygom / logger.spec.ts
Created October 15, 2020 02:01 — forked from jkyoutsey/logger.spec.ts
Unit test for logger.ts
import { Logger } from './logger';
import { environment } from '@environments/environment';
describe('Logger Spec', () => {
let debug;
let info;
let warn;
let err;
let log;
@brygom
brygom / letsencrypt_2020.md
Created October 21, 2020 04:16 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files: