Skip to content

Instantly share code, notes, and snippets.

View icaoberg's full-sized avatar

icaoberg icaoberg

View GitHub Profile
@icaoberg
icaoberg / example02.sh
Last active February 3, 2020 23:20 — forked from arq5x/go.sh
[bedtools] Compute average scores for share intervals
# icaoberg - this example is fork that uses a bedtools in a Singularity container
CONTAINER=../../singularity-bedtools.simg
echo "chr1 10 50 10" > a.bed
echo "chr1 20 40 20" > b.bed
echo "chr1 30 33 30" > c.bed
# Find the sub-intervals shared and unique to each file.
if [ -f $CONTAINER ]; then
singularity run --app bedtools $CONTAINER multiinter -i a.bed b.bed c.bed | column -t
@icaoberg
icaoberg / rrename.sh
Created January 22, 2020 07:03
[UTILITIES] Random rename
#!/bin/bash
shopt -s nullglob
FILE=$1
if [ -f $FILE ]; then
mv -v "$FILE" $(uuidgen).${FILE##*.}
fi
@icaoberg
icaoberg / remove.sh
Created March 6, 2013 21:32
[Git] Remove all *.pyc files from your git repository
#!/bin/bash
find . -name "*.pyc" -exec git rm {} \;
git commit -m "Removed compiled python files in distribution left after last commit"
@icaoberg
icaoberg / script.sh
Created December 12, 2019 18:24
Get number of tasks for a specific project on TaskWarrior
!/bin/bash
# icaoberg yes, i know there are better cleaner ways...
task project:$1 list | grep tasks | cut -d" " -f 1 | sed '/^[[:space:]]*$/d' | awk '{$1=$1;print}'
@icaoberg
icaoberg / Singularity
Created November 13, 2019 20:05
Singularity script for basic, empty Ubuntu 16.04
Bootstrap: docker
From: ubuntu:16.04
IncludeCmd: yes
%labels
Maintainer icaoberg AT alumni DOT cmu DOT edu
Version v1.0
%runscript
@icaoberg
icaoberg / script.sh
Created August 22, 2019 14:44
Convert all webp files to png
#!/bin/bash
for F in *.webp
do
dwebp $F -o $F.png
done
@icaoberg
icaoberg / script.py
Created July 4, 2019 05:27
HackerRank - Interview -Arrays - Left Rotation
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the rotLeft function below.
def rotLeft(a, d):
@icaoberg
icaoberg / decrypt.sh
Last active June 30, 2019 01:57
Simple decryption script
#!/bin/bash
# Copyright (C) 2018-2019 Ivan Cao-Berg
#
# 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.
#
# This program is distributed in the hope that it will be useful, but
@icaoberg
icaoberg / stack.py
Created June 21, 2012 22:47
Simple stack in Python
# Author: Michelle Mackie
#
# Copyright (C) Summer 2012
# School of Computer Science
# Carnegie Mellon University
#
# 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
Created July 20, 2018 01:39
Rename all files in the current directory
#!/bin/bash
#
#$ -j y
#$ -S /bin/bash
#$ -cwd
## the next line selects the partition/queue
#SBATCH -p short1
## the next line selects the number of nodes