Skip to content

Instantly share code, notes, and snippets.

View erik-whiting's full-sized avatar
🔬

Erik Whiting erik-whiting

🔬
View GitHub Profile
import json
from rna_motif_library import motif
# mtypes in cached motifs:
# {'UNKNOWN', 'HELIX', 'SSTRAND', 'NWAY', 'TWOWAY', 'HAIRPIN'}
# mtypes in my data:
# {'JUNCTION', 'SINGLESTRAND', 'HAIRPIN', 'HELIX'}
from scipy.stats import mannwhitneyu
def score(sequence, secondary_structure, reactivities):
"""
Inputs:
sequence: RNA sequence containing A, C, G, or U. Does not handle wildcards
like N, X, etc.
secondary_structure: Must be dot-bracket notation containing ., (, and ). Does
@erik-whiting
erik-whiting / exercise2.py
Created February 15, 2024 23:52
Class Exercise 2
class Person:
def __init__(first_name, last_name, age):
self.first_name = first_name
self.last_name = last_name
self.age = age
def set_age(new_age):
self.age = new_age
def get_age():
@erik-whiting
erik-whiting / ring.py
Created September 4, 2022 04:18
A circularly-referenceable array subtype in Python with generator support
from array import ArrayType, array
class Ring(ArrayType):
def __init__(self, *args, **kwargs):
self._set_iter_defaults()
super().__init__()
def __getitem__(self, i):
return array.__getitem__(self, i % len(self))
@erik-whiting
erik-whiting / whiting_fork_assignment.c
Created September 1, 2021 06:05
Erik Whiting - CPSM First C Assignment
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main() {
printf("Printing before first fork\n");
int t = fork();
if (t != 0) {
printf("Printing from first forked process, PID %d\n", t);
@erik-whiting
erik-whiting / execution_measurement.rb
Created February 14, 2020 20:20
Ruby class for getting execution-time statistics from different procedures
require 'benchmark'
require 'ostruct'
class ExecutionMeasurement
attr_accessor :measures
def initialize(experiments=1000, &block)
@note = 'PLEASE NOTE: All times are in miliseconds'
@func = block || nil
@measures = []
@erik-whiting
erik-whiting / network-names-and-passwords.ps1
Created October 1, 2019 01:34
PowerShell script that shows you the name and password of networks you've logged into on the computer you're running the script on
$group_policy_profiles = (netsh wlan show profile)
$user_profiles = @()
foreach ($policy_profile in $group_policy_profiles) {
if ($policy_profile -match "All User Profile") {
$profile_name = $policy_profile.split(":")[1]
$user_profiles += $profile_name.Remove(0, 1)
}
}
$network_data = @()
@erik-whiting
erik-whiting / find_fibonacci.py
Created September 9, 2019 00:07
Find the nth sequence of a Fibonacci number
import math
def fib(n):
ar = [0, 1]
if n < len(ar):
return ar[n]
else:
while n > len(ar)-1:
ar.append(
ar[len(ar)-1] + ar[len(ar)-2]
@erik-whiting
erik-whiting / stego.py
Created August 29, 2019 23:16
Simple steganography script using cv2
import cv2
# Make a generator object for the message to be hidden
def char_generator(message):
for c in message:
yield ord(c)
# Convenience function for getting image
def get_image(image_location):
img = cv2.imread(image_location)