Skip to content

Instantly share code, notes, and snippets.

View NunoSempere's full-sized avatar

Nuño Sempere NunoSempere

View GitHub Profile
@NunoSempere
NunoSempere / get_top_tweets.sh
Last active March 8, 2025 22:14
Get top tweets from account
curl https://fabxmporizzqflnftavs.supabase.co/storage/v1/object/public/archives/nunosempere/archive.json | \
jq .tweets \
| jq 'sort_by(.tweet.favorite_count | tonumber) | reverse' \
| jq '.[] | {favorite_count: .tweet.favorite_count, full_text: .tweet.full_text, id_str: .tweet.id_str, url: ("https://x.com/NunoSempere/status/" + .tweet.id_str) }' \
| tee -a top.json
n = 1000000
x1 <- rbeta(n, shape1=1, shape2=59)
mean(x1) # 0.01665996
x2 <- rbeta(n, shape1=1, shape2=59)
mean(x2) # 0.01664794
x3 <- rbeta(n, shape1=1, shape2=59)
mean(x3) # 0.016663
x <- x1 + x2 + x3
mean(x) # 0.0499709 # about 5%
import axios from "axios";
const endpoint = "https://clob.polymarket.com/markets"
const fetchByCursor = async (cursor) => {
let response = await axios
.get(
`${endpoint}${!! cursor ? "?next_cursor=" : ""}${cursor || ""}`
// "https://strapi-matic.poly.market/markets?active=true&_sort=volume:desc&_limit=-1" to get all markets, including closed ones
)
getSomeHoursPerDay() = sample(5 to 16)
getSomeDaysPerWeek() = round(sample(5 to 6))
getSomeHoursPerWeek() = {
num_days = getSomeDaysPerWeek()
temp_list = List.upTo(1, round(num_days))
list_hours_day = List.map(temp_list, {|x| getSomeHoursPerDay()})
hours_week = List.reduce(list_hours_day, 0, {|a,b| a+b})
hours_week
}
valueOfInterventionInPopulation(num_beneficiaries, population_age_distribution, benefitForPersonOfAge) = {
age_of_beneficiaries = sampleN(population_age_distribution, num_beneficiaries)
benefits_array = List.map(age_of_beneficiaries, {|a| benefitForPersonOfAge(a)})
total_benefits = List.reduce(benefits_array, 0, {|acc, value| acc + value})
total_benefits
}
valueWithUncertaintyAboutNumBeneficiaries(num_beneficiaries_dist, population_age_distribution, benefitForPersonOfAge) = {
referenceN = 1000
referenceValue = valueOfInterventionInPopulation(referenceN, population_age_distribution, benefitForPersonOfAge)
// Helpers
ss(arr) = SampleSet.fromList(arr)
// Nuclear ukraine
rusiaUsesNuclearWeaponsInUkraine = ss([0.27, 0.04, 0.02, 0.001, 0.09, 0.08, 0.07])// <- fill-in
// Note that the period of time is left unspecified
// Nuclear NATO
escalationOutsideUkraineGivenUkraineWasNuked = ss([0.15, 0.09, 0.0013, 10^(-5), 0.01, 0.3, 0.05])// <- fill-in
escalationToNATOUnconditional = rusiaUsesNuclearWeaponsInUkraine *
Tipo de jornada Intervalos de salario Intervalos de salario (euros) Sexo Periodo Total SMES-min SMES-max Mínimo en rango Máximo en rango
Total De 0 a 1 SMI 0–13300 Ambos sexos 2020 19,36 0 1 0 13300
Total De 1 a 2 SMI 13300–26600 Ambos sexos 2020 46,65 1 2 13300 26600
Total De 2 a 3 SMI 26600–39900 Ambos sexos 2020 19,58 2 3 26600 39900
Total De 3 a 4 SMI 39900–53200 Ambos sexos 2020 8,35 3 4 39900 53200
Total De 4 a 5 SMI 53200–66500 Ambos sexos 2020 3,21 4 5 53200 66500
Total De 5 a 6 SMI 66500–79800 Ambos sexos 2020 1,66 5 6 66500 79800
Total De 6 a 7 SMI 79800–93100 Ambos sexos 2020 0,81 6 7 79800 93100
Total De 7 a 8 SMI 93100–106400 Ambos sexos 2020 0,24 7 8 93100 106400
Total Más de 8 SMI más de 106400 Ambos sexos 2020 0,14 8 NA 106400 NA
#!/bin/bash
#function playmusic(){
location="$1"
cd "$location"
touch .issongonrepeat.temp
echo false > .issongonrepeat.temp
stty -echoctl
### Prevents ctrl-c from being printed to console
function openWithEvilBrowser(){
google-chrome --disable-gpu --disable-software-rasterizer "$1" &
}
## Facebook
function fb(){
openWithEvilBrowser www.facebook.com
fileName="$em/people/socialmedia/peopleWithInterestingFacebooks.txt"
cat "$fileName"
@NunoSempere
NunoSempere / bivariate_normals.R
Last active May 10, 2022 16:00
Bivariate normals in R
## install.packages(ggplot)
## install.packages(viridis)
## install.packages(ggthemes)
library(ggplot2)
library(viridis)
library(ggthemes)
## Build data
data <- list()