Skip to content

Instantly share code, notes, and snippets.

@valeriocos
valeriocos / createsigilsindex.py
Created June 11, 2020 14:51
Create the .grimoirelab-sigils index and migrate the .kibana from ES 6.1 to ES 6.8
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2020 Bitergia
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
[
{
"conditions":[
{
"field":"id",
"value":"418754386_issue_comment_479915020"
}
],
"set_extra_fields":[
{
@valeriocos
valeriocos / snippet.py
Created June 7, 2020 16:42
using counter to count emotions
import collections
def __get_reactions(self, item):
item_reactions = item.get('award_emoji_data', [])
if item_reactions:
reactions_counter = collections.Counter([reaction["name"] for reaction in item_reactions])
item_reactions = [{"type": reaction, "count": reactions_counter[reaction]} for reaction in reactions_counter]
return {"reactions": item_reactions}
@valeriocos
valeriocos / migration68.py
Last active June 2, 2020 09:39
Import .kibana from 6.1 to 6.8
import json
import os
import subprocess
import re
# TARGET ES
ENV = 'localhost:9200'
# CREDENTIALS
USER = 'xxx'
PWD = 'xxx'
@valeriocos
valeriocos / sigilsmigration.py
Last active May 31, 2020 10:52
Create .grimoirelab-sigils index from a .kibana
import json
import requests
# TARGET ES
ENV = 'localhost:9200'
# CREDENTIALS
USER = 'xxx'
PWD = 'xxx'
{
"rocketchat_test_enriched_1" : {
"aliases" : { },
"mappings" : {
"items" : {
"dynamic_templates" : [
{
"notanalyzed" : {
"match" : "*",
"match_mapping_type" : "string",
@valeriocos
valeriocos / get-oauth2-token-slack-api
Created April 4, 2020 07:41
Get a OAuth2 token for Slack app using requests in Python3
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2020 Bitergia
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
@valeriocos
valeriocos / groups.io subscriptions for your email and pwd
Last active March 16, 2020 10:35
List groups.io subscriptions for a given email and pwd
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2020 Bitergia
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@valeriocos
valeriocos / groups.io subscriptions for your email and pwd
Created February 4, 2020 09:40
List groups.io subscriptions for a given email and pwd
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2020 Bitergia
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@valeriocos
valeriocos / organizations.json
Created December 24, 2019 10:47
Grimoirelab orgs file extended with IoT orgs
{
"blacklist": [],
"organizations": {
"2N Telekomunikace": [
{
"domain": "2n.cz",
"is_top": true
}
],
"2N Telekomunikacesss": [