Skip to content

Instantly share code, notes, and snippets.

View emaballarin's full-sized avatar
🤓
Trying to make 💻 more like 🧠!

Emanuele Ballarin emaballarin

🤓
Trying to make 💻 more like 🧠!
View GitHub Profile
@emaballarin
emaballarin / jbppatch.sh
Created October 20, 2024 17:14
Easily make incompatible JetBrains plugins "magically" compatible again!
#!/usr/bin/bash -li
PNAME="$1"
PVER="$2"
JARNAME="${3-$PNAME}"
mkdir -p ./EXT01/
cd ./EXT01/ || exit
unzip ../"${PNAME}"-"${PVER}".zip
rm -f ../"${PNAME}"-"${PVER}".zip
mv ./"${PNAME}"/lib/"${JARNAME}"-"${PVER}".jar ./"${JARNAME}"-"${PVER}".zip
mkdir -p ./EXT02/
@emaballarin
emaballarin / minilit_env.yml
Created September 3, 2024 04:24
🔥 MiniLit
name: minilit
channels:
- pytorch-nightly
- pytorch
- nvidia/label/cuda-12.4.0
- nvidia
- rapidsai
- conda-forge
#!/usr/bin/env pwsh
rustup update
rustup target add wasm32-wasi
git clone --recursive --recurse-submodules --shallow-submodules --depth 1 --branch "main" https://github.com/zed-industries/zed.git
Set-Location zed
cargo clean --release
cargo build --release
cargo run --release
cp target\release\zed.exe ..\
Set-Location ..\
@emaballarin
emaballarin / xicor.py
Last active August 9, 2024 02:42
Implementation of the Xi correlation coefficient in pure PyTorch. After: S. Chatterjee, "A New Coefficient of Correlation", 2020.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ──────────────────────────────────────────────────────────────────────────────
from math import sqrt
from typing import List
from typing import Optional
from typing import Tuple
import torch
from safe_assert import safe_assert as sassert
@emaballarin
emaballarin / tmux_install.sh
Created July 18, 2024 00:06
Script for installing tmux on systems where you don't have root access. Courtesy of Alfredo Canziani (https://github.com/Atcold/Unix-dot-files/blob/master/Tmux/local_install.sh).
#!/usr/bin/bash -li
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/.local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# Exit on error
set -eo pipefail
TMUX_VERSION="3.4"
@emaballarin
emaballarin / telegram_bot_echo.py
Created July 17, 2024 22:35
Modern Python implementation of a Telegram bot that only delivers messages
from os import environ
from typing import Dict
from typing import Optional
from typing import Tuple
from httpx import Client
from safe_assert import safe_assert as sassert
def _isnn(c):
<scheme name="AnysphereDark" parent_scheme="Dark" version="7">
<colors>
<option name="CONSOLE_BACKGROUND_KEY" value="181818" />
<option name="LINE_NUMBERS_COLOR" value="D6D6DD" />
<option name="SELECTION_BACKGROUND" value="163761" />
<option name="CARET_ROW_COLOR" value="292929" />
<option name="WHITESPACES" value="737373" />
<option name="CARET_COLOR" value="D6D6DD" />
<option name="INDENT_GUIDE" value="737373" />
<option name="SELECTED_INDENT_GUIDE" value="737373" />
@emaballarin
emaballarin / pristall.sh
Last active September 26, 2023 21:38
Installing the very latest Prism (https://github.com/prismplp/prism) should not be *that* convoluted...
#!/usr/bin/env bash
#
# PRISM
git clone --recursive --recurse-submodules --single-branch --depth=1 --shallow-submodules --branch master https://github.com/prismplp/prism.git
cd prism/src/c
USE_NPY=1 make -f Makefile.gmake
USE_NPY=1 make -f Makefile.gmake install
cd ../prolog
make install
cd ../../tools/
@emaballarin
emaballarin / lmu.py
Created June 19, 2023 09:41
From (soon to be removed) ebtorch.nn.lmu
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ==============================================================================
#
# Copyright (c) 2019-* Brent Komer. All Rights Reserved.
# [orig. code: https://github.com/bjkomer/pytorch-legendre-memory-unit]
#
#
# Copyright (c) 2019-* Applied Brain Research. All Rights Reserved.
# [orig. work: https://papers.nips.cc/paper/2019/file/952285b9b7e7a1be5aa7849f32ffff05-Paper.pdf;
@emaballarin
emaballarin / emaballarin_latex_utilities.tex
Last active May 16, 2024 02:50
Collection of LaTeX utilities for writing and submitting AI/ML/DL papers
\usepackage[utf8]{inputenc} % utf-8 input
\usepackage[british]{babel} % spellcheck in proper English
\usepackage[T1]{fontenc} % 8-bit T1 fonts
\usepackage{braket} % Dirac's Bra-Ket notation
\usepackage{hyperref} % hyperlinks
\usepackage{url} % URL typesetting
\usepackage{booktabs} % professional-quality tables
\usepackage{amsfonts} % blackboard math symbols
\usepackage{amsopn} % shorthand commands for operators
\usepackage{amsmath} % mathematical typesetting