Skip to content

Instantly share code, notes, and snippets.

View ebarault's full-sized avatar
💫

Eric Barault ebarault

💫
View GitHub Profile
@ebarault
ebarault / .gitconfig
Created January 8, 2021 15:51 — forked from Kovrinic/.gitconfig
git global url insteadOf setup
# one or the other, NOT both
[url "https://github"]
insteadOf = git://github
# or
[url "git@github.com:"]
insteadOf = git://github
URL="http://stackoverflow.com/"
# store the whole response with the status at the and
HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X POST $URL)
# extract the body
HTTP_BODY=$(echo $HTTP_RESPONSE | sed -e 's/HTTPSTATUS\:.*//g')
# extract the status
HTTP_STATUS=$(echo $HTTP_RESPONSE | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')
@ebarault
ebarault / MySQL.md
Last active March 29, 2018 09:31 — forked from hofmannsven/README.md
A simple MySQL Command Line Cheatsheet

Commands

Access monitor: mysql -h [host] -u [username] -p (will prompt for password)

Access database: mysql -h [host] -u [username] -p [database] (will prompt for password)

Users functions

@ebarault
ebarault / setup.config
Created March 7, 2018 09:15 — forked from miguelmota/setup.config
Elastic Beanstalk NGINX rewrite http to https using .ebextensions
files:
"/etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf":
mode: "000755"
owner: root
group: root
content: |
server {
listen 80;
gzip on;
@ebarault
ebarault / api.service.ts
Created November 17, 2017 15:09 — forked from viki53/api.service.ts
Using Cognito authentication with AWS Cognito in API Gateway
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { AuthGuardService } from './auth-guard.service';
import { AWS_APIGW_ID, AWS_REGION } from '../conf/aws.const';
export const API_ROOT = `https://${AWS_APIGW_ID}.execute-api.${AWS_REGION}.amazonaws.com/prd`;
@Injectable()
export class ApiService {
@ebarault
ebarault / api.service.ts
Created November 17, 2017 15:09 — forked from viki53/api.service.ts
Using Cognito authentication with AWS Cognito in API Gateway
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { AuthGuardService } from './auth-guard.service';
import { AWS_APIGW_ID, AWS_REGION } from '../conf/aws.const';
export const API_ROOT = `https://${AWS_APIGW_ID}.execute-api.${AWS_REGION}.amazonaws.com/prd`;
@Injectable()
export class ApiService {

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@ebarault
ebarault / protectUserId.js
Created March 9, 2017 13:08 — forked from skleeschulte/protectUserId.js
LoopBack 3 boot script for protecting userId properties on custom models
'use strict';
/**
* Add before safe hook and validation to all custom models with an userId property to prevent changing userId
* properties by non-admin users.
*/
const USER_ID_PROPERTY = 'userId';
const INVALID_USER_ID = -1;
@ebarault
ebarault / disable-remote-methods.js
Last active January 24, 2018 09:43 — forked from drmikecrowe/DisableAllMethods.js
Loopback mixin to disable or expose methods
// based on https://github.com/strongloop/loopback/issues/651#issuecomment-259540469
'use strict';
module.exports = function (Model, options) {
if(Model && Model.sharedClass) {
var methodsToExpose = options.expose || [];
var methodsToHide = options.hide || [];