Skip to content

Instantly share code, notes, and snippets.

View andreagalle's full-sized avatar
💭
Whatever Works - Basta che funzioni

Andrea Gallegati andreagalle

💭
Whatever Works - Basta che funzioni
View GitHub Profile
@andreagalle
andreagalle / scanport.sh
Created November 14, 2023 23:59
scan open ports given IP address
#!/bin/bash
IP=$1
first_port=$2
last_port=$3
function scanner
{
for ((port=$first_port; port<=$last_port; port++))
do
(echo >/dev/tcp/$IP/$port)> /dev/null 2>&1 && echo "$port open" #|| echo "$port closed"
@andreagalle
andreagalle / pipfreeze
Created October 30, 2023 09:40 — forked from david-wm-sanders/pipfreeze
Powershell Command to pip freeze properly
.\venv\Scripts\pip freeze | Out-File -Encoding UTF8 requirements.txt
@andreagalle
andreagalle / PasswordEncryption.java
Created October 4, 2021 22:55 — forked from danieljs777/PasswordEncryption.java
Encryting passwords with MD5 hash and salt in Java.
package PasswordEncryption;
/**
*
* @author daniel
*/
import java.io.Console;
import java.io.IOException;
import java.security.*;
import java.io.ByteArrayOutputStream;
@andreagalle
andreagalle / check-bkp.sh
Created June 14, 2020 23:53
check du before bap on GitHub printing it in MB
#find . -name "*.mp4" -print0 | du -sb --files0-from=- | awk '{ total += $1} END { print total/1024/1024/1024 }'
find data/vtk/ \( -name "b*_mean.vtk" -o -name "b*_pdf.vtk" \) -print0 | du -sb --files0-from=- | awk '{ total += $1} END { print total/1024/1024 }'
@andreagalle
andreagalle / assmbly_f90.sh
Created June 11, 2020 14:15
generate ifort assembli code for v14.0
ifort -O2 -r8 -mcmodel=medium -convert big_endian -module ./bin/.mod -D_ppFLUID -D_ppMEAN -I./include -mmic -S -fsource-asm -c src/pp/particle_pdf.F90
@andreagalle
andreagalle / optrep_f90.sh
Created June 11, 2020 14:13
generate ifort optimisation report with v14.0
ifort -O3 -r8 -mcmodel=medium -convert big_endian -module ./bin/.mod -D_ppFLUID -D_ppMEAN -I./include -opt-report -c src/pp/particle_pdf.F90
@andreagalle
andreagalle / git-subtrees.md
Created June 9, 2020 15:47 — forked from tdd/git-subtrees.md
Subtrees investigations

Workbench

We extract our test repos from this small Zip file.

  • main is a "container" repository with its working copy,
  • plugin is a "shared" repository with its working copy,
  • remotes emulates remote bare repos for both, to better resemble regular usage.

The idea is to use plugin as a subtree of main in a vendor/plugins/demo path, and allow maintenance both ways:

@andreagalle
andreagalle / db-test.sh
Created June 1, 2020 10:40
a first attempt to auto-prepend a db-version when the branch is not up to date
#!/bin/bash
db_n=9
#make intel_debug_fast
exe_name=pijet-4ea9e50
dbt_name="db${db_n}-${exe_name}"
@andreagalle
andreagalle / bkp-flu9
Created April 19, 2020 01:59
backup from flu9 to current directory
rsync -vaPuz -e 'ssh -p 2009' gallegati@flumacs.dima.uniroma1.it:/home/gallegati/FTaC-pp/cyclone-pijet-omp .
ffmpeg -i $1.mp4 -vf "fps=10,scale=320:-1:flags=lanczos" -c:v pam -f image2pipe - | convert -delay 10 - -loop 0 -layers optimize $1.gif