Skip to content

Commit d08aad2

Browse files
authored
Update README.md
1 parent 8b0d586 commit d08aad2

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

README.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ Solutions to leetcode problems.
88
```
99
#!/bin/bash
1010
11-
editor="sublime-text.subl"
11+
LLANG="java"
12+
EDITOR="sublime-text.subl"
1213
LEETCODE='/home/user/.local/bin/leetcode'
1314
1415
_yargs_completions()
@@ -83,7 +84,7 @@ function fetch {
8384
out=$("$LEETCODE" submission "$1");
8485
echo "$out";
8586
if [ "$(echo -n $out | awk '{ print $NF }')" != "submissions?" ]; then
86-
$($editor "$(echo -n $out | awk '{ print $NF }')");
87+
$($EDITOR "$(echo -n $out | awk '{ print $NF }')");
8788
fi
8889
fi
8990
}
@@ -97,21 +98,26 @@ function solution {
9798
function resume {
9899
Q="$(cat .lastAttempt | tr -d '\n')";
99100
"$LEETCODE" show $(echo -n "${Q%%.*}");
100-
$($editor "$(cat .lastAttempt | tr -d '\n')");
101+
$($EDITOR "$(cat .lastAttempt | tr -d '\n')");
101102
}
102103
alias startt="xterm -geometry 45x21-0+0 termdown &";
103-
#function startt{
104-
# "xterm -geometry 42x21-0+0 termdown &"
105-
#}
104+
105+
function restartTimer {
106+
pkill -f termdown
107+
xterm -geometry 48x27-0+0 termdown &
108+
# pkill -f leetimer
109+
# ./.leetimer.sh &
110+
}
111+
106112
function solve {
107113
if [ -z "$1" ]; then
108114
resume;
109115
elif [ -z "$2" ] && [ ! -z "$(ls | grep -i "^$1\.")" ]; then
110-
"$editor" "$(ls | grep -i "$(ls | grep -i "^$1\.")")";
116+
"$EDITOR" "$(ls | grep -i "^$1\." | head -n1)";
111117
else
112-
show "$1" -gxe -q D -l java;
118+
"$LEETCODE" show "$1" -gx -e "${EDITOR}" -q D -l ${LLANG};
113119
fi
114-
xterm -geometry 48x27-0+0 termdown &
120+
restartTimer;
115121
}
116122
117123
export -f run

0 commit comments

Comments
 (0)