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
import random | |
class Markov(object): | |
def __init__(self, open_file): | |
self.cache = {} | |
self.open_file = open_file | |
self.words = self.file_to_words() | |
self.word_size = len(self.words) | |
self.database() |
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
set heading off; | |
set echo off; | |
set pages 999; | |
spool dropall.sql | |
select 'drop table ' || table_name || ';' from user_tables | |
union all | |
select 'drop sequence ' || sequence_name || ';' from user_sequences order by 1; | |
spool off | |
-- Remove header and footer from dropall.sql, then... |
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
from bz2 import BZ2File # @UnresolvedImport | |
from datetime import datetime | |
from glob import glob | |
import itertools | |
import matplotlib | |
import matplotlib.pyplot as plt | |
MNEMOSYNE_ROOTS = ["/home/don/Dropbox/Mnemosyne_old/.mnemosyne/", | |
"/home/don/.local/share/mnemosyne/"] |
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 python | |
import argparse | |
import csv | |
from mpi4py import MPI | |
import logging | |
import time | |
def parseOptions(comm_world): | |
parser = argparse.ArgumentParser( |
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
from mpi4py import MPI | |
import sys | |
import argparse | |
def main(): | |
parser = argparse.ArgumentParser() | |
parser.add_argument('worker_count', type=int) | |
args = parser.parse_args() | |
mpi_info = MPI.Info.Create() |
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
import argparse | |
import csv | |
import itertools | |
from operator import itemgetter | |
parser = argparse.ArgumentParser() | |
parser.add_argument('aligned', | |
type=argparse.FileType('rU'), | |
help='aligned reads CSV file') | |
parser.add_argument('--out', |
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 python | |
from mpi4py import MPI | |
import logging | |
import time | |
import sys | |
def polling_receive(comm, source): | |
# Set this to 0 for maximum responsiveness, but that will peg CPU to 100% |
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
{ bpsh -pa ps -eo pcpu,pid,user,args ; bpsh -p -1 ps -eo pcpu,pid,user,args | bpstat -P -1 | sed -e 's/^ */ /' ; } | sort -g -k2 -r | head -30 |
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
# Tested with Django 1.9.2 | |
import sys | |
import django | |
from django.apps import apps | |
from django.apps.config import AppConfig | |
from django.conf import settings | |
from django.db import connections, models, DEFAULT_DB_ALIAS | |
from django.db.models.base import ModelBase |
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
from collections import Counter | |
import traceback | |
stack_counts = Counter() | |
def record(limit=10): | |
stack = traceback.extract_stack(limit=limit+1)[:-1] | |
stack_report = '\n'.join(map(str, stack)) | |
stack_counts[stack_report] += 1 | |
OlderNewer