This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"compress/gzip" | |
"os" | |
"bufio" | |
"fmt" | |
"log" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pure Python ChaCha20 | |
# Based on Numpy implementation: https://gist.github.com/chiiph/6855750 | |
# Based on http://cr.yp.to/chacha.html | |
# | |
# I wanted an implementation of ChaCha in clean, understandable Python | |
# as a way to get a handle on the algorithm for porting to another language. | |
# There are plenty of bindings but few pure implementations, because | |
# Pure Python is too slow for normal practical use in Cryptography. | |
# | |
# The preceding implementation used NumPy, which avoided a lot of the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script installs Python3, ipython, pip, and uses pip to install biopython. | |
# You'll be asked for your password. | |
sudo apt-get install python3-dev ipython3 python3-pip build-essential | |
sudo pip install biopython | |
# That's it, two lines! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VersionedDict(dict): | |
'''A dictionary sublcass that remembers all or a defined number of prior entries for a key. | |
Allows reversion by number from "head" or by absolute reference in revision list. | |
Allows retrieval of currently retained revision history for a key. | |
Deletion deletes all revisions, not merely the most recent. | |
If instantiated with the "revisions" keyword and an integer argument, only retains that many revisions per entry.''' | |
def __init__(self, *args, **kwargs): | |
revisions = kwargs.pop('revisions', None) | |
self._allowed_revisions = abs(int(revisions)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import time | |
import datetime | |
import json | |
import re | |
timestamp_format = '%a %b %d %H:%M:%S %z %Y' | |
def twitter_timestamp_to_obj(time_string): | |
'Returns a timezone-aware datetime object.' | |
return datetime.datetime.strptime(time_string, timestamp_format) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import time | |
import datetime | |
import os | |
import json | |
timestamp_format = '%a %b %d %H:%M:%S %z %Y' | |
def twitter_timestamp_to_obj(time_string): | |
'Returns a timezone-aware datetime object.' | |
return datetime.datetime.strptime(time_string, timestamp_format) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
fixfile = sys.argv[1] | |
with open(fixfile) as InputFile: | |
word_soup = InputFile.read() | |
# Strip off excess whitespace and any trailing ellipsis. | |
word_soup = word_soup.strip().strip(".!?") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
from sys import argv | |
# Walk through folders recursively, list the full path and number of (extension) files found in each. | |
basefolder = os.path.expanduser(argv[1]) | |
filetype = str(argv[2]).lower() | |
output = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"End": { | |
"TAG": { | |
"frequency": 0.0, | |
"relfreq": 0.0 | |
}, | |
"localfrequency": 2.74, | |
"TGA": { | |
"frequency": 0.98, | |
"relfreq": 0.3576642335766423 |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"binsi": { | |
"target_site": "CCWGG", | |
"name": "BinSI", | |
"suppliers": [], | |
"source": "ATCC 15702", | |
"references": [ | |
"Khosaka, T., Kiwaki, M., Rak, B., (1983) FEBS Lett., vol. 163, pp. 170-174." | |
], | |
"prototype": "EcoRII", |
NewerOlder