Kevin Mok
6 years ago
9 changed files with 107 additions and 20 deletions
-
18aliases/key_aliases
-
1fish/.config/fish/config.fish
-
9fish/.config/fish/functions/gdb-a2.fish
-
11i3/.config/i3/config
-
3ranger/.config/ranger/rc.conf
-
63scripts/shuffler
-
1txt/key_files.txt
-
17vim/.vimrc
-
4x/.Xresources
@ -1,10 +1,15 @@ |
|||||
function gdb-a2 |
function gdb-a2 |
||||
gdb -ex "b safeStopSign.c:40" -ex "b safeStopSign.c:44" -ex "run" \ |
|
||||
|
# gdb -ex "b safeStopSign.c:96" -ex "run" \ |
||||
|
# gdb -ex "b safeTrafficLight.c:98" -ex "run" \ |
||||
|
gdb -ex "run" -ex "bt" \ |
||||
# gdb -ex "run" \ |
# gdb -ex "run" \ |
||||
# -ex "p cur_lane_queue.count" \ |
# -ex "p cur_lane_queue.count" \ |
||||
# -ex "p cur_front->car->index" \ |
# -ex "p cur_front->car->index" \ |
||||
# -ex "p cur_front->car" \ |
# -ex "p cur_front->car" \ |
||||
--args ./carsim stop 1 4 |
|
||||
|
# -ex "p cur_front" \ |
||||
|
# --args ./carsim stop 1 4 |
||||
|
# --args ./carsim stop 3 20 |
||||
# --args ./carsim light 1 4 |
# --args ./carsim light 1 4 |
||||
|
--args ./carsim light 1 20 |
||||
# gdb -ex "b safeStopSign.c:86" -ex "run" --args ./carsim stop 1 10 |
# gdb -ex "b safeStopSign.c:86" -ex "run" --args ./carsim stop 1 10 |
||||
end |
end |
@ -0,0 +1,63 @@ |
|||||
|
#!/bin/bash |
||||
|
|
||||
|
# vars {{{ # |
||||
|
|
||||
|
shuffle_cache="shuffle.txt" |
||||
|
regen_flag=0 |
||||
|
dir="" |
||||
|
|
||||
|
# }}} vars # |
||||
|
|
||||
|
# usage_msg {{{ # |
||||
|
|
||||
|
function usage_msg() { |
||||
|
# echo "usage: shuffler [-r] [dir_name]" |
||||
|
cat <<-EOF |
||||
|
Usage: shuffler [-r] [dir_name] |
||||
|
-r: regenerate the shuffle cache |
||||
|
EOF |
||||
|
} |
||||
|
|
||||
|
# }}} usage_msg # |
||||
|
|
||||
|
# parse for regen_flag{{{ |
||||
|
while getopts ":r" opt; do |
||||
|
case $opt in |
||||
|
r) |
||||
|
echo "-r was triggered!" >&2 |
||||
|
regen_flag=1 |
||||
|
;; |
||||
|
\?) |
||||
|
echo "Invalid flag: -$OPTARG" >&2 |
||||
|
usage_msg |
||||
|
exit 1 |
||||
|
;; |
||||
|
esac |
||||
|
done |
||||
|
#}}} |
||||
|
|
||||
|
# set dir {{{ # |
||||
|
|
||||
|
shift $((OPTIND-1)) |
||||
|
# if no dir, use pwd |
||||
|
if [[ "$#" -eq 0 ]]; then |
||||
|
dir=$(pwd) |
||||
|
elif [[ "$#" -gt 1 ]] || [[ ! -d "$1" ]]; then |
||||
|
usage_msg |
||||
|
exit 1 |
||||
|
else |
||||
|
dir="$1" |
||||
|
fi |
||||
|
|
||||
|
# }}} set dir # |
||||
|
|
||||
|
# rebuild shuffle cache if regen_flag, doesn't exist or file empty |
||||
|
if [[ "$regen_flag" -eq 1 ]] || [[ ! -f "$dir"/"$shuffle_cache" ]] || \ |
||||
|
[[ $(wc -l "$dir"/"$shuffle_cache" | awk '{print $1}') -eq 0 ]]; then |
||||
|
# if [[ "$regen_flag" -eq 1 ]]; then |
||||
|
find "$dir"/* ! -name "$shuffle_cache" -type f | shuf > "$dir"/"$shuffle_cache" |
||||
|
fi |
||||
|
head -n 1 "$dir"/"$shuffle_cache" |
||||
|
printf '%s\n\n' "$(sed '1d' "$dir"/"$shuffle_cache")" > "$dir"/"$shuffle_cache" |
||||
|
|
||||
|
# vim: set tabstop=2 shiftwidth=2 expandtab: |
Write
Preview
Loading…
Cancel
Save
Reference in new issue