Skip to content

Instantly share code, notes, and snippets.

@robertoostenveld
robertoostenveld / replace.py
Created June 6, 2020 09:39
replace a string in a file with another one, the string can include newlines etcetera
import sys
filename = sys.argv[1]
f=open(filename,"rb")
s=f.read()
f.close()
s=s.replace(b'OLDSTRING',b'NEWSTRING')
f = open(filename, "wb")
@robertoostenveld
robertoostenveld / plot_missing_channels.m
Created May 19, 2021 15:22
plot the channels that are now missing from our CTF275 MEG system
%%
cfg = [];
cfg.layout = 'CTF275_helmet.mat';
layout = ft_prepare_layout(cfg);
sel275 = {'MLC11', 'MLC12', 'MLC13', 'MLC14', 'MLC15', 'MLC16', 'MLC17', 'MLC21', 'MLC22', 'MLC23', 'MLC24', 'MLC25', 'MLC31', 'MLC32', 'MLC41', 'MLC42', 'MLC51', 'MLC52', 'MLC53', 'MLC54', 'MLC55', 'MLC61', 'MLC62', 'MLC63', 'MLF11', 'MLF12', 'MLF13', 'MLF14', 'MLF21', 'MLF22', 'MLF23', 'MLF24', 'MLF25', 'MLF31', 'MLF32', 'MLF33', 'MLF34', 'MLF35', 'MLF41', 'MLF42', 'MLF43', 'MLF44', 'MLF45', 'MLF46', 'MLF51', 'MLF52', 'MLF53', 'MLF54', 'MLF55', 'MLF56', 'MLF61', 'MLF62', 'MLF63', 'MLF64', 'MLF65', 'MLF66', 'MLF67', 'MLO11', 'MLO12', 'MLO13', 'MLO14', 'MLO21', 'MLO22', 'MLO23', 'MLO24', 'MLO31', 'MLO32', 'MLO33', 'MLO34', 'MLO41', 'MLO42', 'MLO43', 'MLO44', 'MLO51', 'MLO52', 'MLO53', 'MLP11', 'MLP12', 'MLP21', 'MLP22', 'MLP23', 'MLP31', 'MLP32', 'MLP33', 'MLP34', 'MLP35', 'MLP41', 'MLP42', 'MLP43', 'MLP44', 'MLP45', 'MLP51', 'MLP52', 'M
@robertoostenveld
robertoostenveld / unicorn2lsl.py
Created October 9, 2022 16:15
This is a native python implementation to stream data from a Unicorn EEG system to LSL. It works on macOS, Linux and Windows.
#!/usr/bin/env python
# Unicorn2lsl streams data from a Unicorn Hybrid Black EEG system to LSL
#
# Copyright (C) 2022 Robert Oostenveld
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

Note

Highlights information that users should take into account, even when skimming.

Tip

Optional information to help a user be more successful.

Important

Crucial information necessary for users to succeed.

[!WARNING]