Skip to content

Instantly share code, notes, and snippets.

View rcassani's full-sized avatar
🦫

Raymundo Cassani rcassani

🦫
View GitHub Profile
@rcassani
rcassani / moinmoin_FB_button.txt
Last active September 22, 2023 16:31
Div on top of FB button
<div onclick="location.href='https://www.facebook.com/BrainstormSoftware';" style="position: relative; float: right; clear: right; margin-top: 5px; margin-right:-3px; cursor: pointer;">
<div class="fb-like" data-href="http://www.facebook.com/BrainstormSoftware" data-layout="button_count" data-action="like" data-show-faces="true" data-share="false">
</div>
<div style="position: absolute; top:0; left:0;width: 100%;height: 100%;">
<p>&nbsp;</p>
</div>
</div>
/* For MoinMoin, write in one line as: <<HTML(ONE_LINE_HERE)>> */
@rcassani
rcassani / process_something_raw_file.m
Created July 13, 2023 16:03
Brainstorm process: Process a raw file, create new raw file and add it to database
function varargout = process_something_raw_file( varargin )
% PROCESS_SOMETHING_RAW_FILE: Do something on a raw file, create new raw file, add it to BST database.
%
% @=============================================================================
% This software is part of the Brainstorm software:
% http://neuroimage.usc.edu/brainstorm
%
% Copyright (c)2000-2023 Brainstorm by the University of Southern California
% This software is distributed under the terms of the GNU General Public License
% as published by the Free Software Foundation. Further details on the GPL
@rcassani
rcassani / test_cmc.m
Created May 26, 2023 20:10
Connectivity tests with CMC tutorial data
% Script to run connectivity (magnitude square coherence) on data from the
% Corticomuscular coherence tutorial:
% https://neuroimage.usc.edu/brainstorm/Tutorials/CorticomuscularCoherence
%
% This is done in order to verify the difference approaches for PCA
% provided in the ScoutPca branch (by Marc)
%% Parameters
% Brainstorm version and Protocol
ProtocolName = 'TutorialCMC';
@rcassani
rcassani / dummy_fs_wfile.m
Created May 16, 2023 14:46
Create dummy (empty) FreeSurfer weight (`.w`) file
% Write empty FreeSurfer wfile
fileFullPath = '~/Desktop/dummy_rh.w';
% Create binary big-endian file
fid = fopen(fileFullPath, 'wb', 'b');
% Int16 for Latency
fwrite(fid, 0, 'int16');
% Count of vertex-value pairs to follow (3-bytes)
fwrite(fid, [0, 0, 0], 'uchar') ;
% Close file
fclose(fid);
@rcassani
rcassani / diff.less
Created December 19, 2022 20:51
`diff.less` file for language-diff Atom package. Place it at `~.atom/packages/language-diff/styles`
@import "syntax-variables";
atom-text-editor {
.syntax--diff {
&.syntax--inserted &.syntax--inserted.syntax--punctuation {
color: @syntax-color-added;
}
&.syntax--changed {
color: @syntax-color-modified;
}
@rcassani
rcassani / inheritance_python.py
Created December 14, 2022 19:14
Inheritance in Python
class Greeter(object):
def __init__(self):
print("Hi")
class PersonGreeter(Greeter):
def __init__(self, name):
super(PersonGreeter, self).__init__()
print(name)
```
@rcassani
rcassani / getLastCommit.sh
Last active February 1, 2023 20:14
Get last commit in GitHub repo
# 1. Get all info
curl -s "https://api.github.com/repos/brainstorm-tools/brainstorm3/commits?per_page=1&sha=master"
# Parse sha
curl -s "https://api.github.com/repos/brainstorm-tools/brainstorm3/commits?per_page=1&sha=master" | grep -oP '(?<=^\s\s\s\s"sha":\s").*(?=")'
# 2. Get only sha
curl -s -H "Accept: application/vnd.github.sha" "https://api.github.com/repos/brainstorm-tools/brainstorm3/commits/master"
@rcassani
rcassani / random_colors.py
Created July 2, 2022 18:26
Picking random colors in RGB space and outer rim of top of the HSV cone
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Random colors for RGB LEDs
Random RGB (R=U[0,1), G=U[0,1), B=U[0,1)) can lead to dark and light colors
which may not be goal when picking a random color for a RGB LED
This shows how to pick a color in the HSV space (H=U[0,1), S=U[0.8,1), V=1])
and convert it to RGB. Note that the Saturation is sampled such that colors
@rcassani
rcassani / post-checkout
Last active February 13, 2023 14:15
post-checkout Git hook for switching branches
#!/bin/bash
set -e # Stop execution of script if a command or pipeline has an error
printf '\nExample post-checkout hook\n'
# These are the parameters given to the hook
# https://git-scm.com/docs/githooks.html#_post_checkout
oldHEAD=$1 # ref of the previous (old) HEAD
newHEAD=$2 # ref of the new HEAD
checkoutType=$3 # checkout type flag: 1 = changing branches,
@rcassani
rcassani / mutability_test.py
Created August 17, 2021 14:28
Python mutability numpy array demo
import numpy as np
# How NOT to do it!!!
x = np.zeros([2,2]) # NumPy array, is mutable
print(id(x)) # ID for x
a = x # a is not a copy of x, it is the same variable in memory
print(id(a)) # ID of a == ID of x
x[0,0] = 1 # Updating values in x
b = x # b is not a copy of x, it is the same variable in memory
print(id(a)) # ID of a == ID of x