Skip to content

Instantly share code, notes, and snippets.

View antonkratz's full-sized avatar

Anton Kratz antonkratz

View GitHub Profile
@antonkratz
antonkratz / sed.md
Last active March 25, 2019 17:27
Delete lines in a text file that contain a specific string

Delete all lines in the file myfile that contain the string foobar:

sed -i '/foobar/d' myfile
@antonkratz
antonkratz / cytoscape_3.7.1_notes.md
Last active March 1, 2019 23:32
Cytoscape notes

Cytoscape 3.7.1

the layout is too dense and I want to expand the layout

Layout --> Node layout Tools --> Scale:

toolpanel

when I zoom out, the text on the label dissappears

@antonkratz
antonkratz / ak.go.py
Last active December 28, 2018 00:53
Get BP, CC, MF and full GO in Clixo-style format
# author: Anton Kratz
# created: Mon Dec 17 19:08:48 PST 2018
# Based on original code by Mike Yu which is at [1]. However [1] has various NDEX and other
# code intermingled which is not necessary in this context. Also, I am building a similarity
# table for DNA repair on the fly.
# [1] https://github.com/michaelkyu/ddot/blob/master/examples/Process_the_Gene_Ontology.ipynb
import requests
@antonkratz
antonkratz / PAGER.md
Created December 11, 2018 18:58
You might run into a situation where git log, man man display absolutely nothing.

You might run into a situation where git log, man man display absolutely nothing. This could be b/c bash forgot the PAGER variable. How this is possible is beyond me. You must reset the PAGER variable and then it will work again:

export PAGER=less
@antonkratz
antonkratz / capslock.md
Created December 7, 2018 18:58
the caps lock is distracting and does not make any sense anyway, let's make it "dead"

Disable the caps lock key entirely

Ubuntu

setxkbmap -option "caps:none"
@antonkratz
antonkratz / ak.locate_updatedb.md
Last active December 6, 2018 20:30
mlocate locate bash updatedb

Building a separate database enables you to locate files on sshfs-mounted filesystems

The find command is very slow. locate is much faster, but relies on a database, which is typically build nightly. Often I have mounted remote filesystems using sshfs. By default, the database is not build for sshfs-mounted filesystems.

Build an mlocate database for the sshfs-mounted dir /home/kratz/mpoints/cellar (see below for cron version):

updatedb -l 0 -o ~/.cellar.db -U /home/kratz/mpoints/cellar
@antonkratz
antonkratz / kind_of_like_tree.sh
Created November 25, 2018 05:07
usually, the tree command is not installed on machines where I am not root. but I must have tree. here is an awesome fix.
find ./ | sed -e 's/[^-][^\/]*\//--/g;s/--/ |-/'
@antonkratz
antonkratz / r_rstudio_server.md
Last active February 18, 2019 02:22
install R and RStudio Server

Installing R on your own machine

The main guide on how to install R for any flavour of linux, binary or from source, is at http://cran.stat.ucla.edu/

Three different pathways to a working install, from simple to hard:

  • use the distributions package manager (easiest but not the most recent version)
  • install binary (recommended)
  • compile and install from source

I am assuming you are on Ubuntu 16.04 LTS.

@antonkratz
antonkratz / find_by_md5sum.md
Last active August 18, 2018 00:39
find a file by md5sum
@antonkratz
antonkratz / ak.gv.install.md
Last active July 31, 2019 01:10
building gv from source

install graphviz: sfdp, gvmaps, mingle

# building gv from source
# otherwise: "Error: remove_overlap: Graphviz not built with triangulation library"

wget https://graphviz.gitlab.io/pub/graphviz/stable/SOURCES/graphviz.tar.gz
gunzip graphviz.tar.gz
tar xvf graphviz.tar