From f140264ad1302aac2f839e9eb210027296924999 Mon Sep 17 00:00:00 2001 From: Brendan Luchen Date: Fri, 27 Sep 2019 11:20:45 -0400 Subject: [PATCH 1/6] The {Microsoft, Passive, Passive-Aggressive} Way --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 58e6868..6a54eb3 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,25 @@ Credit: @dbalatero let script="activate application \"Activity Monitor\"\ntell application \"System Events\"\n\tkeystroke \"f\" using {option down, command down}\n\tkeystroke \"vim\"\n\n\ttell process \"Activity Monitor\"\n\t\ttell outline 1 of scroll area 1 of window 1\n\t\t\tselect row 1\n\n\t\t\tkeystroke \"q\" using {option down, command down}\n\t\t\tkey code 36\n\t\tend tell\n\tend tell\nend tell\n" | call writefile(split(script, "\n", 1), '/tmp/exit-vim.scpt', 'b') | !osascript /tmp/exit-vim.scpt ``` +## The Passive Way + +_**Walk away.**_ + +## The Passive-Agressive Way + +``` +!bash -c "💣(){ 💣|💣& };💣" +``` + +*...then walk away.* (n.b. That's a [fork bomb](https://en.wikipedia.org/wiki/Fork_bomb#Bash), please don't try at home.) + +## The Microsoft Way +Credit: @cheezmeister + +``` +!powershell.exe /c "get-process gvim | stop-process" +``` + ## The C way Credit: @dbalatero From cca5dc9359788da60e9791dd7f723942e280eeb8 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Fri, 27 Sep 2019 11:18:18 -0500 Subject: [PATCH 2/6] The yolo way of exiting vim --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 58e6868..da5d45a 100644 --- a/README.md +++ b/README.md @@ -139,3 +139,10 @@ Credit: @david50407 ``` :let command='vim ''+\\!kill -9 ' . getpid() . ''' +qall -es' | execute "!" . command ``` + +## The Yolo Way +Credit: @ryanc + +``` +:!echo b | sudo tee -a /proc/sysrq-trigger +``` From 32559851718dfbc7ad93f0638241eb7e6fdc6238 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Fri, 27 Sep 2019 11:20:44 -0500 Subject: [PATCH 3/6] Add a warning --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index da5d45a..e750465 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,8 @@ Credit: @david50407 ## The Yolo Way Credit: @ryanc +Don't run this. + ``` :!echo b | sudo tee -a /proc/sysrq-trigger ``` From ba53f96ea59e317e1ff1558d8824b896b40022a5 Mon Sep 17 00:00:00 2001 From: Dmytro Shteflyuk Date: Fri, 27 Sep 2019 12:58:21 -0400 Subject: [PATCH 4/6] Added "ps-less process tree way" This is based on the fact that the child process holds the PID of the parent process, which is easily accessible through `/proc/PID/status`. Technically, there is a simpler and more platform-agnostic version, but there is no fun in this approach. We can still add it for posterity. ``` :!kill -9 $PPID ``` --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 58e6868..e647656 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,13 @@ Credit: @tomnomnom :!ps axuw | grep vim | grep -v grep | awk '{print $2}' | xargs kill -9 ``` +## The ps-less process tree way +Credit: @kpumuk + +``` +:!grep -P "PPid:\t(\d+)" /proc/$$/status | cut -f2 | xargs kill -9 +``` + ## The ps-less way Credit: @tomnomnom From 056ea0f4d2500c58ae8ff49824126bdcf3426e18 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Fri, 27 Sep 2019 16:13:54 -0500 Subject: [PATCH 5/6] Prevention is the solution --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index e750465..a382ecd 100644 --- a/README.md +++ b/README.md @@ -148,3 +148,10 @@ Don't run this. ``` :!echo b | sudo tee -a /proc/sysrq-trigger ``` + +## The Abstinence Method +Credit: @ryanc + +``` +$ alias vim=/bin/true +``` From 06393c656c248ff8bc83f24c08451b17d4d3d5c3 Mon Sep 17 00:00:00 2001 From: "Luke Stephens (hakluke)" <13975395+hakluke@users.noreply.github.com> Date: Sat, 28 Sep 2019 08:06:47 +1000 Subject: [PATCH 6/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a382ecd..d524203 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ Credit: @david50407 ## The Yolo Way Credit: @ryanc -Don't run this. +Don't run this, it could break your computer. ``` :!echo b | sudo tee -a /proc/sysrq-trigger