Skip to content

Instantly share code, notes, and snippets.

View philippbayer's full-sized avatar

Philipp Bayer philippbayer

View GitHub Profile
@avoidik
avoidik / README.md
Created April 24, 2021 18:16
How to Limit CPU and Memory Usage With Cgroups on Debian/Ubuntu

How to Limit CPU and Memory Usage With Cgroups on Debian/Ubuntu

Cgroups is a flexible Linux kernel feature to limit, police and account resources usage. A cgroup is a set of tasks for a subsystems, that is typically a resource controller.

A file system of type cgroup is mounted and all operations are run over it.

Installation

The installation can be done using any of libcgroup, cgmanager or systemd.

@stroehleina
stroehleina / conda-find.sh
Created April 12, 2021 06:20
Function that can be added as an alias to your ~/.bashrc to find all conda environments that contain a particular package (and optionally version)
#Usage: conda-find.sh my-lost-package my-version
conda info --envs |
grep -v "#" |
sed 's/\s\+/\t/' |
cut -f2 |
sed '/^$/d' |
sed 's/^\*\s\+//' |
while read line; do
conda list -p $line |
@schaumb
schaumb / redirect.py
Last active October 23, 2024 15:25
streamlit redirect
import streamlit as st
import io
import contextlib
import sys
import re
import threading
class _Redirect:
class IOStuff(io.StringIO):
@max-mapper
max-mapper / upload.sh
Created March 27, 2019 00:43
upload large file to zenodo from command line (curl)
# in zenodo ui create a deposition. get the id
curl -H "Accept: application/json" -H "Authorization: Bearer $TOKEN" "https://www.zenodo.org/api/deposit/depositions/$DEPOSITION"
# get the bucket id from above
curl --progress-bar -o /dev/null --upload-file ./$FILE https://www.zenodo.org/api/files/$BUCKET/$FILE?access_token=$TOKEN
@elowy01
elowy01 / BCFtools cheat sheet
Last active November 11, 2024 12:50
BCFtools cheat sheet
*bcftools filter
*Filter variants per region (in this example, print out only variants mapped to chr1 and chr2)
qbcftools filter -r1,2 ALL.chip.omni_broad_sanger_combined.20140818.snps.genotypes.hg38.vcf.gz
*printing out info for only 2 samples:
bcftools view -s NA20818,NA20819 filename.vcf.gz
*printing stats only for variants passing the filter:
bcftools view -f PASS filename.vcf.gz
@jacksonpradolima
jacksonpradolima / install_source-pro_font.sh
Last active June 17, 2024 09:59
Installing Adobe's Source Pro fonts in Ubuntu: Source Code Pro, Source Serif Prof, and Source Sans Pro
#!/bin/bash
mkdir /tmp/adodefont
cd /tmp/adodefont
mkdir -p ~/.fonts
wget https://github.com/adobe-fonts/source-code-pro/archive/2.030R-ro/1.050R-it.zip
unzip 1.050R-it.zip
cp source-code-pro-2.030R-ro-1.050R-it/OTF/*.otf ~/.fonts/
wget https://github.com/adobe-fonts/source-serif-pro/archive/2.000R.zip
@lopezjurip
lopezjurip / script.sh
Created September 25, 2016 02:08
Github full code review
# Create empty branch.
git checkout --orphan review
git rm -rf .
git commit --allow-empty -m "Create empty branch"
git push --set-upstream origin review
# Create `project` branch from `master` current state.
git checkout -b project
git merge master --allow-unrelated-histories
git push --set-upstream origin project
@sujaikumar
sujaikumar / UniRef90.md
Last active January 29, 2024 08:14
UniRef90 protein blast database with taxon IDs

Goal

  • To create UniRef90 protein databases for NCBI blast and Diamond Blast
  • To create a tab delimited taxid mapping file with two columns : sequenceID\tNCBITaxonID

Steps:

Download the uniref90 xml file first (warning - this is ~15 GB, will take a while)

@pamag
pamag / convert_tped_to_hapamp.pl
Created March 18, 2012 05:37
converting tped files into HapMap format
#!/usr/bin/env perl
=head1 [progam_name]
description:
- converts tped files to hapmap files.
=head2 usage
@brantfaircloth
brantfaircloth / gist:895282
Created March 30, 2011 20:55
Substitution models in mrbayes

##GTR lset applyto=() nst=6 # GTR lset applyto=() nst=6 rates=propinv # GTR + I lset applyto=() nst=6 rates=gamma # GTR + gamma lset applyto=() nst=6 rates=invgamma # GTR + I + gamma

##SYM

lset applyto=() nst=6                           # SYM

prset applyto=() statefreqpr=fixed(equal)