Skip to content

Instantly share code, notes, and snippets.

View lfdesousa's full-sized avatar

Luis Filipe de Sousa lfdesousa

  • Elca
  • Lausanne, Suisse
View GitHub Profile
@lfdesousa
lfdesousa / main.yaml
Created June 26, 2022 16:36
Install prometheus node_exporter - Linux ARM 32 bits - Including on Raspberry PI 3B & 4B
---
# tasks file for roles/node-exporter
- name: check if node exporter exist
stat:
path: "{{ node_exporter_bin }}"
register: __check_node_exporter_present
- name: if node exporter exist get version
shell: "cat /etc/systemd/system/node_exporter.service | grep Version | sed s/'.*Version '//g"
register: __get_node_exporter_version
@lfdesousa
lfdesousa / main.yaml
Last active June 26, 2022 16:34
Install prometheus node_exporter - Linux ARM 64 bits - Including on Raspberry PI 4B
---
# tasks file for roles/node-exporter
- name: check if node exporter exist
stat:
path: "{{ node_exporter_bin }}"
register: __check_node_exporter_present
- name: if node exporter exist get version
shell: "cat /etc/systemd/system/node_exporter.service | grep Version | sed s/'.*Version '//g"
register: __get_node_exporter_version
@lfdesousa
lfdesousa / week4.sql
Last active August 13, 2018 07:01
Week 4 work for DW - UOL
-- Week4
CREATE TABLE flights_ls(year smallint, month smallint, day smallint, carrier varchar(80) distkey, origin char(3), dest char(3), aricraft_code char(3), miles int, departures int, minutes int, seats int, passangers int, freight_pounds int);
COPY flights_ls
FROM 's3://us-west-2-aws-training/awsu-spl/spl17-redshift/static/data/flights-usa'
credentials 'aws_iam_role=...'
GZIP
DELIMITER ','
REMOVEQUOTES;
COMMIT;
@lfdesousa
lfdesousa / pandas.ipynb
Created February 19, 2018 22:32 — forked from krischer/pandas.ipynb
Simple log analysis with Pandas
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lfdesousa
lfdesousa / autolog.py
Created October 25, 2017 21:34 — forked from brendano/autolog.py
python decorators to log all method calls, show call graphs in realtime too
# Written by Brendan O'Connor, brenocon@gmail.com, www.anyall.org
# * Originally written Aug. 2005
# * Posted to gist.github.com/16173 on Oct. 2008
# Copyright (c) 2003-2006 Open Source Applications Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@lfdesousa
lfdesousa / jwt.vcl
Created April 4, 2017 09:47 — forked from ThijsFeryn/jwt.vcl
A custom VCL procedure that validates a JSON Web Token. This procedure can be called from within your other VCL logic. You will need to install vmod_digest to have the digest functions.
sub jwt {
if(req.http.cookie ~ "^([^;]+;[ ]*)*token=[^\.]+\.[^\.]+\.[^\.]+([ ]*;[^;]+)*$") {
set req.http.x-token = ";" + req.http.Cookie;
set req.http.x-token = regsuball(req.http.x-token, "; +", ";");
set req.http.x-token = regsuball(req.http.x-token, ";(token)=","; \1=");
set req.http.x-token = regsuball(req.http.x-token, ";[^ ][^;]*", "");
set req.http.x-token = regsuball(req.http.x-token, "^[; ]+|[; ]+$", "");
set req.http.tmpHeader = regsub(req.http.x-token,"token=([^\.]+)\.[^\.]+\.[^\.]+","\1");
set req.http.tmpTyp = regsub(digest.base64url_decode(req.http.tmpHeader),{"^.*?"typ"\s*:\s*"(\w+)".*?$"},"\1");
@lfdesousa
lfdesousa / file.rb
Created March 1, 2015 15:37
aspnet/EntityFramework
https://github.com/aspnet/EntityFramework