Skip to content

Instantly share code, notes, and snippets.

View icaoberg's full-sized avatar
:bowtie:
Coding…

icaoberg icaoberg

:bowtie:
Coding…
View GitHub Profile
@icaoberg
icaoberg / script.sh
Last active February 10, 2016 20:30
Install R 3.2.3 in your home directory in the CBD cluster #slurm
#!/bin/bash
## Ivan E. Cao-Berg ([email protected])
## Copyright (C) 2016
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published
## by the Free Software Foundation; either version 2 of the License,
## or (at your option) any later version.
##
@icaoberg
icaoberg / script.sh
Last active January 22, 2016 19:13
Sample script that performs a daily task that I will add to my crontab #slurm
#!/bin/bash
## the next line selects the partition/queue
#SBATCH -p short1
## the next line selects the number of nodes
#SBATCH -N 1
## the next line selects the number of CPUs
#SBATCH -n 1
@icaoberg
icaoberg / script.sh
Last active January 22, 2016 15:40
Download files that follow a pattern in their filename #slurm
#!/bin/bash
## the next line selects the partition/queue
#SBATCH -p pool1
## the next line selects the number of nodes
#SBATCH -N 1
## the next line selects the number of CPUs
#SBATCH -n 1
@icaoberg
icaoberg / script.sh
Last active January 22, 2016 15:24
Download files from hyperlinks found in a file #slurm
#!/bin/bash
## the next line selects the partition/queue
#SBATCH -p pool1
## the next line selects the number of nodes
#SBATCH -N 1
## the next line selects the number of CPUs
#SBATCH -n 1
@icaoberg
icaoberg / script.sh
Last active January 22, 2016 15:24
Find and list all empty files in the current folder and subfolders #slurm
#!/bin/bash
## the next line selects the partition/queue
#SBATCH -p pool1
## the next line selects the number of nodes
#SBATCH -N 1
## the next line selects the number of CPUs
#SBATCH -n 1
@icaoberg
icaoberg / script.sh
Created December 28, 2015 06:32
Request an interactive session in partition "short1" #cbd #lane #cluster
# example_interactive-session0001.sh
#
# These are some of the options you can use when requesting an interactive session
# -p, --partition=partition --> partition requested (the current public partitions include short1 and interactive)
# -N, --nodes=N --> number of nodes on which to run (N = min[-max])
# --ntasks-per-node --> number of tasks per node
# --mem=MB --> minimum amount of real memory
# -c, --cpus-per-task=ncpus --> number of cpus required per task
# --pty --> run task zero in pseudo terminal
@icaoberg
icaoberg / script.sh
Last active October 13, 2022 15:12
Extracts images from movie #macosx #ffmpeg
#this script extracts frames for all movies (.mov) in the current folder.
# one image per frame per second saved to disk
for MOVIE in *.mov
do
if [ -f "$MOVIE" ]; then
FILENAME="${MOVIE%.*}"
echo $FILENAME
if [ ! -d "$FILENAME" ]; then
mkdir "$FILENAME"
@icaoberg
icaoberg / script.sh
Last active December 4, 2015 20:23
Requesting an interactive session on lanec1.compbio.cs.cmu.edu using SLURM
# These are some of the options you can use when requesting an interactive session
# -p, --partition=partition --> partition requested (the current public partitions include short1 and interactive)
# -N, --nodes=N --> number of nodes on which to run (N = min[-max])
# --ntasks-per-node --> number of tasks per node
# -c, --cpus-per-task=ncpus --> number of cpus required per task
# --pty --> run task zero in pseudo terminal
#request a session on short1
srun --partition=short1 --nodes=1 --cpus-per-task=1 --ntasks-per-node=1 --pty bash
@icaoberg
icaoberg / script.sh
Created November 20, 2015 20:49
Helper script that extract all frames from all mov files in a folder
for MOVIE in *.mov
do
if [ -f "$MOVIE" ]; then
FILENAME="${MOVIE%.*}"
echo $FILENAME
if [ ! -d "$FILENAME" ]; then
mkdir "$FILENAME"
fi
#extracts one frame per second. modify fps as needed
@icaoberg
icaoberg / script.sh
Last active August 29, 2015 14:22
Generates a word cloud from Little Women by Louisa May Alcott
#!/bin/bash
# Generates a word cloud from Little Women by Louisa May Alcott
if [ ! -d little_women ]; then
mkdir little_women
fi
cd little_women
virtualenv --system-site-packages .