Skip to content

Instantly share code, notes, and snippets.

View lparolari's full-sized avatar
🎯
Focusing

Luca Parolari lparolari

🎯
Focusing
  • University of Padova
  • Padova • Italy
  • 16:47 (UTC +02:00)
View GitHub Profile
@lparolari
lparolari / find-the-symmetric-difference.js
Created September 22, 2021 22:15
Very simple solution for symmetric difference between sets with functional set abstraction. (freecodecamp.org coding interview execise: https://www.freecodecamp.org/learn/coding-interview-prep/algorithms/find-the-symmetric-difference)
function exists(s, x) {
for (let i = 0; i < s.length; i++) {
if (s[i] === x)
return true
}
return false
}
function insert(s, x) {
if (!exists(s, x))
@lparolari
lparolari / day-stress-level-formula.notion
Created December 13, 2022 21:52
A Notion formula that given a number of task and events returns the stress level as a colorful emoji 🦄
if(prop("Tasks Number") == 0 and prop("Events Number") == 0, "🎉",
if(prop("Tasks Number") <= 2 and prop("Events Number") <= 0, "☕️",
if(prop("Tasks Number") <= 2 and prop("Events Number") <= 1, "⚡️",
if(prop("Tasks Number") <= 3 and prop("Events Number") <= 2, "🌩",
if(prop("Tasks Number") <= 4 and prop("Events Number") <= 3, "💥",
🌋
)
)
)
)
@lparolari
lparolari / task-aging.notion
Last active December 16, 2022 14:40
A Notion formula that given the "Created At" prop return ⚡, ☕, 🥱, 😴 as an indicator task aging in inbox state.
if(
prop("Status") == "Not started",
if(
dateBetween(
now(),
prop("Created At"),
"days"
) < 1,
"⚡",
if (
@lparolari
lparolari / notion-quotes.json
Last active February 12, 2023 14:52
A list of quotes for my Notion dashboard (powered by ChatGPT)
[
{
"author":"Alan Turing",
"content":"La vera maturità della scienza della computazione arriverà quando avremo sviluppato macchine che non possono essere distinguibili da quelle umane."
},
{
"author":"Steve Jobs",
"content":"Design è non solo ciò che sembra e si sente. Design è come funziona."
},
{
round(
if(
prop("Budget") > 0,
if (
prop("Spent") > 0,
prop("Spent") / prop("Budget"),
if (
prop("Spent") < 0,
1 - abs(prop("Spent")) / prop("Budget"),
@lparolari
lparolari / pytorch_model_disk_size.py
Last active July 11, 2023 12:49
Compute the disk size of a PyTorch model from its weights.
# Reference: https://discuss.pytorch.org/t/why-are-saved-models-so-large/166324/2
for name, param in model.named_parameters():
size = int((param.nelement() * param.element_size()) / (1024 ** 2)) # MB = 1024^2 bytes
print(name, param.nelement(), param.element_size(), f"{size}MB")
# EXAMPLE OUTPUT:
# concept_branch.we.embedding.weight 120005700 4 457MB
# visual_branch.we.embedding.weight 120005700 4 457MB
# visual_branch.fc.weight 78300 4 0MB

Pacman/Yay

sudo pacman -Syu
sudo pacman -Sc
yay -Sc --aur

Snap