Skip to content

Instantly share code, notes, and snippets.

View ha7ilm's full-sized avatar
🇭🇺

András Retzler ha7ilm

🇭🇺
  • Belgium
  • 11:41 (UTC -12:00)
View GitHub Profile
@ha7ilm
ha7ilm / matlab.md
Created August 30, 2024 12:58
Install MATLAB through ssh

Install MATLAB through ssh

For: Ubuntu 20.04.6 LTS + MATLAB R2024a

ssh -X you@yourserver

#If doesn't exist:
touch ~/.Xauthority
sudo -s
@ha7ilm
ha7ilm / save_the_figure.md
Created June 29, 2024 16:43
Saving a figure to PDF in MATLAB for a paper
% Set figure size and save
set(gcf, 'Position', [1 1 900 250]);
fig = gcf;
fig.PaperUnits = 'points';
fig.PaperPosition = [0 0 fig.Position(3) fig.Position(4)];
fig.PaperSize = [fig.Position(3) fig.Position(4)];
fig.PaperPositionMode = 'auto';
fig_pos = fig.PaperPosition;
fig.PaperSize = [fig_pos(3) fig_pos(4)];
@ha7ilm
ha7ilm / mathpixlowdpi.md
Created October 27, 2023 14:45
start mathpix lowdpi

Set custom DPI for Mathpix, Nextcloud, etc. on Windows (any Qt app).

image

Target:

C:\Windows\System32\cmd.exe /c "SET QT_SCALE_FACTOR=1.3 && SET QT_AUTO_SCREEN_SCALE_FACTOR=0 && start mathpix-snipping-tool.exe"
@ha7ilm
ha7ilm / synctex.md
Created September 9, 2023 20:20
synctex.md

VS Code Synctex command for SummatraPDF

"C:\Users\YourUsername\AppData\Local\Programs\Microsoft VS Code\Code.exe" -g "%f:%l"

wcd -- cd to a Windows-style path in WSL

What does it do?

user@windows / $ wcd 'C:\Test'
user@windows /mnt/c/Test $

You have to use '' around the path.

@ha7ilm
ha7ilm / LICENSE
Last active July 29, 2023 14:12
Find all referenced files in .tex file and categorize the files in current directory to referenced and non-referenced files
Copyright 2023 Andras Retzler
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT

Command to open vim from Total Commander as external viewer/editor (Alt+F3) through WSL

wt -p "Ubuntu" wsl zsh -c "vim $(wslpath '%1')"

You shall put it to TC settings, where I have the Notepad++ now:

image

#We only need to normalize the inputs of a neural network, not necessarily the outputs.
#However, the choice of the activation function is important, e.g. it doesn't work with `jnp.tanh`.
import jax.numpy as jnp
from jax import grad, jit, vmap
import jax
from jax import random
from flax import linen as nn
from flax.training import train_state
from optax import adam
@ha7ilm
ha7ilm / torch-rfft-derivative.md
Created October 31, 2022 06:06
calculate the derivative of a signal with torch.fft
F_signal = torch.fft.rfft(signal])
w = ((((torch.arange(0,301))/600)*(2*torch.pi))) #signal is 600 samples long
d_signal = torch.fft.irfft(w*torch.tensor(complex(0,1))*F_signal)*(1/dt)
@ha7ilm
ha7ilm / debugnn.md
Created September 2, 2022 10:05
Debugging NNs with PyTorch

This is work in progress.

Visualizing gradients