Skip to content

Instantly share code, notes, and snippets.

View FilippoVajana's full-sized avatar

Filippo Vajana FilippoVajana

  • Kwantis
  • Italy
View GitHub Profile
@FilippoVajana
FilippoVajana / .wslconfig
Last active November 15, 2021 17:57
WSL2 Configuration
[wsl2]
memory=4GB # Limits VM memory in WSL 2 to 4 GB
processors=2 # Makes the WSL 2 VM use two virtual processors
localhostForwarding=true
swap=0GB
@FilippoVajana
FilippoVajana / async_timeout.jl
Created February 5, 2020 11:47
Julia @async function with timeout
struct CBCSolverResult
# job_result::Symbol
solver_status::String
solver_result
end
CBC_SOLVE_RESULT = CBCSolverResult("Failed", Nothing)
long_running_job(do_times) =
@FilippoVajana
FilippoVajana / subprocess_log.py
Last active January 28, 2020 14:21
op.pla subprocess logging
"""
Optimize saving the stdout of a subprocess.
"""
import os
import subprocess
import sys
import io
def run_command(cmd, log_file_path, timeout=28800, timeout_rerun=3):
@FilippoVajana
FilippoVajana / no-mnist-data.py
Created December 10, 2019 15:51
notMNIST pytorch loader
import os
import tarfile
import imageio
import tqdm
import numpy as np
def get_nomnist():
classes = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"]
tar_path = "./data/no-mnist/archive/notMNIST_large.tar"
tmp_path = "./data/no-mnist/archive/tmp"