Skip to content

Instantly share code, notes, and snippets.

View ebarault's full-sized avatar
💫

Eric Barault ebarault

💫
View GitHub Profile
@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 || [];
// started from https://github.com/strongloop/loopback/issues/651
'use strict';
let _ = require('lodash');
module.exports = function (Model, options) {
if(Model && Model.sharedClass) {
let enableFromACLs = options.enableFromACLs === false? false: true;
@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;

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 / git-cheatsheet.md
Last active February 18, 2019 15:43
Git cheatsheet

resync local branch with remote branch

git fetch origin
git reset --hard origin/master
git clean -f -d

delete last commit(s)

# last commit
@ebarault
ebarault / dockerClean.sh
Last active October 7, 2017 17:48
Shell cheat sheet
#stop all containers
#remove all containers
#remove all docker images
docker kill $(docker ps -q) && docker rm $(docker ps -a -q) && docker rmi $(docker images -q) -f
#remove all docker volumes
docker volume ls -qf dangling=true | xargs -r docker volume rm
#clear everything unused
docker ps -q | xargs -r docker stop
docker system purge -a
@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 {

Keybase proof

I hereby claim:

  • I am ebarault on github.
  • I am ebarault (https://keybase.io/ebarault) on keybase.
  • I have a public key ASAwGyo8PAJpsIAFbJ2b8lU4ghOfRP4nwh4eO2sGXkr48wo

To claim this, I am signing this object:

@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;