Skip to content

Instantly share code, notes, and snippets.

View felipessalvatore's full-sized avatar

Felipe Salvatore felipessalvatore

View GitHub Profile
@felipessalvatore
felipessalvatore / temp.sh
Created February 22, 2019 03:09
get temperature
while true; do
acpi -t
sleep 5
done
@felipessalvatore
felipessalvatore / temp_check.sh
Created December 19, 2018 01:52
check temp bash
while sleep 2; do acpi -t; done
@felipessalvatore
felipessalvatore / cost_distribution.py
Last active December 1, 2018 20:04
Script to distribut costs over a dict of people
import numpy as np
p = {}
p["Felipe"] = 140
p["Pedri"] = 150
p["Ale"] = 495
p["Amanda"] = 0
p["Andre"] = 0
p["Caio"] = 0
@felipessalvatore
felipessalvatore / nips_pool.py
Last active October 25, 2018 14:03
nips pool data and manipulation
"""
I should like to say two things, one intellectual and one moral:
The intellectual thing I should want to say to them is this:
When you are studying any matter or considering any philosophy, ask yourself only what are the facts
and what is the truth that the facts bear out. Never let yourself be diverted either
by what you wish to believe or by what you think would have beneficent social effects
if it were believed, but look only and solely at what are the facts.
That is the intellectual thing that I should wish to say.
@felipessalvatore
felipessalvatore / read.py
Created September 4, 2018 01:07
read COntraQA
import os
folder = "RandomSeq"
seq = os.listdir(folder)
seq.sort()
for file in seq:
path = os.path.join(folder, file, "model.test")
from nltk.translate.bleu_score import sentence_bleu, brevity_penalty, SmoothingFunction
reference = [ "In the farm's afternoons there is too much blue".split(" ") ]
candidate = "In the afternoons of the farm there is too much blue".split(" ")
score = sentence_bleu(reference, candidate)
print("candidate1")
print(score)
print(len(reference[0]), len(candidate))
print("BP = {}".format(brevity_penalty(len(reference[0]), len(candidate))))
candidate = "In the farm's afternoons there is a lot of blue".split(" ")
score = sentence_bleu(reference, candidate)
@felipessalvatore
felipessalvatore / smart.py
Created April 18, 2018 17:46
generate course content
import argparse
def smart_generator(name,
class_name,
area,
credits,
professors):
content = """Disciplina {}
Tópicos Avançados de Pesquisa em @
@felipessalvatore
felipessalvatore / revisao.txt
Last active March 17, 2018 19:51
links para revisão
Directional Derivative
http://tutorial.math.lamar.edu/Classes/CalcIII/DirectionalDeriv.aspx
https://www.ime.unicamp.br/~valle/Teaching/MA211/Aula6.pdf
@felipessalvatore
felipessalvatore / write_img.py
Created February 7, 2018 20:26
write on image using cv2
import cv2
img = cv2.imread("0.png")
font = cv2.FONT_HERSHEY_PLAIN
bottomLeftCornerOfText = (15,25)
fontScale = 1
fontColor = (255,25,55)
lineType = 2
cv2.putText(img,"""up: 0.02""",
@felipessalvatore
felipessalvatore / ngram_overlap.py
Created December 18, 2017 17:00
using nltk to count N-gram overlap between two sentences
from nltk.translate.bleu_score import modified_precision
pt = "em plano aberto, a cidade parece linda"
ref = "in a wide shot, the city looks beautiful"
c1 = "in the open, the city looks beautiful"
c2 = "in open plan, the city looks gorgeous"