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
# Conway's famed FRACTRAN program to compute prime numbers. | |
# See https://en.wikipedia.org/wiki/FRACTRAN | |
def apply(num, prog): | |
while True: | |
for f, d in prog: | |
if num*f % d == 0: | |
yield (num := num*f // d) | |
break | |
else: |
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
""" Mixing threads and processes (fork) is a bad idea. | |
When a process forks, only the thread that was running at the time of the | |
fork is copied to the child process. That means that if a lock was acquired | |
by a background thread in the main process, that lock will appear as locked | |
in the child process, with no way to unlock it. | |
""" | |
import os |
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
;; Derivation of the Y combinator following Jim Weirich's approach. | |
(define fact-improver | |
(lambda (partial) | |
(lambda (n) (if (= n 0) 1 (* n (partial (- n 1))))))) | |
(define err | |
(lambda () (error "Should not be called"))) | |
(define fx-naive |
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 numpy as np | |
from chaco.api import ArrayPlotData, Plot, VPlotContainer | |
from chaco.tools.api import RangeSelection, RangeSelectionOverlay | |
from enable.api import Component, ComponentEditor | |
from traits.api import Enum, HasTraits, Instance | |
from traitsui.api import UItem, View | |
class A(HasTraits): |
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
diff --git a/Makefile b/Makefile | |
index 3e47adc..a4b46e2 100644 | |
--- a/Makefile | |
+++ b/Makefile | |
@@ -3,8 +3,8 @@ CFLAGS = -Wall | |
DEBUG = -g | |
LIBS = -lm | |
OPT = -O3 | |
-MAXKMERLENGTH=31 | |
-CATEGORIES=2 |
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
### Keybase proof | |
I hereby claim: | |
* I am jvkersch on github. | |
* I am jvkersch (https://keybase.io/jvkersch) on keybase. | |
* I have a public key whose fingerprint is 781F C24B 38CF A1DE 8033 74D9 41FC 9BEB 1315 D073 | |
To claim this, I am signing this object: |
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
Adapted from https://github.com/JuliaLang/PackageCompiler.jl/issues/144. | |
Compile the C code with | |
gcc runjl.c -o runjl -Wall -std=gnu99 -I'/Applications/Julia-1.0.app/Contents/Resources/julia/include/julia' -DJULIA_ENABLE_THREADING=1 -fPIC -L'/Applications/Julia-1.0.app/Contents/Resources/julia/lib' -Wl,-rpath,'/Applications/Julia-1.0.app/Contents/Resources/julia/lib' -Wl,-rpath,'/Applications/Julia-1.0.app/Contents/Resources/julia/lib/julia' -ljulia | |
Use PackageCompiler.jl to produce a shared library from the Julia 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
/* Find begin of query/sequence, together with number of mismatches/indels | |
* for parasail SG trace-enabled alignment. | |
* | |
* Note: defines (T, STRIPED) must match the kind of alignment used. | |
* | |
* Compile with gcc -Wall traceback_info.c -o traceback_info -lparasail | |
*/ | |
#include <assert.h> | |
#include <stdio.h> |
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 | |
# TODO | |
# 2. support block structure | |
from collections import deque, namedtuple | |
import contextlib | |
from functools import reduce | |
import operator | |
import re |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.