Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jul 1, 2025. It is now read-only.

Commit 26fb4c5

Browse files
Add vim/nano compatibility
1 parent cebce79 commit 26fb4c5

File tree

1 file changed

+30
-39
lines changed

1 file changed

+30
-39
lines changed

‎scs‎

Lines changed: 30 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -11,36 +11,27 @@
1111
* Recursive to the whole directory tree.
1212
* Backup all files versions, keeping the flow by timestamp.
1313
* Does not alter the dev target working dir.
14-
* Exclude git hidden files. Works well on top of git.
15-
* Can inject some javascript into a browser console tab, at a file change.
16-
*
17-
* PARAMS:
18-
* -e --exec <command> Execute command (Use quotes if necessary)
19-
* -r --reload <program> Reload target program (F5)
20-
* -x --inject <js file> javascript injection in browser console
21-
* --purge Delete cache
22-
* All params can be declared multiple times
23-
*
24-
* Browse GLOBAL historic and restore files
25-
* Those are all changes made in the whole machine, by date, while the current program was running
26-
* -g --global
27-
*
28-
*
29-
* * Browse DIR historic and restore files
30-
* Those are all changes made in the current DIR, by date, while the current program was running
31-
* -b --browse
32-
*
33-
* Examples:
34-
* # Reload focused tabs of many browsers
35-
* -r firefox -r chromium
36-
* # Run commands
37-
* ./scs -r firefox -e "ls -ltrapR"
38-
* # Inject alert("xss") in the currently focused Firefox tab
39-
* -x script.js
40-
*
41-
* Can be used on top of any text editor CTR+Z + Fat fingers = lost code
14+
* Exclude git hidden files. Exclude vim and nano .swp files.
15+
*
16+
* PARAMS:
17+
* -e --exec <command> Execute command (Use quotes if necessary)
18+
* -r --reload <program> Reload target program (F5)
19+
* -x --inject <js file> javascript injection in browser console
20+
* --purge Delete cache
4221
*
43-
* */
22+
* Browse DIR historic and restore files
23+
* Those are all changes made in the current DIR, by date, while the current program was running
24+
* -b --browse
25+
*
26+
* Examples:
27+
* # Reload focused tabs of many browsers
28+
* -r firefox -r chromium
29+
* # Run commands
30+
* ./scs -r firefox -e "ls -ltrapR"
31+
* # Inject alert("xss") in the currently focused Firefox tab
32+
* -x script.js
33+
*/
34+
4435
$path = getcwd();
4536
/* Avoid pipe errors */
4637
stream_set_blocking(STDIN, 0);
@@ -177,8 +168,8 @@ if ($com1 === "history"){
177168
$rpath = $path . "/" . $rpath.$subpath;
178169
//var_dump("cp '$lastp2' '$rpath'");
179170
echo "033円[1m".$subpath."\e[0m".PHP_EOL;
180-
$ls1 = system("ls --time-style=full-iso -ltrapR -I '*.git' -I 'nohup.out' -I sum -I todif -I hold -I dif -I ttodif -I tttodif $lastp2 | egrep -v '\.$|\.\.|\.:|\.\/|total|^d'| sed '/^$/d' > $home/.scs/.lsbcopy1");
181-
$ls2 = system("ls --time-style=full-iso -ltrapR -I '*.git' -I 'nohup.out' -I sum -I todif -I hold -I dif -I ttodif -I tttodif $rpath | egrep -v '\.$|\.\.|\.:|\.\/|total|^d'| sed '/^$/d' > $home/.scs/.lsbcopy2");
171+
$ls1 = system("ls --time-style=full-iso -ltrapR -I '.git' -I '.*.swp' -I 'nohup.out' -I sum -I todif -I hold -I dif -I ttodif -I tttodif $lastp2 | egrep -v '\.$|\.\.|\.:|\.\/|total|^d'| sed '/^$/d' > $home/.scs/.lsbcopy1");
172+
$ls2 = system("ls --time-style=full-iso -ltrapR -I '.git' -I '.*.swp' -I 'nohup.out' -I sum -I todif -I hold -I dif -I ttodif -I tttodif $rpath | egrep -v '\.$|\.\.|\.:|\.\/|total|^d'| sed '/^$/d' > $home/.scs/.lsbcopy2");
182173
@system("dwdiff -cbmagenta:black -C 0 -L '$home/.scs/.lsbcopy1' '$home/.scs/.lsbcopy2'");
183174
if ($iview < "1"){
184175
$iview = "1"; echo "\n---End of history---\n";
@@ -232,7 +223,7 @@ function rdiff($me, $crc = ""){
232223
}
233224

234225
$dirWatch = $path;
235-
$dimd5 = system("ls -pl --time-style=full-iso -I '*.git' -I 'nohup.out' $path");
226+
$dimd5 = system("ls -pl --time-style=full-iso -I '.git' -I '.*.swp' -I 'nohup.out' $path");
236227
$dirmd5 = md5($dimd5);
237228
/* Keep the hashes in an array, to create an historic */
238229
array_push($history, $dirmd5);
@@ -242,10 +233,10 @@ if ($com1 === "rchange"){
242233
/* Necessary files and directory creation */
243234
exec("mkdir -p ~/.scs/$dirmd5 && cd ~/.scs/$dirmd5 ; touch dif sum todif ttodif ttodif hold history.json && touch ~/.scs/index && touch ~/.scs/index$crc");
244235
/* Save the directory md5 hash into a file */
245-
$dmd5 = system("ls --time-style=full-iso -ltrapR -I '*.git' -I 'nohup.out' -I sum -I todif -I hold -I dif -I ttodif -I tttodif | egrep -v '\.$|\.\.|\.:|\.\/|total|^d' | sed '/^$/d'");
236+
$dmd5 = system("ls --time-style=full-iso -ltrapR -I '.git' -I '.*.swp' -I 'nohup.out' -I sum -I todif -I hold -I dif -I ttodif -I tttodif | egrep -v '\.$|\.\.|\.:|\.\/|total|^d' | sed '/^$/d'");
246237
file_put_contents("$home/.scs/$dirmd5/sum",md5($dmd5));
247238
/* Save the recursive ls output into a file */
248-
system("ls --time-style=full-iso -ltrapR -I '*.git' -I 'nohup.out' -I sum -I todif -I hold -I dif -I ttodif -I tttodif | egrep -v '\.$|\.\.|\.:|\.\/|total|^d' | sed '/^$/d' > ~/.scs/$dirmd5/todif");
239+
system("ls --time-style=full-iso -ltrapR -I '.git' -I '.*.swp' -I 'nohup.out' -I sum -I todif -I hold -I dif -I ttodif -I tttodif | egrep -v '\.$|\.\.|\.:|\.\/|total|^d' | sed '/^$/d' > ~/.scs/$dirmd5/todif");
249240
@ob_end_clean();
250241
}
251242
@ob_start();
@@ -261,9 +252,9 @@ while(true){
261252
@ob_start();
262253
if ($com1 === "rchange"){
263254
/* Save recursive ls output md5 */
264-
system("ls --time-style=full-iso -ltrapR -I '*.git' -I 'nohup.out' -I sum -I todif -I hold -I dif -I ttodif -I tttodif | egrep -v '\.$|\.\.|\.:|\.\/|total|^d' | sed '/^$/d' | md5sum > ~/.scs/$dirmd5/hold");
255+
system("ls --time-style=full-iso -ltrapR -I '.git' -I '.*.swp' -I 'nohup.out' -I sum -I todif -I hold -I dif -I ttodif -I tttodif | egrep -v '\.$|\.\.|\.:|\.\/|total|^d' | sed '/^$/d' | md5sum > ~/.scs/$dirmd5/hold");
265256
/* Create new md5 from php */
266-
$newmd5 = md5(system("ls --time-style=full-iso -ltrapR -I '*.git' -I 'nohup.out' -I sum -I todif -I hold -I dif -I ttodif -I tttodif | egrep -v '\.$|\.\.|\.:|\.\/|total|^d' | sed '/^$/d'"));
257+
$newmd5 = md5(system("ls --time-style=full-iso -ltrapR -I '.git' -I '.*.swp' -I 'nohup.out' -I sum -I todif -I hold -I dif -I ttodif -I tttodif | egrep -v '\.$|\.\.|\.:|\.\/|total|^d' | sed '/^$/d'"));
267258
}
268259
@ob_end_clean();
269260
if ($com1 === "rchange"){
@@ -282,9 +273,9 @@ while(true){
282273
@ob_start();
283274
$shell = system("tput cols");
284275
if ($com1 === "rchange"){
285-
system("ls --time-style=full-iso -ltrapR -I '*.git' -I 'nohup.out' -I sum -I todif -I hold -I dif -I ttodif -I tttodif | egrep -v '\.$|\.\.|\.:|\.\/|total|^d' |sed '/^$/d' | md5sum > ~/.scs/$dirmd5/sum");
286-
system("ls --time-style=full-iso -ltrapR -I '*.git' -I 'nohup.out' -I sum -I todif -I hold -I dif -I ttodif -I tttodif | egrep -v '\.$|\.\.|\.:|\.\/|total|^d' | sed '/^$/d' | md5sum > ~/.scs/$dirmd5/hold");
287-
system("ls --time-style=full-iso -ltrapR -I '*.git' -I 'nohup.out' -I sum -I todif -I hold -I dif -I ttodif -I tttodif | egrep -v '\.$|\.\.|\.:|\.\/|total|^d' | sed '/^$/d' > ~/.scs/$dirmd5/dif");
276+
system("ls --time-style=full-iso -ltrapR -I '.git' -I '.*.swp' -I 'nohup.out' -I sum -I todif -I hold -I dif -I ttodif -I tttodif | egrep -v '\.$|\.\.|\.:|\.\/|total|^d' |sed '/^$/d' | md5sum > ~/.scs/$dirmd5/sum");
277+
system("ls --time-style=full-iso -ltrapR -I '.git' -I '.*.swp' -I 'nohup.out' -I sum -I todif -I hold -I dif -I ttodif -I tttodif | egrep -v '\.$|\.\.|\.:|\.\/|total|^d' | sed '/^$/d' | md5sum > ~/.scs/$dirmd5/hold");
278+
system("ls --time-style=full-iso -ltrapR -I '.git' -I '.*.swp' -I 'nohup.out' -I sum -I todif -I hold -I dif -I ttodif -I tttodif | egrep -v '\.$|\.\.|\.:|\.\/|total|^d' | sed '/^$/d' > ~/.scs/$dirmd5/dif");
288279
}
289280
array_push($history, md5(system("cat ~/.scs/$dirmd5/hold")));
290281
$lastdif = end($history);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /