Skip to content

Instantly share code, notes, and snippets.

View akiross's full-sized avatar
🥷
Ninja

Alessandro Re akiross

🥷
Ninja
View GitHub Profile
@akiross
akiross / ShowImage.vue
Last active January 23, 2025 21:46
vtkjs example showing a random image
<script setup>
import { ref, onMounted, onBeforeUnmount } from "vue";
// Without this import, it will fail with "renNode is undefined"
// If Geometry is used as a profile, you won't see anything on the screen, but no error.
// Thank you harry for helping me finding the issue:
// https://discourse.vtk.org/t/error-in-vtkgenericrenderwindow-for-vtk-js/15154
import "@kitware/vtk.js/Rendering/Profiles/Volume";
import vtkGenericRenderWindow from "@kitware/vtk.js/Rendering/Misc/GenericRenderWindow";
@akiross
akiross / README.md
Created September 21, 2024 15:52
Deploying nix flakes to nixos hosts using github actions

All Nix(OS) deploy

  • update-flake-lock.yml
  • deploy-host-flake.yml
  • flake.nix
  • some-service somewhere on git

This is an example of (all nix) deployment. The architecture is the following:

  1. you have some-service flake somewhere on a repository; let's assume it's private and hosted at github.com/foobar/some-service.
@akiross
akiross / manual.sh
Created June 20, 2024 17:04
Manually setting up the network
# Enable the link
ip link set ens18 up
# Set the IP
ip address add 192.168.1.123/24 dev ens18
# Add a route
ip route add default via 192.168.1.1
# Set the nameserver
@akiross
akiross / code.gs
Created October 6, 2023 09:07
Custom function for google sheet to compute the Borda count
/**
* Computes the borda count of strings in a range.
* @param {Array<Array<string>>} input The range with strings.
* @return A string with the winning string and its score.
* @customfunction
*/
function BORDA_WINNER(input) {
let votes = {};
let n_rows = input.length;
@akiross
akiross / picci.py
Created October 5, 2023 17:13
Example of using python AST module to produce some python code.
import json
import ast
from ast import (
ClassDef,
FunctionDef,
arguments,
arg,
BinOp,
Name,
Add,
@akiross
akiross / pooldl.py
Created August 3, 2022 15:40
Curl Pool DL
from multiprocessing import Pool
import fileinput
def download(url):
from subprocess import check_call
check_call(["curl", "--silent", "-O", url])
return url
@akiross
akiross / Cargo.toml
Created August 1, 2022 17:20
Tauri async sleep event
[package]
name = "app"
version = "0.1.0"
description = "A Tauri App"
authors = ["you"]
license = ""
repository = ""
default-run = "app"
edition = "2021"
rust-version = "1.57"
@akiross
akiross / collector_config.yaml
Created June 15, 2022 18:51
Opentelemetry with Django
receivers:
otlp:
protocols:
grpc:
processors:
# Did not test without this batch, yet. Might be unnecessary.
batch:
exporters:
@akiross
akiross / init.vim
Created July 6, 2021 19:33
Neovim config
" Enable
set list
" what character to display instead of spaces
set listchars=tab:»\ ,trail:-,precedes:←,extends:→,eol:↲,nbsp:␣,space:·
" number of spaces a Tab counts for
set tabstop=4
" how many spaces an (auto)indent operation will use
" this may mix tabs and spaces according to other settings
" e.g. if ts=4 and sw=6 with noexpandtab, >> will add <tab><sp><sp>
set shiftwidth=4
@akiross
akiross / pythreejs_example.ipynb
Created May 27, 2021 08:38
Parallel animation example on pythreejs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.