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 / 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
#
@szinck
szinck / alb_logs.sql
Created August 13, 2017 02:21
Athena Table for ALB Logs
-- This creates an athena table that can parse ALB logs.
-- Advantage of this over others are this works when the log ends with a trailing space
-- plus it also breaks the http request into route and params for easier grouping
CREATE EXTERNAL TABLE IF NOT EXISTS alb_logs (
type string,
timestamp string,
elb string,
client_ip string,
client_port int,
@duckworth
duckworth / alb.sql
Created December 20, 2016 19:56
AWS ALB Logs Athena RegexSerDe
CREATE EXTERNAL TABLE IF NOT EXISTS alb_logs (
type string,
timestamp string,
elb string,
client_ip string,
client_port int,
target_ip string,
target_port int,
request_processing_time double,
target_processing_time double,
@krischer
krischer / pandas.ipynb
Created March 25, 2013 11:26
Simple log analysis with Pandas
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gka
gka / contributions_per_candidate.r
Created February 8, 2012 13:59
Contributions per Candidate
# read csv file
ds <- read.csv('2012-Presidential-Campaign-Finance-Contributors.tsv', sep='\t')
# aggregate by candidate
res <- aggregate(ds$contb_receipt_amt, by=list(ds$cand_nm), FUN=sum, na.rm=TRUE)
X = data.frame(name=res$Group.1, amount=res$x)
# make data columns callable without typing X$ everytime
attach(X)
@diofeher
diofeher / abstract_factory
Created June 1, 2010 16:22
Abstract Factory Pattern implemented in Python
#!/usr/bin/python
# -*- coding : utf-8 -*-
"""
@author: Diogenes Augusto Fernandes Herminio <diofeher@gmail.com>
"""
from abc import ABCMeta
#Abstract Factory
class StandardFactory(object):