Skip to content

Instantly share code, notes, and snippets.

Avatar

Sam Nicholls SamStudio8

View GitHub Profile
View amplyfy.py
"""
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 Jun 7, 2016
Simple fail2ban DOS jail
View http-get-dos.conf
# 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 Feb 25, 2016
A silly I did once...
View gdb
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 Aug 29, 2015
Attempts to Extract Exceptions from `rapsearch` Core Dump
View backtrace.gdb
(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> >&) ()
View 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:

@SamStudio8
SamStudio8 / acct_parse.py
Last active Apr 30, 2019
SGE QACCT Parsing
View acct_parse.py
"""
Provides functions for the purpose of parsing a Sun Grid Engine (SGE)
accounting file for job metadata.
"""
__author__ = "Sam Nicholls <msn@aber.ac.uk>"
__copyright__ = "Copyright (c) Sam Nicholls"
__version__ = "0.0.32"
__maintainer__ = "Sam Nicholls <msn@aber.ac.uk>"
View cascade.py
y3 = [86,90,90,68,86,79,79,78,61,62,45,60]
y2 = [81,81,79,79,77,73,55,55,86,84,83,81]
# 8 modules per band
BAND_SIZE = 8
BAND_DELTA = len(y3) - BAND_SIZE
# Extract BAND_SIZE best year 3 modules
y3_sorted = sorted(y3)
band_3 = y3_sorted[-BAND_SIZE:]
@SamStudio8
SamStudio8 / awk
Last active Aug 29, 2015
Benchmarking reads over a pair of 42GB FASTQ files (~1.5 billion lines)
View awk
# awk 3.1.7
# 1hr 1m
awk '$1 ~ /@/ {++c} END {print c}' $1
# 1hr 1m
awk '/^@/ {c++} END {print c}' $1
# 55m
awk '{if (substr($0,0,1) == "@") { ++c }} END {print c}' $1
You can’t perform that action at this time.