Skip to content

Instantly share code, notes, and snippets.

View RonaldFindling's full-sized avatar

Ronald Findling RonaldFindling

View GitHub Profile
@RonaldFindling
RonaldFindling / filter_bam_file.sh
Last active January 1, 2016 17:20
FIlter bam-file by chromosome and range
#!/bin/bash
##############################
#set the following variables
##############################
#use the bamfile without .bam
myfile="alignment"
#the chromosome to filter for
mychrom="chr1"
@RonaldFindling
RonaldFindling / .gitignore
Last active March 18, 2017 15:15
Markdown Summary
# Created by https://www.gitignore.io/api/linux
### Linux ###
*~
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
@RonaldFindling
RonaldFindling / .gitignore
Last active January 1, 2016 17:57
Github Markdown Summary
# Created by https://www.gitignore.io/api/linux
### Linux ###
*~
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
@RonaldFindling
RonaldFindling / undo_git_reset_hard.sh
Created January 1, 2016 12:54
Recover staged and uncommited files after deletion by git reset --hard
#get hash-values for all unreachable files sorted by timestamps by Mark Longair http://stackoverflow.com/questions/7374069/undo-git-reset-hard-with-uncommitted-files-in-the-staging-area
find .git/objects/ -type f -printf '%TY-%Tm-%Td %TT %p\n' | sort | cut -d " " -f 3 | sed "s/\.git\/objects\/\(.*\)\/\(.*\)/\\1\\2/" > file_hashes_to_recover.txt
#create git restore commands
# awk '{FS="\t"} {print "git show "$1" > recovered"FNR".pdf"}' file_hashes_to_recover.txt > file_recovery_commands.txt
awk '{FS="\t"} {print "git show "$1" > recovered"FNR}' file_hashes_to_recover.txt > file_recovery_commands.txt
#run the restoration commands
bash file_recovery_commands.txt