Skip to content

Instantly share code, notes, and snippets.

@joao
joao / get_excerpt.py
Created November 9, 2023 11:53
get excerpt from text
# get excerpt of article ————————————————————————————————————————————————————————————————
def get_excerpt(new_word, article_text, padding):
# Article text
text = article_text
# Find the index of the new_word in the text
# Convert both the text and the keyword to lowercase
keyword = new_word
text_lower = text.lower()
@joao
joao / users.csv
Created May 22, 2021 12:54
GitHub's first 2.5k users
id created_at login name location
1 2007-10-20 05:24:19 UTC mojombo Tom Preston-Werner San Francisco
2 2007-10-20 05:24:19 UTC defunkt Chris Wanstrath
3 2008-01-07 17:54:22 UTC pjhyett PJ Hyett San Francisco
4 2008-01-12 05:38:33 UTC wycats Yehuda Katz Portland, OR
5 2008-01-12 07:51:46 UTC ezmobius Ezra Zygmuntowicz In the NW
6 2008-01-12 15:15:00 UTC ivey Michael D. Ivey Tuscumbia, AL
7 2008-01-12 16:46:24 UTC evanphx Evan Phoenix Los Angeles, CA
17 2008-01-13 05:57:18 UTC vanpelt Chris Van Pelt San Francisco
18 2008-01-13 06:02:21 UTC wayneeseguin Wayne E. Seguin Buffalo, NY
@joao
joao / text.vtt
Last active September 26, 2022 15:48
Whisper P24 transcription
00:00.000 --> 00:06.880
Ora viva, a Itália vai a votos este domingo e por isso neste P24 estamos de olho no que
00:06.880 --> 00:13.120
se passa nestas eleições antecipadas que vão definir o futuro deste país europeu.
00:13.120 --> 00:18.680
Sofia Lorena está comigo ao telefone e vai começar por me explicar o que é que levou
00:18.680 --> 00:20.840
os italianos às urnas mais cedo.
00:20.840 --> 00:26.640
O que aconteceu nós sabemos e é fácil, relativamente fácil, não é fácil, fácil
@joao
joao / first_instagram_users.csv
Last active May 21, 2021 16:21
Instagram users up to ID 10000 (active as of 2018)
user_id username full_name link
3 kevin Kevin Systrom https://instagram.com/kevin
4 mikeyk Mike Krieger https://instagram.com/mikeyk
5 abbott @abbott🏌 https://instagram.com/abbott
6 nicole Nicole Systrom https://instagram.com/nicole
8 brow Tom Brow https://instagram.com/brow
10 standers https://instagram.com/standers
11 m Photographer of the Week https://instagram.com/m
12 kaitlyn Kaitlyn Krieger https://instagram.com/kaitlyn
13 uxgreg Greg Schwartz https://instagram.com/uxgreg
@joao
joao / Expresso
Created April 10, 2020 11:04
#luandaleaks
PwC afasta sócios envolvidos com Isabel dos Santos
A PwC foi durante anos a auditora que Isabel dos Santos foi chamar para a apoiar na reestruturação da Sonangol
FOTO RUI DUARTE SILVA
Jaime Esteves e Ivo Faria, sócios históricos, foram suspensos e estão a negociar a saída
ANABELA CAMPOS
APricewaterhouseCoopers (PwC) prometeu que ia investigar a fundo o envolvimento dos sócios portugueses com os negócios sob suspeita de Isabel dos Santos e que isso iria ter consequências. Está a cumprir. O relatório de investigação interna, em que o presidente da PwC mundial, Bob Mortiz, acabou por se envolver pessoalmente, vindo a Lisboa, está concluído e já foram identificados os sócios do escritório português que estiveram implicados: Jaime Esteves e Ivo Faria. Sócios com décadas de casa, estão ambos suspensos e já começaram a negociar a sua saída da big four, um processo que foi conduzido pela casa mãe, que enviou a Portugal um quadro norte-americano para coordenar a investigação.
@joao
joao / .bash_profile
Created December 19, 2015 23:09
alias
alias p="ps aux | grep $1"
alias whatsmyip="curl icanhazip.com"
alias sizeit="du -sh $1"
alias countfiles="find . -type f | wc -l"
alias brewupgrade="brew upgrade && brew prune && brew cleanup"
# open current directory files in Sublime Text
alias s="subl ."
@joao
joao / info.txt
Created March 3, 2020 12:17
urgencias
endpoint:
POST https://wabi-north-europe-api.analysis.windows.net/public/reports/querydata?synchronous=true
request body:
{"version":"1.0.0","queries":[{"Query":{"Commands":[{"SemanticQueryDataShapeCommand":{"Query":{"Version":2,"From":[{"Name":"r","Entity":"REDE_URGENCIA_MONIT__AGR_DIA_URG"}],"Select":[{"Column":{"Expression":{"SourceRef":{"Source":"r"}},"Property":"Data"},"Name":"REDE_URGENCIA_MONIT__AGR_DIA_URG.Data"},{"Aggregation":{"Expression":{"Column":{"Expression":{"SourceRef":{"Source":"r"}},"Property":"Total epis. urg."}},"Function":0},"Name":"Sum(REDE_URGENCIA_MONIT__AGR_DIA_URG.Total epis. urg.)"}],"Where":[{"Condition":{"Comparison":{"ComparisonKind":2,"Left":{"Column":{"Expression":{"SourceRef":{"Source":"r"}},"Property":"ano"}},"Right":{"Literal":{"Value":"2016D"}}}}}]},"Binding":{"Primary":{"Groupings":[{"Projections":[0,1]}]},"DataReduction":{"DataVolume":4,"Primary":{"BinnedLineSample":{}}},"Version":1}}}]},"CacheKey":"{\"Commands\":[{\"SemanticQueryDataShapeCommand\":{\"Query\":{\"Version
@joao
joao / index.html
Last active February 4, 2020 21:46
RR test
<style type="text/css">
h1 {
font-family: sans-serif;
color: pink;
cursor: pointer;
font-size: 36px;
}
@joao
joao / base2ocds_corrector.rb
Last active December 14, 2019 11:28
base2ocds_corrector.rb
open('base2ocds_corrected.json', 'a') do |f|
f << '['
File.readlines('./base2ocds.json').each_with_index do |line, index|
puts index + 1
f << line + ','
end
f << ']'
end
@joao
joao / report
Created October 4, 2019 16:08
Coconut battery crash on launch on macOS 10.14
Process: coconutBattery [60898]
Path: /Applications/coconutBattery.app/Contents/MacOS/coconutBattery
Identifier: com.coconut-flavour.coconutBattery
Version: 3.8.1 (3.8.1)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: coconutBattery [60898]
User ID: 501
Date/Time: 2019-10-04 17:06:15.148 +0100