Skip to content

Instantly share code, notes, and snippets.

View cbonesana's full-sized avatar
👾
bip bip bip

Claudio Bonesana cbonesana

👾
bip bip bip
View GitHub Profile
@cbonesana
cbonesana / install-ionic.sh
Created August 25, 2019 12:01
Single script installer for Node.js and Ionic framework with Ubuntu.
#!/bin/bash
# INSTALL NODE.JS
# Update the apt package index:
apt update
# Install required packges:
apt install -y python-software-properties software-properties-common
# Download and execute the setup script for Node.js LTS:
@cbonesana
cbonesana / install-anaconda.sh
Created August 25, 2019 12:57
Install miniconda with multi-user setup.
#!/bin/bash
# INSTALL MINICONDA
# Download miniconda:
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
# Make it executable
chmod +x Miniconda3-latest-Linux-x86_64.sh
# Run with quick setup
import logging
import os
import sys
import lxml.etree as etree
from openpyxl import load_workbook
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
@cbonesana
cbonesana / exec.sh
Created April 1, 2020 15:58
Run a python scirpt inside docker 🐳
#!/bin/bash
docker run -it --rm -v "$(pwd)":"/w" -w "/w" python:3.8-slim python scripty.py
@cbonesana
cbonesana / ProgressBar.java
Created October 6, 2021 14:08
A class for a Progress Bar in Java
package utility;
import java.time.Duration;
import java.util.Collections;
/**
* Author: Claudio "Dna" Bonesana
* Project: SimpleProgressBar
* Date: 06.10.2021 14:27
*/
@cbonesana
cbonesana / shared_pointers.cpp
Created January 13, 2022 11:05
C++ Shared pointers
#include <iostream>
#include <memory>
#include <string>
// This is just an example object with a text field.
class Content {
public:
std::string txt;
Content(std::string txt) : txt(txt){};
};
@cbonesana
cbonesana / esperiment.py
Created August 5, 2022 09:37
Experimenting using multiprocessign and signals in python.
import time
import multiprocessing
import signal
from multiprocessing import Event
class W(multiprocessing.Process):
def __init__(self, i: int, event: Event) -> None:
super().__init__()
@cbonesana
cbonesana / pydantic_enum.py
Last active October 3, 2022 14:04
Working with string enums and pydantic objects in python
from pydantic import BaseModel
from enum import Enum
import json
class Season(str, Enum):
SPRING = 'spring'
SUMMER = 'summer'
AUTUMN = 'autumn'
@cbonesana
cbonesana / resources.py
Created March 7, 2023 12:41
Producer and consumer using python, with KeyboardInterrupt ctrl+c
from multiprocessing import Queue, Process
import random
import time
import signal
stop_sentinel = "STOP"
@cbonesana
cbonesana / main.py
Created September 28, 2023 14:02
Run ray multi threading with sqlalchemy and sqlite database, in python.
from sqlalchemy import create_engine
from sqlalchemy import select, insert, func
from tables import Base, Record
from time import time
import ray
import uuid