Skip to content

Instantly share code, notes, and snippets.

Marvin T MarvinT

Block or report user

Report or block MarvinT

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
MarvinT / black_code_prettify.json
Last active Oct 29, 2019
json you can paste into jupyter notebook's code prettify configuration that makes it use black to reformat your code instead of yapf.
View black_code_prettify.json
"python": {
"library": "import json\ndef black_reformat(cell_text):\n import black\n import re\n cell_text = re.sub('^%', '#%#', cell_text, flags=re.M)\n try:\n reformated_text = black.format_str(cell_text, 88)\n except TypeError:\n reformated_text = black.format_str(cell_text, mode=black.FileMode(line_length=88))\n return re.sub('^#%#', '%', reformated_text, flags=re.M)",
"prefix": "print(json.dumps(black_reformat(u",
"postfix": ")))"
"r": {
"library": "library(formatR)\nlibrary(jsonlite)",
"prefix": "cat(toJSON(paste(tidy_source(text=",
"postfix": ", output=FALSE)[['text.tidy']], collapse='\n')))"
def filtered_response(spk_times, tau = .01):
spk_times = spk_times.reshape((-1, 1))
norm_factor = tau * np.sqrt(2. * np.pi)
return lambda t: np.sum(np.exp(-(spk_times - t.reshape((1,-1))) ** 2 / (2 * tau * tau)), 0) / norm_factor
You can’t perform that action at this time.