Skip to content

Instantly share code, notes, and snippets.

View valerionew's full-sized avatar
🍊

Valerio valerionew

🍊
View GitHub Profile
@33eyes
33eyes / commit_jupyter_notebooks_code_to_git_and_keep_output_locally.md
Last active June 29, 2024 08:08
How to commit jupyter notebooks without output to git while keeping the notebooks outputs intact locally

Commit jupyter notebooks code to git and keep output locally

  1. Add a filter to git config by running the following command in bash inside the repo:
git config filter.strip-notebook-output.clean 'jupyter nbconvert --ClearOutputPreprocessor.enabled=True --to=notebook --stdin --stdout --log-level=ERROR'  
  1. Create a .gitattributes file inside the directory with the notebooks

  2. Add the following to that file:

@lcpz
lcpz / revolut-gma.bash
Last active August 4, 2023 17:04
Giacenza Media Annua for Revolut accounts
#!/bin/bash
# Compute the Giacenza Media Annua (GMA) of a Revolut account, required by the Italian INPS.
# Dependencies: awk, GNU date, getopts, xargs
# Computation method: https://bit.ly/3avDLu3
# Thread on Revolut forum: https://bit.ly/3511e5h
# Assumptions:
@coltenkrauter
coltenkrauter / fix-wsl2-dns-resolution
Last active July 3, 2024 20:33
Fix DNS resolution in WSL2
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
@akiross
akiross / pigreco.cu
Last active August 9, 2023 14:55
Approximate Pi using usual Monte-Carlo simulation, in CUDA (with bonus Python snippet!).
// Approximation of Pi using a simple, and not optimized, CUDA program
// Copyleft Alessandro Re
//
// GCC 6.x not supported by CUDA 8, I used compat version
//
// nvcc -std=c++11 -ccbin=gcc5 pigreco.cu -c
// g++5 pigreco.o -lcudart -L/usr/local/cuda/lib64 -o pigreco
//
// This code is basically equivalent to the following Python code:
//