Skip to content

Instantly share code, notes, and snippets.

View gabefinch's full-sized avatar
💅

Gabe gabefinch

💅
View GitHub Profile
#! /usr/bin/env python
#define acceptable input
rna = ['a','u','g','c','A','U','G','C',]
boxb = 'CCGGGAAAAAGUCCCGG'
#convert t to u
def makerna(seq):
for x in range(len(seq)):
function decrypt(text) {
const [ivStr, encodedStr] = text.split(':')
const initVector = new Buffer(ivStr, 'base64');
const decipher = crypto.createDecipheriv(
'aes-256-cbc', CRYPTO_KEY, initVector
);
const encrypted = new Buffer(encodedStr, 'base64');
let decrypted = Buffer.concat(
[decipher.update(encrypted), decipher.final()]
);
var crypto = require('crypto');
const CRYPTO_KEY = 'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ'; // Must be 256 bytes (32 characters)
const message = `I see a little silhouetto of a man,
Scaramouch, scaramouch will you do the fandango,
Thunderbolt and lightning very very frightening me,
Gallileo, Gallileo,
Gallileo, Gallileo,
Gallileo Figaro - magnifico`
{
"atomKeymap.promptV3Features": true,
"editor.multiCursorModifier": "ctrlCmd",
"editor.fontSize": 18,
"editor.lineHeight": 22,
"editor.fontWeight": "300",
"editor.fontFamily": "Iosevka",
// "editor.fontFamily": "Office Code Pro Medium",
//"editor.fontFamily": "Office Code Pro",
@gabefinch
gabefinch / reverse-list.js
Last active October 27, 2020 22:43
Linked list reverser
function reverseList(input, accumulator) {
var reversed = {
id: input.id,
next: accumulator || null
};
return input.next
? reverseList(input.next, reversed)
: reversed;
}
function nums(n = 1) {
return { first: n, rest: () => nums(n + 1) };
}
nums().first; // => 1
function take(stream, n) {
if (n <= 0) return [];
else {
const { first, rest } = stream();
// Identity functor
const Box = x => ({
map: f => Box(f(x)),
fold: f => f(x),
inspect: () => `Box(${x})`
});
// const Either = Right || Left
const Right = x => ({
export default class PersistentObject {
constructor(name, contents) {
this._validateContents(contents);
this.name = name;
this.contents = contents;
}
set(contents) {
this.contents = { ...contents };
localStorage.setItem(this.name, this.contents);
// from this excellent tutorial on decorators:
// https://javascript.info/call-apply-decorators
let worker = {
slow(min, max) {
alert(`Called with ${min},${max}`);
return min + max;
}
};
@gabefinch
gabefinch / styles.plantuml
Created April 30, 2020 06:13
PlantUML skinparams
@startuml
' Basic styles that improve on defaults
skinparam BackgroundColor Bisque
skinparam NoteBorderColor DeepSkyBlue
skinparam ArrowColor Navy
skinparam Default {
FontName Consolas
FontSize 16
}
skinparam Title {