Skip to content

Instantly share code, notes, and snippets.

Avatar

Joe Healey jrjhealey

View GitHub Profile
View patch-edid.rb
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@jrjhealey
jrjhealey / crop_to_fix.tex
Created Jun 19, 2019
A construct to enable, centered, cropped-to-fit content to be generated dynamically. Useful for equations/figures etc. This example uses TeXShade for sequence alignment.
View crop_to_fix.tex
\documentclass[a4paper, oneside, 11pt]{memoir} % Doc Setup
\usepackage[left=1cm, right=1cm, top=1cm, bottom=1cm]{geometry} % Doc Geometry
\usepackage{texshade}
\usepackage{lscape}
\usepackage[active, tightpage]{preview}
\begin{document}
\begin{landscape}
\begin{preview}
@jrjhealey
jrjhealey / addingusers.sh
Last active Feb 10, 2020
Adding Server Users (reminder for myself)
View addingusers.sh
# Step 1
# Add the user with
sudo adduser username
# Ensure a temporary password is given to the account else it remains locked
# other options can be left blank
# Add the username to the AllowedUsers field in /etc/ssh/sshd_config (on the server)
# Next step is often easier to do as the new user to avoid messing up file ownership
sudo -i -u newuser
@jrjhealey
jrjhealey / RandomHumanKmers.txt
Created Jan 21, 2019
Generating N random kmers from the Human Genome (GRCh38)
View RandomHumanKmers.txt
# This gist contains 10 randomly selected kmers (9mers) from the reference human genome (GRCh38).
The following code was used to generate the output:
import re, sys
from Bio import SeqIO
import random
import time
k = 9
n = 10
@jrjhealey
jrjhealey / align_and_remap.sh
Created Jan 15, 2019
Aligning and remapping reads to a reference.
View align_and_remap.sh
#!/bin/bash
# Script to align fastq reads to a given reference, and output the necessary files sorted etc.
# Script requires bwa and samtools in path - check for existence:
command -v bwa >/dev/null 2>&1 || { echo >&2 "BWA doesn't appear to be installed. Aborting."; exit 1; }
command -v samtools >/dev/null 2>&1 || { echo >&2 "samtools doesn't appear to be installed. Aborting."; exit 1; }
# Capture inputs
@jrjhealey
jrjhealey / PythonColours.py
Last active Dec 16, 2020
Basics of python string colouring with ANSI codes
View PythonColours.py
#Copy to a script and run in a terminal to see the codes and their results (this is not an exhaustive list)
print("\033[0;37;40m Normal text\n")
print("\033[2;37;40m Underlined text\033[0;37;40m \n")
print("\033[1;37;40m Bright Colour\033[0;37;40m \n")
print("\033[3;37;40m Negative Colour\033[0;37;40m \n")
print("\033[5;37;40m Negative Colour\033[0;37;40m\n")
print("\033[1;37;40m \033[2;37:40m TextColour BlackBackground TextColour GreyBackground WhiteText ColouredBackground\033[0;37;40m\n")
print("\033[1;30;40m Dark Gray \033[0m 1;30;40m \033[0;30;47m Black \033[0m 0;30;47m \033[0;37;41m Black \033[0m 0;37;41m")
print("\033[1;31;40m Bright Red \033[0m 1;31;40m \033[0;31;47m Red \033[0m 0;31;47m \033[0;37;42m Black \033[0m 0;37;42m")
@jrjhealey
jrjhealey / Orthologies_over_time.tsv
Created Nov 20, 2018
Results of HHPred homology queries
View Orthologies_over_time.tsv
We can't make this file beautiful and searchable because it's too large.
PVCpnf_1 PAU_03353 PAU_03392 5W5F 5W5F_F 99.4 1.7e-16 2.8e-21 108.8 >5W5F_F Tail tube protein gp19; T4 tail tube, dose limit;{Enterobacteria phage T4 sensu lato}
PVCpnf_2 PAU_03352 PAU_03391 3J9Q 3J9Q_B 100.0 3.6e-34 6e-39 243.2 >3J9Q_B sheath, tube; pyocin, bacteriocin, sheath, tube, STRUCTURAL; 3.5A {Pseudomonas aeruginosa}
PVCpnf_3 PAU_03351 PAU_03390 3J9Q 3J9Q_B 99.9 8.9e-32 1.5e-36 234.4 >3J9Q_B sheath, tube; pyocin, bacteriocin, sheath, tube, STRUCTURAL; 3.5A {Pseudomonas aeruginosa}
PVCpnf_4 PAU_03350 PAU_03389 3J9Q 3J9Q_B 99.9 9.3e-28 1.6e-32 207.6 >3J9Q_B sheath, tube; pyocin, bacteriocin, sheath, tube, STRUCTURAL; 3.5A {Pseudomonas aeruginosa}
PVCpnf_5 PAU_03349 PAU_03388 5IV5 5IV5_I 99.0 2.4e-13 4e-18 93.6 >5IV5_IB Baseplate wedge protein gp6, Baseplate; T4, baseplate-tail tube complex, pre-attachment; 4.11A {Enterobacteria phage T4}
@jrjhealey
jrjhealey / README.rst
Created Nov 15, 2018 — forked from sublee/README.rst
Finger Binary ASCII art generator for Python
View README.rst

Finger Binary

What's Finger Binary?

Here is a description of `Finger Binary in Wikipedia`_.

Finger binary is a system for counting and displaying binary numbers on the
@jrjhealey
jrjhealey / seqcol.sh
Created Oct 10, 2018
Entirely uncessarily complex script to colour DNA sequences at arbitrary positions.. because...reasons? Even the help is colourful!
View seqcol.sh
#!/bin/bash
# Set colours:
df=$(tput sgr0)
tr=$(tput setaf 1)
tg=$(tput setaf 2)
ty=$(tput setaf 3)
tb=$(tput setaf 4)
usage(){
@jrjhealey
jrjhealey / seqcol.sh
Created Oct 10, 2018
Entirely uncessarily complex script to colour DNA sequences at arbitrary positions.. because...reasons? Even the help is colourful!
View seqcol.sh
#!/bin/bash
# Set colours:
df=$(tput sgr0)
tr=$(tput setaf 1)
tg=$(tput setaf 2)
ty=$(tput setaf 3)
tb=$(tput setaf 4)
usage(){