Skip to content

Instantly share code, notes, and snippets.

View marcosfelt's full-sized avatar

Kobi Felton marcosfelt

View GitHub Profile
@samgoldman97
samgoldman97 / DLKCat_baseline.py
Last active September 24, 2022 23:28
DLKCat_baseline_reanalysis
""" DLKCat_baseline.py
This file conducts a KNN baseline for predicting Kcat parameters
Original Paper: https://github.com/SysBioChalmers/DLKcat/tree/master/
Original Code: https://www.nature.com/articles/s41929-022-00798-z
To run, create an enviornment with packages below and download/unzip data (download_data.sh)
Requirements:
import * as React from "react";
import { useMousePosition } from "~/hooks/useMousePosition";
/** Component to cover the area between the mouse cursor and the sub-menu, to allow moving cursor to lower parts of sub-menu without the sub-menu disappearing. */
export function MouseSafeArea(props: { parentRef: React.RefObject<HTMLDivElement> }) {
const { x = 0, y = 0, height: h = 0, width: w = 0 } = props.parentRef.current?.getBoundingClientRect() || {};
const [mouseX, mouseY] = useMousePosition();
const positions = { x, y, h, w, mouseX, mouseY };
return (
<div
@slinderman
slinderman / jax_minimize_wrapper.py
Last active April 6, 2023 14:06
A simple wrapper for scipy.optimize.minimize using JAX. UPDATE: This is obsolete now that `jax.scipy.optimize.minimize` is exists!
"""
A collection of helper functions for optimization with JAX.
UPDATE: This is obsolete now that `jax.scipy.optimize.minimize` is exists!
"""
import numpy as onp
import scipy.optimize
from jax import grad, jit
from jax.tree_util import tree_flatten, tree_unflatten
from jax.flatten_util import ravel_pytree
"""Configuration library for experiments."""
from typing import Dict, Any
import logging
import pprint
import sys
import argparse
logger = logging.getLogger(__name__)
parser = argparse.ArgumentParser(description=__doc__, fromfile_prefix_chars="@")
@unixpickle
unixpickle / maml.py
Created October 12, 2019 19:08
MAML in PyTorch
import torch
import torch.nn.functional as F
def maml_grad(model, inputs, outputs, lr, batch=1):
"""
Update a model's gradient using MAML.
The gradient will point in the direction that
improves the total loss across all inner-loop
// ==UserScript==
// @name Inline Math for Notion.so
// @homepageURL https://www.notion.so/evertheylen/Notion-Inline-Math-9c5047a4e7c84643848b3630db8d5a5e
// @version 0.2.1
// @match https://www.notion.so/*
// @grant GM_addStyle
// @require https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/katex.js
// ==/UserScript==
// Instructions for use:
@chrisfcarroll
chrisfcarroll / Uninstall-Programs-Or-Features.ps1
Last active September 28, 2022 12:09
PowerShell commandline Uninstall-Programs-Or-Features.ps1
<#
.SYNOPSIS
Uninstall one or more Windows Program or Feature, by name or regular expression.
.DESCRIPTION
Lists Programs And Features installed on the current machine which match
the -matchingName parameter and then, after force or confirmation, uninstalls them.
Examples
@Susensio
Susensio / numpy_lru_cache.md
Last active October 26, 2023 16:10
Make function of numpy array cacheable

How to cache slow functions with numpy.array as function parameter on Python

TL;DR

from numpy_lru_cache_decorator import np_cache

@np_cache()
def function(array):
 ...
@khardix
khardix / download.py
Created October 6, 2017 11:26
Python AsyncIO/aiohttp downloader with progressbars
#!/usr/bin/env python3.6
import asyncio
from contextlib import closing
import aiohttp
import tqdm
async def download(session, url, progress_queue):
@max-mapper
max-mapper / bibtex.png
Last active March 10, 2024 21:53
How to make a scientific looking PDF from markdown (with bibliography)
bibtex.png