Skip to content

Instantly share code, notes, and snippets.

View fatmatto's full-sized avatar
🎯
Focusing

Mattia Alfieri fatmatto

🎯
Focusing
View GitHub Profile
@fatmatto
fatmatto / convert.py
Created April 4, 2023 13:02
Convert uint16_scv file to DICOM
import numpy as np
import pydicom
# Qui devi mettere il perscorso del file da convertire
data = np.fromfile('/Users/fat/Downloads/incollaggio CS01 HP 2023-1-27 12-59-5.uint16_scv', dtype=np.uint16)
ds = pydicom.Dataset()
ds.PatientName = 'John Doe'
@fatmatto
fatmatto / SketchSystems.spec
Created January 3, 2020 08:36
Smart Workbench
Smart Workbench
waitingForOperator
operatorCheckin -> waitingForOrder
waitingForOrder
orderCheckin -> waitingForSetup
waitingForSetup
startSetup -> setup
setup
endSetup -> waitingForWork
waitingForWork
@fatmatto
fatmatto / git_status_recursive.sh
Created July 29, 2019 17:16
Run git status in all subdirectories
for d in $(ls)
do
(cd "$d" && echo "\n\n*******************************\n$PWD\n*******************************\n\n" && git status)
done
@fatmatto
fatmatto / find_env_vars_nodejs.sh
Created July 29, 2019 14:21
Find which env variables are used in your nodejs project
#!/bin/bash
grep --exclude-dir=node_modules -hro 'process\.env.\w*' . | sort -u
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Page Title</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link rel='stylesheet' type='text/css' media='screen' href='main.css'>
<script type="text/javascript">
console.log("FUNZIONA")
#!/bin/sh
# Backup mongodb databases running in docker containers
export CONTAINER_NAME="my-container"
export DATABASE_NAME="my-db"
SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
export BACKUP_LOCATION="${SCRIPT_DIR}/../backups"
echo "Saving database backup to directory ${BACKUP_LOCATION}..."
@fatmatto
fatmatto / release.sh
Last active August 5, 2019 12:57
Bash script i use to make a new release of (Internal) NodeJS microservices
#!/bin/sh
# Increments the project version (e.g. from 2.3.0 to 2.4.0)
# It handles stuff like
# * CHANGELOG
# * NPM package version
# * Git tags
# Calculating the new version requires to know which kind of update this is
# The default version increment is patch
@fatmatto
fatmatto / package-json-run-scripts.json
Created December 19, 2018 08:57
package-json-run-scripts.json
{
"start:prod": "NODE_ENV=production node server.js",
"start:dev": "NODE_ENV=development node server.js --debug",
"compose:dev:up":"docker-compose -p <MICROSERVICE_NAME> up -d",
"compose:dev:down":"docker-compose -p <MICROSERVICE_NAME> down",
"compose:prod:up":"docker-compose -p <MICROSERVICE_NAME> -f production-docker-compose.yml up -d",
"compose:prod:down":"docker-compose -p <MICROSERVICE_NAME> down"
}
{
"lint": "npx eslint src test --fix",
"commit": "npx git-cz",
"changelog" : "rm CHANGELOG.md; npx conventional-changelog -t -i CHANGELOG.md --same-file",
"release" : "sh scripts/release.sh"
}
@fatmatto
fatmatto / package-json-test-scripts.json
Created December 19, 2018 08:46
test related portion of package json
{
"test": "NODE_ENV=development npx nyc --reporter=text mocha test/**/*.spec.js --check-coverage --lines 80 --exit",
"test-ci": "NODE_ENV=testing npx nyc --reporter=text mocha test/**/*.spec.js --check-coverage --lines 80 --exit",
"test:integration": "NODE_ENV=testing npx mocha test/integration-tests --exit",
"test:unit": "NODE_ENV=testing npx mocha test/unit --exit",
}