Skip to content

Instantly share code, notes, and snippets.

@smhr
smhr / Change MAX_CPU 8 to 16 in nbody6.sh
Created October 4, 2019 12:11
Change MAX_CPU 8 to 16 in nbody6
grep -rlnI "MAX_CPU 8" . | xargs -l sed -i -e 's/MAX_CPU 8/MAX_CPU 16/g'
@smhr
smhr / rsync
Last active September 10, 2022 04:18
rsync examples
## sync a remote directory on a server S1 to a local directory L2 (i.e. copy S1 into L2)
rsync -avh user@192.168.0.1:/S1 /L2
## sync files from a remote directory on a server S1 to a local directory L2 (i.e. copy S1 contents into local L2)
rsync -avh user@192.168.0.1:/S1/ /L2
## sync a local directory L1 to a remote directory /S2 (i.e. copy L1 into remote S2)
rsync -avh ./L1 user@192.168.0.1:/S2
## sync files from a local directory L1 to a remote directory /S2 (i.e. copy L1 and its contents into remote S2)
@smhr
smhr / mint19.2_repos
Last active December 28, 2019 12:00
My Mint 19.2 tina repos
deb http://packages.linuxmint.com tina main upstream import backport
deb http://mirror.armaghan.net/ubuntu bionic main restricted universe multiverse
deb http://mirror.armaghan.net/ubuntu bionic-updates main restricted universe multiverse
deb http://mirror.armaghan.net/ubuntu bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://archive.canonical.com/ubuntu/ bionic partner
@smhr
smhr / nbody6_slurm.sh
Created August 28, 2020 09:09
An example nbody6 slurm script for submitting on scicluster
#!/bin/bash -l
#############################
# example for an OpenMP job #
#############################
#SBATCH --job-name=N50R0.5d20S0
# we ask for 1 task with 20 cores
#SBATCH --nodes=1
@smhr
smhr / find_cygnus.sh
Created September 6, 2020 11:23
find all available ssh in a network
#!/bin/bash
LOGFILE="has_ssh.txt"
for i in {0..225}
do
IP_ADDRESS="172.21.99."$i
echo $IP_ADDRESS
ssh-keyscan $IP_ADDRESS | grep -v "^$" &> /dev/null > /dev/null
[ $? == 0 ] && echo $IP_ADDRESS "has ssh" >> $LOGFILE
done
@smhr
smhr / Make.mach.scicluster
Created November 30, 2020 16:15
Enzo machine file for Scicluster
#=======================================================================
#
# FILE: Make.mach.scicluster
#
# DESCRIPTION: Makefile settings for scicluster at FUM
#
# AUTHOR: S. Mohammad Hosseinirad (smhr313@gmail.com)
#
# DATE: 2020-11-30
#
@smhr
smhr / resize_images.sh
Created December 18, 2020 09:33
Batch resize images
mogrify -resize 25% -path ./small_images *.jpg
@smhr
smhr / Make.config.assemble
Created January 17, 2021 11:21
ENZO Make.config.assemble for scicluster
#-----------------------------------------------------------------------
#
# This make include file is used for assigning appropriate values to
# the following variables given CONFIG_* and MACH_* variables:
#
# Compilers
#
# CPP C preprocessor
# CC C compiler
# CXX C++ compiler
@smhr
smhr / Enzo_GPU_installation_on_scicluster
Created April 1, 2021 18:49
Enzo GPU installation on scicluster
======== Load modules
ml HDF5/1.10.2-foss-2018b-serial gompi/2018b CUDA/10.1.243-GCC-7.3.0-2.30
========
cd enzo-dev
./configure
cd src/enzo/
make machine-scicluster
make use-mpi-yes
make show-config
make clean
@smhr
smhr / TNG_extracting_data_example.ipynb
Created September 23, 2021 17:16
TNG_extracting_data_example
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.