Skip to content

Instantly share code, notes, and snippets.

View eliocapelati's full-sized avatar
👋
Hello world!

Elio eliocapelati

👋
Hello world!
View GitHub Profile
@eliocapelati
eliocapelati / lastfm.py
Last active June 13, 2022 14:55
Usage: $ python3 lastfm_cli.py username
import requests
from requests import Session
import json
from pprint import pprint
import os
import sys
class Lastfm:
url = 'http://ws.audioscrobbler.com/2.0/'
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
Africa/Blantyre
@eliocapelati
eliocapelati / logback-spring.xml
Created November 16, 2017 16:38 — forked from thomasdarimont/logback-spring.xml
logback+graylog spring configuration example
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration>
<configuration>
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} [%X{svc_usr}]%clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<contextName>test</contextName>
Array.from({length: 5}, (v, k) => moment().subtract(k, 'month').format("MM/YYYY"));
{
"extractors": [
{
"title": "KONG_JSON",
"extractor_type": "json",
"converters": [],
"order": 0,
"cursor_strategy": "copy",
"source_field": "message",
"target_field": "",
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@eliocapelati
eliocapelati / dynamo_json_to_csv.py
Created April 25, 2017 19:28
Convert a dynamodb result [json] to csv
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
__author__ = "Elio Capelati Jr"
__version__ = "1.0.0"
import csv, json, sys, argparse
from pprint import pprint
CREATE TABLE worldbank_countries(
countries jsonb
);
import json
import psycopg2
from pprint import pprint
def main():
sql_insert = """INSERT INTO
worldbank_countries(countries)
VALUES (%s);"""