Skip to content

Instantly share code, notes, and snippets.

View filipefigcorreia's full-sized avatar

Filipe Correia filipefigcorreia

View GitHub Profile
@filipefigcorreia
filipefigcorreia / github-prs.py
Created November 7, 2022 15:08
Gets some PR info for specified repositories
# based on https://stackoverflow.com/a/73978756/684253
import requests
from datetime import datetime
import csv
token = "<a personal token>"
def export_projects(base_urls, token, out_filename):
final_dataset = []
fmt = "%Y-%m-%dT%H:%M:%SZ"
@filipefigcorreia
filipefigcorreia / r_util.py
Last active May 28, 2020 16:41
A few functions for running statistical tests using python
# -*- coding: utf-8 -*-
# Credits:
# Chris Rodgers - https://github.com/cxrodgers/my/blob/master/stats.py
# Brent Pedersen - https://gist.github.com/brentp/853885
# Filipe Correia
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# The next block was borrowed and adapted from Chris Rodgers
# https://github.com/cxrodgers/my/blob/master/stats.py
@filipefigcorreia
filipefigcorreia / ex04.c
Last active April 13, 2017 23:19
Problema 4 da ficha 5
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#define MAXSIZE 1024
#define READ 0
#define WRITE 1
int main(int argc, char *argv[]){
Build_all matplotlib
Build matplotlib for i386, x86_64, armv7, arm64 (filtered)
Build matplotlib
Prebuild matplotlib for i386
Build matplotlib for i386
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz
Extracting in /tmp/tmpy6FNo8
Now working in /tmp/tmpy6FNo8/distribute-0.6.28
@filipefigcorreia
filipefigcorreia / octave.rb (v4)
Last active September 2, 2016 13:14
Copy of latest octave's brew formula (v4.x) with this fix: https://github.com/Homebrew/homebrew-science/issues/3669
class Octave < Formula
desc "High-level interpreted language for numerical computing"
homepage "https://www.gnu.org/software/octave/index.html"
revision 3
stable do
url "https://ftpmirror.gnu.org/octave/octave-4.0.3.tar.gz"
sha256 "5a16a42fca637ae1b55b4a5a6e7b16a6df590cbaeeb4881a19c7837789515ec6"
# Fix alignment of dock widget titles for OSX (bug #46592)
@filipefigcorreia
filipefigcorreia / solr-cheat-sheet.md
Last active August 23, 2016 07:04
Solr Cheat Sheet

Delete documents of an index

http://localhost:8983/solr/mycore/update?stream.body=<delete><query>*:*</query></delete>
http://localhost:8983/solr/mycore/update?stream.body=<commit/>
@filipefigcorreia
filipefigcorreia / kafka-cheat-sheet.md
Last active February 8, 2023 09:29
Apache Kafka Cheat Sheet

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --delete-config retention.ms

import scala.collection.mutable
import org.apache.flink.api.common.functions.FlatMapFunction
import org.apache.flink.streaming.api.scala._
import org.apache.flink.streaming.api.functions.sink.SinkFunction
import org.apache.flink.streaming.util.StreamingMultipleProgramsTestBase
import org.apache.flink.util.Collector
import org.junit.{Before, Test}
import org.junit.Assert.assertEquals
/* Non-working example of an unit test for a flink program. Somehow this
@filipefigcorreia
filipefigcorreia / GrampsCrossing.py
Last active May 28, 2020 17:26
Copy of the original GrampsCrossing.py by Peter Hewett (see https://www.gramps-project.org/bugs/view.php?id=6184) that finds layouts with less edge crossings, for relationship graphs generated by GRAMPS. Modified to handle everything in memory (i.e., without actually outputting DOT and PDF files) until the best result is reached. Now also suppor…
#!/usr/bin/python
#
# Peter Hewett (Modified by Filipe Correia)
# Copyright GPL 2012
#
# reorder Gramps dot file to minimise crossings in rel chart
# usage:
# run rel_graph in Gramps to produce .gv file
# copy .gv file and this .py file to the same directory
# in that directory, run
@filipefigcorreia
filipefigcorreia / model.py
Created March 30, 2012 09:02
Experiments on changing/extending python's object model using conventions
# -*- coding: utf-8 -*-
"""
Goal is to avoid reinventing the Wheel™, and try to use the python
language's mechanisms as much as possible, instead of implementing the
Type-Square pattern from scratch.
Entity is a metaclass. It descends from "type", and adds some extra data
to the class during its initialization. That data is used to "extend" the
"type" class.