Skip to content

Instantly share code, notes, and snippets.

View vishnubob's full-sized avatar

Giles Hall vishnubob

  • Boston, MA
View GitHub Profile
@vishnubob
vishnubob / model-organisms-list.md
Created October 11, 2019 15:39
List of Model Organisms

Viruses

  • Phage lambda
  • Phi X 174
  • SV40
  • T4 phage
  • Tobacco mosaic virus
  • Herpes simplex virus

Prokaryotes

@vishnubob
vishnubob / python-run.vimrc
Last active September 24, 2022 01:32
Add this to your .vimrc to execute python in a new window. If your program produces no output, no windows is created.
nnoremap <silent> <leader><space> :call SaveAndExecutePython()<CR>
vnoremap <silent> <leader><space> :<C-u>call SaveAndExecutePython()<CR>
" https://stackoverflow.com/questions/18948491/running-python-code-in-vim
function! SaveAndExecutePython()
" SOURCE [reusable window]: https://github.com/fatih/vim-go/blob/master/autoload/go/ui.vim
" save and reload current file
silent execute "update | edit"
@vishnubob
vishnubob / simple-autoencode.py
Created March 31, 2018 20:44
Simple Autoencoder with useful PIL based image tiler
# MXNet Autoencoder
# based on example from SherlockLiao
# https://github.com/SherlockLiao/mxnet-gluon-tutorial/blob/master/08-AutoEncoder/simple_autoencoder.py
import operator
import bisect
import os
import numpy as np
import mxnet as mx
from mxnet import gluon
@vishnubob
vishnubob / lesson_1.md
Last active November 15, 2017 22:32
Tables and Scales: Do'h-Ray-Meh

Tables and Scales: Do'h-Ray-Meh

Digital Music systems such as MIDI use integers to represent different notes. This method of representation is known an enumeration. For this exercise, we will write a program to build a hash table that translates note values to numerical values, and an array to translate numerical values back to note values. In order to accomplish this, we will need to know two pieces of information, and let our program enumerate our two lookup tables.

  1. What are the two pieces of information our program needs to enumerate the tables?
  2. Why use a hash table for note lookups, and an array for numerical lookups?

For now, we will ignore sharps and flats, and just utilize the "white keys" of a piano when building our table. A full octave is represented by eight notes: C D E F G A B C. When specifying note values, we will use scientific pitch notation.

  1. How many full octaves can we enumerate with an 8-bit unsigned integer? h
from Bio.Blast import NCBIWWW
from Bio.Blast import NCBIXML
import random
def random_sequence_generator(length):
return str.join('', [random.choice('AGTC') for x in range(length)])
def gc_good(sequence, ideal=.5, spread=.05):
val = (sequence.count('G') + sequence.count('C')) / float(len(sequence))
return (ideal - spread) < val < (ideal + spread)
#!/usr/bin/env python
# -*- coding: latin-1 -*-
import google
import requests
import magic
def get_pdf(url, title):
print url
pdf = requests.get(url)
with magic.Magic() as m:
ghall@littletit:[~/code/chainsaw/python] python vt_passwd.py -p /dev/ttyUSB2
Sun Jul 4 20:28:38 2010
____ _ ____ ______ _____ ____ ____
| _ \ / \ / ___/ ___\ \ / / _ \| _ \| _ \ _ _
| |_) / _ \ \___ \___ \\ \ /\ / / | | | |_) | | | | (_|_)
| __/ ___ \ ___) |__) |\ V V /| |_| | _ <| |_| | _ _
|_| /_/ \_\____/____/ \_/\_/ \___/|_| \_\____/ (_|_)
@vishnubob
vishnubob / shapeoko_grbl_settings.txt
Created January 4, 2015 15:42
Shapeoko GRBL Settings
$0=40.020 (x, step/mm)
$1=40.020 (y, step/mm)
$2=320.000 (z, step/mm)
$3=30 (step pulse, usec)
$4=500.000 (default feed, mm/min)
$5=500.000 (default seek, mm/min)
$6=224 (step port invert mask, int:11100000)
$7=255 (step idle delay, msec)
$8=25.000 (acceleration, mm/sec^2)
$9=0.050 (junction deviation, mm)
@vishnubob
vishnubob / pulley.gcode
Created November 28, 2014 16:58
.gcode file demonstrating OctoPrint G4 dwell bug
This file has been truncated, but you can view the full file.
M140 S100.000000
M109 T0 S230.000000
T0
M190 S100.000000
;Sliced at: Wed 26-11-2014 21:39:25
;Basic settings: Layer height: 0.1 Walls: 0.8 Fill: 100
;Print time: #P_TIME#
;Filament used: #F_AMNT#m #F_WGHT#g
;Filament cost: #F_COST#
;M190 S100 ;Uncomment to add your own bed temperature line
@vishnubob
vishnubob / octoprint.log
Created November 28, 2014 16:55
OctoPrint log file for G4 dwell bug
2014-11-28 15:26:04,034 - octoprint.server.util.sockjs - INFO - New connection from client: 192.168.1.8
2014-11-28 15:30:00,578 - octoprint.util.comm - ERROR - Something crashed inside the serial connection loop, please report this in OctoPrint's bug tracker:
Traceback (most recent call last):
File "/home/ghall/local/octoprint/local/lib/python2.7/site-packages/OctoPrint-1.2.0_dev_242_g084ca95-py2.7.egg/octoprint/util/comm.py", line 924, in _monitor
self._sendNext()
File "/home/ghall/local/octoprint/local/lib/python2.7/site-packages/OctoPrint-1.2.0_dev_242_g084ca95-py2.7.egg/octoprint/util/comm.py", line 1036, in _sendNext
self._changeState(self.STATE_OPERATIONAL)
File "/home/ghall/local/octoprint/local/lib/python2.7/site-packages/OctoPrint-1.2.0_dev_242_g084ca95-py2.7.egg/octoprint/util/comm.py", line 218, in _changeState
self._callback.mcStateChange(newState)
File "/home/ghall/local/octoprint/local/lib/python2.7/site-packages/OctoPrint-1.2.0_dev_242_g084ca95-py2.7.egg/octoprint/printer.py