Skip to content

Instantly share code, notes, and snippets.

View floringogianu's full-sized avatar
🐳
Chasing Moby-Dick

Florin Gogianu floringogianu

🐳
Chasing Moby-Dick
View GitHub Profile
@kylemcdonald
kylemcdonald / matplotlib Border Removal.ipynb
Last active May 9, 2025 15:16
How to (mostly) remove all borders and padding with matplotlib.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@max-mapper
max-mapper / bibtex.png
Last active November 6, 2024 09:03
How to make a scientific looking PDF from markdown (with bibliography)
bibtex.png
@floringogianu
floringogianu / null.py
Created December 8, 2017 15:53 — forked from fish830617/null.py
Calculate the null space of a matrix by QR factorization.
# null.py
import numpy as np
from scipy.linalg import qr
def qr_null(A, tol=None):
Q, R, P = qr(A.T, mode='full', pivoting=True)
tol = np.max(A) * np.finfo(R.dtype).eps if tol is None else tol
rnk = min(A.shape) - np.abs(np.diag(R))[::-1].searchsorted(tol)
return Q[:, rnk:].conj()
@pierrelux
pierrelux / exact_pg.py
Created July 17, 2019 21:28
Exact Policy Gradient in jax, demonstrated in figure 2d of Dadashi et al. (2019)
import jax
import jax.numpy as np
from jax import grad, jit
from jax.scipy.special import logsumexp
def dadashi_fig2d():
""" Figure 2 d) of
''The Value Function Polytope in Reinforcement Learning''
by Dadashi et al. (2019) https://arxiv.org/abs/1901.11524
@alonsosilvaallende
alonsosilvaallende / inset_axes.ipynb
Created August 21, 2020 12:44
inset_axes.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aisu-wata0
aisu-wata0 / ParamRepeatPruner.py
Last active November 5, 2024 12:15
For optuna/optuna#2021. Class that prunes trials with the same parameters as past trials. You also can allow repeats if you want, and get the average of these past trials instead of pruning.
import optuna
from optuna.trial import TrialState
import numpy as np
from typing import Dict, List, Optional
from collections import defaultdict
class ParamRepeatPruner:
"""Prunes reapeated trials, which means trials with the same paramters won't waste time/resources."""
@antoinebrl
antoinebrl / README.md
Last active May 23, 2025 13:05
Prepare ImageNet

Preparation of ImageNet (ILSVRC2012)

The dataset can be found on the official website if you are affiliated with a research organization. It is also available on Academic torrents.

This script extracts all the images and group them so that folders contain images that belong to the same class.

  1. Download the ILSVRC2012_img_train.tar and ILSVRC2012_img_val.tar
  2. Download the script wget https://gist.githubusercontent.com/antoinebrl/7d00d5cb6c95ef194c737392ef7e476a/raw/dc53ad5fcb69dcde2b3e0b9d6f8f99d000ead696/prepare.sh
  3. Run it ./prepare.sh
@nmwsharp
nmwsharp / printarr
Last active August 15, 2024 01:43
Pretty print tables summarizing properties of tensor arrays in numpy, pytorch, jax, etc. --- now on pip: `pip install arrgh`
Pretty print tables summarizing properties of tensor arrays in numpy, pytorch, jax, etc.
Now on pip! `pip install arrgh` https://github.com/nmwsharp/arrgh
@malyzeli
malyzeli / port-forwarding-inside-local-network.md
Last active May 17, 2025 20:05
Port forwarding inside local network

Port forwarding inside local network

Problem introduction

This guide is meant to solve the issue when using TrueNAS Scale apps with Nginx Proxy Manager, which is not running on default HTTP(S) ports because those are already used by TrueNAS web interface.

_In case of isolated TrueNAS instance it's possible to change web interface ports so Nginx proxy can use HTTP(S) defaults, but that configuration