Skip to content

Instantly share code, notes, and snippets.

View terrycojones's full-sized avatar

Terry Jones terrycojones

View GitHub Profile
#!/usr/bin/env python
"""Given category frequencies on the command line, print the entropy (base 2).
E.g., if there are 12 things in the first category, 4 in the second,
and 5 in the third, run
$ entropy.py 12 4 5
1.4099
"""
parser.add_argument(
'--noTsvHeader', action='store_false', default=True,
dest='printTsvHeader',
help='Do not print a TSV header (ignored uness --tsv is used).')
#!/bin/sh
cat<<'EOF'
(expressions...), [expressions...],
{key: value...}, {expressions...} Binding or parenthesized expression,
list display, dictionary display, set display
x[index], x[index:index],
x(arguments...), x.attribute Subscription, slicing, call, attribute reference
await x Await expression
df = pd.DataFrame(
barData,
index=('KG (0-6 years)', 'Young (0-19 years)', 'Older (>19 years)'),
columns=('100,000', '1,000,000'),
)
ax = df.plot.bar(figsize=(12, 6), ylim=(0, 100),
title='Age group percentages with viral load >100,000 or >1M',
rot=0, fontsize=20, table=False)
def solve1(n, a):
s = n + 1
for p in range(len(a) - 2 * s):
if a[p] + a[p + s] + a[p + s + s] == 0:
a[p] = a[p + s] = a[p + s + s] = n
if n > 1:
solve1(n - 1, a)
else:
print(''.join(map(str, a)))
a[p] = a[p + s] = a[p + s + s] = 0
def solve1(n, a):
s = n + 1
l = len(a)
for p in range(0, l - 1):
if p + s * 2 < l:
if a[p] + a[p + s] + a[p + s + s] == 0:
a[p] = a[p + s] = a[p + s + s] = n
if (n > 1):
The “require topological evidence” setting allows you to specify
whether or not you want the program to discard recombination signals
that have no phylogenetic support. While this might seem an obvious
thing to do, you should realise that many of the recombination
detection methods implemented in RDP4 are fully capable of detecting
real recombination events that do not result in any detectable change
in phylogenetic tree topologies along an alignment. The default setting
is that topological evidence is required but this is simply because most
users (for good or bad reasons) would find this setting most desirable.
Model: SAMSUNG MZVLB1T0HALR-000L7 (nvme)
Disk /dev/nvme0n1: 1024GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags Installer.og
1 1049kB 135MB 134MB ext4 msftres
2 135MB 78.0GB 77.8GB ntfs Basic data partition msftdata
3 78.0GB 144GB 66.2GB linux-swap(v1)
@terrycojones
terrycojones / factor
Created May 19, 2019 19:59
A factoring program written in dc
[[neither]plsx]sn[c2pla2/sallx]se[ladv1+sm0=nla1=ncla2=pla2%0=elfx]sl
[ldlm<pclald%0=cld2+sdlfx]sf[lap[is prime.]plsx]sp[ldplald/salfx]sc
[[enter X : ]P?dsa0>n3sdllx]ss[[negative]plsx]snlsx
(elpy-enable)
(pyvenv-workon "37")
(setq elpy-test-runner 'elpy-test-trial-runner)
(setq
elpy-test-trial-runner-command
(list (expand-file-name (format "~/.virtualenvs/%s/bin/trial" pyvenv-virtual-env-name)) "--rterrors"))
(when (require 'flycheck nil t)
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
(add-hook 'elpy-mode-hook 'flycheck-mode))