Skip to content

Instantly share code, notes, and snippets.

View magland's full-sized avatar

Jeremy Magland magland

View GitHub Profile
#!/usr/bin/env python
# h5_to_zarr_for_nwb.py
# pre-COSYNE Brainhack, Lisbon
# 02-28-2024
# Jeremy Magland and Ben Dichter
# License: Apache-2.0
#
# Usage example:
# python h5_to_zarr_for_nwb.py sub-anm00239123_ses-20170627T093549_ecephys+ogen.nwb example.zarr
// Create an audio context
const audioContext = new (window.AudioContext || window.webkitAudioContext)();
function playClick(frequency, duration) {
console.log('--- playing click')
// Create an oscillator node to generate the sound wave
const oscillator = audioContext.createOscillator();
oscillator.type = 'sine'; // Use sine wave for a smooth click sound
oscillator.frequency.setValueAtTime(frequency, audioContext.currentTime); // Set the frequency

Cross-Origin Resource Sharing (CORS)

Cross-Origin Resource Sharing (CORS) is a mechanism that allows a web page to access resources from a domain other than the one that the page is hosted on. This is important because, by default, web browsers block requests to load resources from other domains for security reasons. However, with CORS, a web page can explicitly allow certain domains to access its resources, enabling cross-domain communication. This can be useful in situations where you want to share data or functionality between different websites.


This document was created with the help of AI

What is ReCAPTCHA?

ReCAPTCHA is a service offered by Google that uses advanced risk analysis techniques to protect websites from spam and other types of automated abuse. It can be used to prevent bots from accessing certain parts of a website, such as a login page or a page with sensitive information. Traditionally, when a user visits a website that uses ReCAPTCHA, they are prompted to complete a challenge to prove that they are a human and not a bot. In the more recent version of the protocol, the user doesn't need to complete any tasks because the system automatically determine, based on interactions with the site, whether the user is human.

Examples of interactions and activities that ReCAPTCHA v3 monitors include mouse movements, time spent on a website, click patterns, and other user behaviors.


This page was created with help from AI

Setting environment variables in the .bashrc file.

Setting environment variables in the .bashrc file allows you to define variables that are accessible to the shell and its subprocesses. This can be useful for storing information such as the location of your project directories, the default editor you want to use, or the default version of a programming language you want to use.

To set an environment variable in the .bashrc file, you can use the export keyword followed by the name of the variable and its value. For example, to set a variable called PROJECT_HOME that holds the path to your project directories, you could add the following line to your .bashrc file:

export PROJECT_HOME="/path/to/my/project/dir"

Serverless functions, also known as "serverless computing" or "function as a service (FaaS)," are cloud-based computing services that enable developers to execute code without the need to manage and maintain their own server infrastructure. This means that developers can focus on writing and deploying their code, while the cloud provider takes care of the underlying infrastructure, scaling, and provisioning.

Serverless functions are typically triggered by events, such as a request to an API. These functions are executed on-demand, only when they are needed, and are automatically scaled to handle the workload. This means that users only pay for the computing resources that they use, rather than having to pay for a pre-allocated amount of resources.


This page was created with help from AI

Content-addressable storage

Content-addressable storage (CAS) is a type of data storage system that uses unique identifiers called "hashes" to retrieve and manage data. In a CAS system, each piece of data is assigned a unique hash value based on its content. This hash value is used as the data's address, allowing for quick and easy retrieval of the data when needed.

CAS systems typically use algorithms such as SHA-1 or MD5 to generate these unique hashes. These algorithms ensure that each hash is unique, even if two pieces of data have the same content. This means that data can be easily identified and retrieved based on its content, rather than its location within the storage system.

CAS systems are often used in distributed systems where data is stored across multiple locations. Because the data's hash value is used as its address, it can be easily retrieved from any location within the system. This makes CAS systems highly efficient and scalable, allowing for large amounts of data to be quickly and ea

Conda environments

A conda environment is a separate and isolated working space that allows you to have different versions of Python or other packages installed on your system without affecting the other environments. You can use conda environments to easily switch between different projects that have different package requirements.

To create a new conda environment with Python, you can use the following command:

conda create --name my_env python=3.9
{"layout":{"direction":"horizontal","itemProperties":[{}],"items":[{"type":"View","viewId":"14a6c42a8926"}],"type":"Box"},"type":"SortingLayout","views":[{"dataUri":"sha1://5fb192cc26c5a8d6bbbc98492a3deee974aba51a","type":"Autocorrelograms","viewId":"14a6c42a8926"}]}
import numpy as np
import kachery_cloud as kcl
import spikeinterface as si
import matplotlib.pyplot as plt
from figurl_tiled_image import TiledImage
import pyvips
uri = 'ipfs://bafybeihqetpnwdiiujilgr4psqhjbriitaf2gk4ili3fjioonhfquj23ce?label=continuous_1min.dat?label=hackathon_example_data_allen/Neuropix-PXI-100_ProbeA-AP/continuous_1min.dat'
fname = kcl.load_file(uri)