Rsync specific files

rsync -mav --include="*/" --include="*.log" --exclude="*" . ~/target/

Run samtools on files in the Google Cloud

export GCS_OAUTH_TOKEN=`gcloud auth application-default print-access-token`
samtools view -H gs://bucket/file.bam

Samtools has to be compiled with the https and google cloud support of course.

Change job partition on Slurm

scontrol update jobid=$id partition=$partition

Syntax highlighting in SE

<!-- language: lang-js -->

    code goes here

Publish to PyPI

python setup.py register -r pypi
python setup.py sdist upload -r pypi

Change git user name and email

git config user.name "My Name"
git config user.email "myemail@mail.com"
ssh-add -D
ssh-add ~/.ssh/id_rsa_my

Extract sound track without recoding

ffprobe input-video.mp4
ffmpeg -i input-video.mp4 -vn -acodec copy output-audio.aac

Extract time range

ffmpeg -i in.mp4 -ss 10 -t 30 -acodec copy -vcodec copy out.mp4

Enable developer mode on Mac

DevToolsSecurity -enable

VirtiualBox and Vagrant

# SSH tunnel
VBoxManage modifyvm "CentOS6-05" --natpf1 "guestssh,tcp,,2222,,22"
ssh -p 2222 127.0.0.1
# Shrink VDI size
mount -o remount,ro /dev/sda1  # in the single-user mode
zerofree /dev/sda1
VBoxManage modifyhd --compact CentOS6-05.vdi
# Create vagrant box
vagrant package --output centos6-05.box --base CentOS6-05
# Use vagrant box
vagrant box add centos6-05 centos6-05.box
vagrant box list
vagrant init centos6-05
vagrant up
vagrant ssh