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 "[email protected]:"]
insteadOf = git://github
@ebarault
ebarault / system.sh
Last active September 7, 2020 15:25
Which process uses a given port
sudo lsof -i:40025
import boto3
from boto3.session import Session
role_arn = os.environ.get('ASSUME_ROLE')
if roleArn:
client = boto3.client('sts')
assumed_role = client.assume_role(RoleArn=roleArn, RoleSessionName='test')
session = Session(aws_access_key_id=assumed_role['Credentials']['AccessKeyId'],
aws_secret_access_key=assumed_role['Credentials']['SecretAccessKey'],
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;

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 / 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 {
@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