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
autopep8 path/to/project/directory --recursive --in-place --pep8-passes 2000 --verbose |
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
function W_ = remove_self_loops(W) | |
% REMOVE_SELF_LOOPS Removal of self-self connections from an input | |
% matrix | |
% | |
% W_ = remove_self_loops(W); | |
% | |
% Return a copy of the input matrix with all self-self connections | |
% removed (i.e. the primary diagonal set to all 0s). | |
% | |
% Inputs: W binary or weighted connectivity matrix |
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 inspect import signature | |
from scipy.integrate import quad | |
def get_fn_str(fn, lims=(0, 1), existing_string=None, arg_count=0): | |
""" | |
Recursively generate a string which, when evaluated, will integrate an arbitrary function over all of its variables within the given limits. | |
""" | |
if existing_string is None: | |
return get_fn_str(fn, lims=lims, existing_string="quad({{}}, {}, {})[0]".format(lims[0], lims[1]), |
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 | |
timestamp=$(date +"%Y-%m-%d_%H:%M:%S") | |
zip -r "backup_$timestamp.zip" * |
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 problog.tasks import sample | |
from problog.program import PrologString | |
modeltext = """ | |
my_uniform(0,10)::a. | |
0.5::b. | |
c :- value(a, A), A >= 3; b. | |
query(a). | |
query(b). | |
query(c). |
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 | |
set -e | |
STARTING_ENV="$CONDA_DEFAULT_ENV" | |
if test -z "$1" ; then | |
TARGET_ENV="$1" | |
source activate TARGET_ENV | |
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
class NodeClassifier: | |
def __init__(self): | |
self._nodes = set(NODES) | |
self._subs = dict(ALLOWED_SUBSTITUTIONS) | |
def __getitem__(self, key): | |
if key in self._nodes: | |
return [key] | |
ret = [] |
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
""" | |
And here's the easiest way to get that file in modules installed in this way. | |
""" | |
import os | |
import sys | |
DATAFILE_PATH = os.path.abspath('path_to_something') |
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
def cycle_gen(sequence): | |
while True: | |
yield from sequence |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
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
1 | |
2 | |
3 |
OlderNewer