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 / 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.
@akiross
akiross / gist:1ed04769792297b94d007b2adfa92c29
Created May 10, 2021 10:25
Markdown image alignment concept
# Concept for specifying alignment in markdown/rst/similar thing
Specifying how to align images, text etc in markdown is not great.
Here's a concept on how that could be written
The following image is on the left:
|[1]-|
[1]: image.png
from line_profiler import LineProfiler
def do_profile(follow=[]):
def inner(func):
def profiled_func(*args, **kwargs):
try:
profiler = LineProfiler()
profiler.add_function(func)
for f in follow:
profiler.add_function(f)