Skip to content

Instantly share code, notes, and snippets.

View SamStudio8's full-sized avatar

Sam Nicholls SamStudio8

View GitHub Profile
@SamStudio8
SamStudio8 / base.Dockerfile
Last active August 2, 2019 09:40
Compile gpu-racon for the ONT Promethion with CUDA 9.0.176
# grab an off the shelf container with cuda9
FROM nvidia/cuda:9.0-devel-ubuntu16.04
# update gcc to gcc-6 as the default gcc-5 is too old
RUN apt-get update && apt-get install -y software-properties-common wget git
RUN add-apt-repository ppa:ubuntu-toolchain-r/test
RUN apt-get update && apt-get install -y gcc-6 g++-6
# update cmake as the default is too old
RUN wget -qO- "https://cmake.org/files/v3.15/cmake-3.15.1-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/
@SamStudio8
SamStudio8 / get_pion_signal.sh
Created October 29, 2018 12:06
get_pion_signal.sh
# A little bash script to download our juicy ONT PION data
# If this doesn't work for you, express your disappointment to @samstudio8.
# Use "EVEN" or "LOG" for $1, eg: `bash get_pion_signal.sh EVEN`
MODE=$1
echo "Fetching signal blocks. Don't be afraid to CRTL+C and resume if needed..."
for i in {00..25}
do
echo $i;
wget -c https://nanopore.s3.climb.ac.uk/Zymo-PromethION-$MODE-BB-SN_signal.tar.$i;
import sys
THRESHOLD = 0.25 # reads must have 25% of their k-mers assigned
for line in sys.stdin:
fields = line.strip().split()
kmers_fields = fields[4:]
total_kmers = sum([int(x.split(":")[1]) for x in kmers_fields])
unassigned_kmers = sum([int(x.split(":")[1]) for x in kmers_fields if x[0] == "0"])
PATH=$PATH:/home/ubuntu/ware/blast/ncbi-blast-2.7.1+/bin;
kraken2-build --download-taxonomy --threads 24 --db /working/databases/kraken2-test/
kraken2-build --download-library archaea --db /working/databases/kraken2-test/
kraken2-build --download-library bacteria --db /working/databases/kraken2-test/
kraken2-build --download-library fungi --db /working/databases/kraken2-test/
kraken2-build --download-library protozoa --db /working/databases/kraken2-test/
kraken2-build --download-library viral --db /working/databases/kraken2-test/
kraken2-build --download-library UniVec_Core --db /working/databases/kraken2-test/
kraken2-build --threads 24 --build --db /working/databases/kraken2-test/
@SamStudio8
SamStudio8 / hearty.py
Created June 24, 2018 20:08
python-fitbit intraday heart
import fitbit
import gather_keys_oauth2 as Oauth2
import datetime
CLIENT_ID = 'YOUR CLIENT'
CLIENT_SECRET = 'YOUR SECRET'
server = Oauth2.OAuth2Server(CLIENT_ID, CLIENT_SECRET)
server.browser_authorize()
ACCESS_TOKEN = str(server.fitbit.client.session.token['access_token'])
@SamStudio8
SamStudio8 / amplyfy.py
Last active November 13, 2017 16:11
amplyfyer
"""
A scrappy esoteric glue program for Ben because he only really likes databases.
Given a tab delimited file where:
fields[0] ORF id
fields[1] 1-pos Start
fields[2] 1-pos End
fields[-1] Structural Prediction Code
Output a cast dataframe with a line per ORF, describing all structural predictions
for that ORF as a single string. Additionally enumerating each viable code's proportion
of that string as a percentage. You may alter CODES to add/remove prediction codes
@SamStudio8
SamStudio8 / http-get-dos.conf
Created June 7, 2016 01:43
Simple fail2ban DOS jail
# Fail2Ban configuration file
#
# NOTE
# You should set up in the jail.conf file, the maxretry and findtime carefully in order to avoid false positives.
#
# Author: http://www.go2linux.org
# Modified by: samnicholls.net
# * Mon 6 Jun 2016 - Updated failregex to capture HOST group correctly
[Definition]
@SamStudio8
SamStudio8 / gdb
Created February 25, 2016 19:28
A silly I did once...
Program received signal SIGSEGV, Segmentation fault.
_int_malloc (av=av@entry=0x7ffff7dd6b40 <main_arena>, bytes=bytes@entry=24) at malloc.c:3803
3803 set_head (remainder, remainder_size | PREV_INUSE);
(gdb) bt
#0 _int_malloc (av=av@entry=0x7ffff7dd6b40 <main_arena>, bytes=bytes@entry=24) at malloc.c:3803
#1 0x00007ffff7a9e950 in __GI___libc_malloc (bytes=24) at malloc.c:2914
#2 0x0000000000400812 in main ()
@SamStudio8
SamStudio8 / backtrace.gdb
Last active August 29, 2015 14:20
Attempts to Extract Exceptions from `rapsearch` Core Dump
(gdb) bt
#0 0x000000318f632625 in raise () from /lib64/libc.so.6
#1 0x000000318f633e05 in abort () from /lib64/libc.so.6
#2 0x00000031926bea7d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib64/libstdc++.so.6
#3 0x00000031926bcbd6 in std::__exception_ptr::exception_ptr::operator=(std::__exception_ptr::exception_ptr const&) () from /usr/lib64/libstdc++.so.6
#4 0x0000000023b8dbf0 in ?? ()
#5 0x00007ffffffbb500 in ?? ()
#6 0x00000000004452e2 in boost::archive::basic_binary_iarchive<boost::archive::binary_iarchive>::init() ()
#7 0x000000000043d5d4 in CMergeUnit::Update(int, std::vector<CHitUnit, std::allocator<CHitUnit> >&) ()
#8 0x0000000000409a57 in CHashSearch::MergeRes(int, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&) ()
@SamStudio8
SamStudio8 / keybase.md
Created March 16, 2015 15:38
keybase.md

Keybase proof

I hereby claim:

  • I am samstudio8 on github.
  • I am samstudio8 (https://keybase.io/samstudio8) on keybase.
  • I have a public key whose fingerprint is 1CA4 381B D09D 09D9 A250 0BFF 3DCD 66BB A142 ADA9

To claim this, I am signing this object: