Skip to content

Instantly share code, notes, and snippets.

@FlorianFranzen
Created November 2, 2015 09:40
Show Gist options
  • Save FlorianFranzen/b41ee34284c201d586dd to your computer and use it in GitHub Desktop.
Save FlorianFranzen/b41ee34284c201d586dd to your computer and use it in GitHub Desktop.
diff -ur scripts/duration scripts/duration
--- scripts/duration 2012-03-19 19:08:42.000000000 +0100
+++ scripts/duration 2012-12-19 15:30:29.000000000 +0100
@@ -14,24 +14,24 @@
#//
#////////////////////////////////////////////////////////////////////////////
-BLACK="\e[1;30m"
-DARK_GREY="\e[1;30m"
-BLUE="\e[1;34m"
-LIGHT_BLUE="\e[1;34m"
-GREEN="\e[0;32m"
-LIGHT_GREEN="\e[1;32m"
-CYAN="\e[1;36m"
-LIGHT_CYAN="\e[1;36m"
-RED="\e[1;31m"
-LIGHT_RED="\e[1;31m"
-PURPLE="\e[0;35m"
-LIGHT_PURPLE="\e[1;35m"
-BROWN="\e[0;33m"
-YELLOW="\e[1;33m"
-LIGHT_GREY="\e[1;37m"
-WHITE="\e[1;37m"
-BOLD_BLACK="\e[1m"
-PLAIN="\e[0m"
+BLACK="\x1B[1;30m"
+DARK_GREY="\x1B[1;30m"
+BLUE="\x1B[1;34m"
+LIGHT_BLUE="\x1B[1;34m"
+GREEN="\x1B[0;32m"
+LIGHT_GREEN="\x1B[1;32m"
+CYAN="\x1B[1;36m"
+LIGHT_CYAN="\x1B[1;36m"
+RED="\x1B[1;31m"
+LIGHT_RED="\x1B[1;31m"
+PURPLE="\x1B[0;35m"
+LIGHT_PURPLE="\x1B[1;35m"
+BROWN="\x1B[0;33m"
+YELLOW="\x1B[1;33m"
+LIGHT_GREY="\x1B[1;37m"
+WHITE="\x1B[1;37m"
+BOLD_BLACK="\x1B[1m"
+PLAIN="\x1B[0m"
#////////////////////////////////////////////////////////////////////////////
#// Compute and print duration
diff -ur scripts/ndm_functions scripts/ndm_functions
--- scripts/ndm_functions 2011-12-06 17:20:31.000000000 +0100
+++ scripts/ndm_functions 2012-12-19 15:30:29.000000000 +0100
@@ -52,24 +52,24 @@
INPUTS_MISSING=11
VAR_MISSING=20
-BLACK="\e[1;30m"
-DARK_GREY="\e[1;30m"
-BLUE="\e[1;34m"
-LIGHT_BLUE="\e[1;34m"
-GREEN="\e[1;32m"
-LIGHT_GREEN="\e[1;32m"
-CYAN="\e[1;36m"
-LIGHT_CYAN="\e[1;36m"
-RED="\e[1;31m"
-LIGHT_RED="\e[1;31m"
-PURPLE="\e[1;35m"
-LIGHT_PURPLE="\e[1;35m"
-BROWN="\e[0;33m"
-YELLOW="\e[1;33m"
-LIGHT_GREY="\e[1;37m"
-WHITE="\e[1;37m"
-BOLD_BLACK="\e[1m"
-PLAIN="\e[0m"
+BLACK="\x1B[1;30m"
+DARK_GREY="\x1B[1;30m"
+BLUE="\x1B[1;34m"
+LIGHT_BLUE="\x1B[1;34m"
+GREEN="\x1B[1;32m"
+LIGHT_GREEN="\x1B[1;32m"
+CYAN="\x1B[1;36m"
+LIGHT_CYAN="\x1B[1;36m"
+RED="\x1B[1;31m"
+LIGHT_RED="\x1B[1;31m"
+PURPLE="\x1B[1;35m"
+LIGHT_PURPLE="\x1B[1;35m"
+BROWN="\x1B[0;33m"
+YELLOW="\x1B[1;33m"
+LIGHT_GREY="\x1B[1;37m"
+WHITE="\x1B[1;37m"
+BOLD_BLACK="\x1B[1m"
+PLAIN="\x1B[0m"
#////////////////////////////////////////////////////////////////////////////
#// Messages (erros, warnings, headers)
diff -ur scripts/duration scripts/duration
--- scripts/duration 2012-03-19 19:08:42.000000000 +0100
+++ scripts/duration 2012-12-19 14:47:28.000000000 +0100
@@ -137,7 +137,7 @@
# 5) start with one or more chars, then '.', then three chars, then one or more chars (for 'evt' etc.)
case5='/^.+\.[^.]{3}\.([^.-]*)+(-shifted)?$/'
- extension=$(basename $filename | sed -r -e "$case1 s//\1/;$case2 s//\1/;$case3 s//\1/;$case4 s//\1/;$case5 s//\1/")
+ extension=$(basename $filename | sed -E -e "$case1 s//\1/;$case2 s//\1/;$case3 s//\1/;$case4 s//\1/;$case5 s//\1/")
# Compute duration in ms
case $extension in
diff -ur scripts/ndm_functions scripts/ndm_functions
--- scripts/ndm_functions 2011-12-06 17:20:31.000000000 +0100
+++ scripts/ndm_functions 2012-12-19 14:47:28.000000000 +0100
@@ -78,7 +78,7 @@
# Print error message
echo_error()
{
- indent=$(echo "$1"|sed -r 's/^([ ]*).*/\1/')
+ indent=$(echo "$1"|sed -E 's/^([ ]*).*/\1/')
message=$(echo "$1"|sed 's/^ *//g')
echo -en "$RED" >&2
@@ -89,7 +89,7 @@
# Print warning message
echo_warning()
{
- indent=$(echo "$1"|sed -r 's/^([ ]*).*/\1/')
+ indent=$(echo "$1"|sed -E 's/^([ ]*).*/\1/')
message=$(echo "$1"|sed 's/^ *//g')
echo -en "$BLUE" >&2
@@ -111,7 +111,7 @@
# break
# fi
# done
-# indent=$(echo "$1"|sed -r 's/^([ ]*).*/\1/')
+# indent=$(echo "$1"|sed -E 's/^([ ]*).*/\1/')
# message=$(echo "$1"|sed 's/^ *//g')
#
echo $*
@@ -469,13 +469,13 @@
# Start with the 'easy' ones
date=$(filename_date $dirname)
[ -z "$date" ] && return
- prefix=$(echo $dirname|sed -r '/(.*)-'$date'.*/!d;s//\1/')
+ prefix=$(echo $dirname|sed -E '/(.*)-'$date'.*/!d;s//\1/')
# Deal with the 'hard' end of the filename
description=${dirname#$prefix-$date}
if [ -z "$suffix" ] && ! $no_suffix
then
- suffix=$(echo $description|sed -r '/.*-(.*)/!d;s//\1/')
+ suffix=$(echo $description|sed -E '/.*-(.*)/!d;s//\1/')
fi
description=${description%$suffix}
description=${description%-}
@@ -535,26 +535,26 @@
# Start with the 'easy' ones
date=$(filename_date $filename)
[ -z "$date" ] && return
- prefix=$(echo $filename|sed -r '/(.*)-'$date'.*/!d;s//\1/')
- nn=$(echo $filename|sed -r '/'$prefix'-'$date'-([0-9]{2})-.*/!d;s//\1/')
- extension=$(echo $filename|sed -r '/.*[.](.*)/!d;s//\1/')
+ prefix=$(echo $filename|sed -E '/(.*)-'$date'.*/!d;s//\1/')
+ nn=$(echo $filename|sed -E '/'$prefix'-'$date'-([0-9]{2})-.*/!d;s//\1/')
+ extension=$(echo $filename|sed -E '/.*[.](.*)/!d;s//\1/')
[ ! -z "$extension" ] && p_extension=.$extension
# Special case: evt files end in .ccc.evt where 'c' is any character
if [ "$extension" == "evt" ]
then
- evt=$(echo $filename|sed -r '/.*[.](.{3})[.]'$extension'/!d;s//\1/')
+ evt=$(echo $filename|sed -E '/.*[.](.{3})[.]'$extension'/!d;s//\1/')
[ ! -z "$evt" ] && p_evt=.$evt
fi
# Deal with the 'hard' end of the filename
- end=$(echo $filename|sed -r '/'$prefix'-'$date'-'$nn'-(.*)'$p_evt$p_extension'/!d;s//\1/')
- NNN=$(echo $end|sed -r '/.*-([0-9]+).*/!d;s//\1/')
+ end=$(echo $filename|sed -E '/'$prefix'-'$date'-'$nn'-(.*)'$p_evt$p_extension'/!d;s//\1/')
+ NNN=$(echo $end|sed -E '/.*-([0-9]+).*/!d;s//\1/')
description=${end%-$NNN}
description=${description%$p_evt}
if [ -z "$suffix" ] && ! $no_suffix
then
- suffix=$(echo $description|sed -r '/.*-(.*)/!d;s//\1/')
+ suffix=$(echo $description|sed -E '/.*-(.*)/!d;s//\1/')
fi
description=${description%-$suffix}
@@ -585,9 +585,9 @@
local filename=$1
# Case 1: date is specified as YYYYMMDD in the file name
- d=$(echo $filename | sed -r '/.*([0-9]{8}).*/!d;s//\1/')
+ d=$(echo $filename | sed -E '/.*([0-9]{8}).*/!d;s//\1/')
# Case 2: date is specified as YYYY-MM-DD in the file name
- [ -z "$d" ] && d=$(echo $filename | sed -r '/.*([0-9]{4}-[0-9]{2}-[0-9]{2}).*/!d; s//\1/')
+ [ -z "$d" ] && d=$(echo $filename | sed -E '/.*([0-9]{4}-[0-9]{2}-[0-9]{2}).*/!d; s//\1/')
echo $d
}
@@ -601,9 +601,9 @@
local d
# Case 1: date is specified as YYYYMMDD in the file name
- d=$(echo $1 | sed -r '/.*([0-9]{4})([0-9]{2})([0-9]{2}).*/!d;s//\1-\2-\3/')
+ d=$(echo $1 | sed -E '/.*([0-9]{4})([0-9]{2})([0-9]{2}).*/!d;s//\1-\2-\3/')
# Case 2: date is specified as YYYY-MM-DD in the file name
- [ -z "$d" ] && d=$(echo $1 | sed -r '/.*([0-9]{4}-[0-9]{2}-[0-9]{2}).*/!d; s//\1/')
+ [ -z "$d" ] && d=$(echo $1 | sed -E '/.*([0-9]{4}-[0-9]{2}-[0-9]{2}).*/!d; s//\1/')
echo $d
}
@@ -705,7 +705,7 @@
for (( i=0;i<$n;i++ ))
do
suffix=$(get_suffix $i ${suffixes[*]})
- file_list="$file_list $(ls ../$directory-$suffix|cut -d/ -f 3|sed -r 's/(.*)-'$suffix'.*/\1/g')"
+ file_list="$file_list $(ls ../$directory-$suffix|cut -d/ -f 3|sed -E 's/(.*)-'$suffix'.*/\1/g')"
done
# List all sessions
diff -ur scripts/ndm_recolorchannels scripts/ndm_recolorchannels
--- scripts/ndm_recolorchannels 2010-04-15 11:29:14.000000000 +0200
+++ scripts/ndm_recolorchannels 2012-12-19 14:54:28.000000000 +0100
@@ -77,4 +77,4 @@
command='/'$s'/N;/'$s'/N;/'$s'/s/#....../#'${color[$i]}'/g;'$command
done
-[ ! -z "$command" ] && sed -i -e $command $file
+[ ! -z "$command" ] && sed -i '' -e $command $file
diff -ur scripts/ndm_start scripts/ndm_start
--- scripts/ndm_start 2012-09-26 17:11:02.000000000 +0200
+++ scripts/ndm_start 2012-12-19 14:54:28.000000000 +0100
@@ -267,7 +267,7 @@
then
echo_warning "directory name '$directory' does not seem to contain a date"
else
- sed -i 's/<date>.*<\/date>/<date>'$d'<\/date>/' $template.xml
+ sed -i '' 's/<date>.*<\/date>/<date>'$d'<\/date>/' $template.xml
fi
if [ -f $directory.xml ] && ! diff -I '<date>' -q $template.xml $directory.xml >/dev/null
then
diff -ur scripts/process_renameevents_SPWR scripts/process_renameevents_SPWR
--- scripts/process_renameevents_SPWR 2011-01-29 00:13:40.000000000 +0100
+++ scripts/process_renameevents_SPWR 2012-12-19 14:54:28.000000000 +0100
@@ -30,7 +30,7 @@
[ -z "$(ls $session*evt 2> /dev/null)" ] && exit $NO_ERROR
for eventfile in $session*evt
do
- sed -i \
+ sed -i '' \
-e 's/[[:space:]]0$/\tStimulation/' \
-e 's/[[:space:]]1$/\tRipple Left/' \
-e 's/[[:space:]]2$/\tRipple Right/' \
diff -ur scripts/process_renameevents_TMaze scripts/process_renameevents_TMaze
--- scripts/process_renameevents_TMaze 2011-01-29 00:13:27.000000000 +0100
+++ scripts/process_renameevents_TMaze 2012-12-19 14:54:28.000000000 +0100
@@ -27,7 +27,7 @@
[ -z "$(ls $session*evt 2> /dev/null)" ] && exit $NO_ERROR
for eventfile in $session*evt
do
- sed -i \
+ sed -i '' \
-e 's/[[:space:]]0$/\tTurn left/' \
-e 's/[[:space:]]1$/\tTurn right/' \
-e 's/[[:space:]]100$/\tTrial start/' \
--- src/process_extractspikes/process_extractspikes.cpp.orig 2012-08-17 20:36:21.000000000 +0200
+++ src/process_extractspikes/process_extractspikes.cpp 2012-08-17 20:37:31.000000000 +0200
@@ -1616,7 +1616,7 @@
char *groups, *currentGroup, *thresholds; // Groups of electrodes and thr
// extract thresholds from arguments
- groups = strdupa (arguments.thresList); // Split groups
+ groups = strdup (arguments.thresList); // Split groups
currentGroup = strsep (&groups, GROUP_SEPARATOR); // focus on the 1st group
while(currentGroup != NULL) {
@@ -1665,7 +1665,7 @@
char *groups, *currentGroup, *channels; // Groups of electrodes and channels
// extract channels from arguments
- groups = strdupa (arguments.channelList); // Split groups
+ groups = strdup (arguments.channelList); // Split groups
currentGroup = strsep (&groups, GROUP_SEPARATOR); // focus on the 1st group
while(currentGroup != NULL) {
--- src/process_medianthreshold/process_medianthreshold.cpp.orog 2012-08-17 20:39:55.000000000 +0200
+++ src/process_medianthreshold/process_medianthreshold.cpp 2012-08-17 20:40:06.000000000 +0200
@@ -193,7 +193,7 @@
} // for i
/** Computes threshold for each channel groups */
- groups = strdupa (arguments.channelList); // Split groups
+ groups = strdup (arguments.channelList); // Split groups
currentGroup = strsep (&groups, GROUP_SEPARATOR); // focus on the first group
while(currentGroup != NULL) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment