92

Assembly (x86/x64, Linux, as), 22 21 19 bytes mov $0x58, %al # 2 bytes: b0 58 mov $0xfee1dead, %ebx # 5 bytes: bb ad de e1 fe mov $0x28121969, %ecx # 5 bytes: b9 69 19 12 28 mov $0x4321fedc, %edx # 5 bytes: ba dc fe 21 43 int $0x80 # 2 bytes: cd 80 Must be run as root. This is equivalent to pressing the power button and not a safe ...


86

8086 machine code, 32 31 28 26 bytes 00000000 b8 0f 00 cd 10 b8 02 10 ba 18 01 cd 10 b8 03 00 |................| 00000010 cd 33 4b b8 01 0c eb f3 3f 00 |.3K.....?.| 0000001a Assumes the presence of a VGA graphics card, and any Microsoft-compatible mouse driver. -2 bytes thanks to @berendi! How it works: | org 0x100 ...


50

PowerShell, 13 bytes Stop-Computer Pretty self-explanatory? Doesn't work on PowerShell core, so it won't work on PowerShell for Linux/MacOS (already tried it on TIO :-D ). Bonus Garbage Submission, 12 bytes gcm s*r|iex In my testing, this works on Windows 2003 with PowerShell 2.0. It won't work on most of the newer versions, and it may not work ...


45

Python 3,  32  31 bytes exit('GBoaodd'['G'<input()::2]) Try it online! How? Tests if input is 'Good' by comparing 'G'<input(). Uses the fact that in Python False==0 and True==1 to use the result as the start index of a slice of 'GBoaodd' using an undefined stop and a step of 2 with 'GBoaodd'[start:stop:step]. Prints to STDERR (saving a ...


40

HTML (JavaScript (ES6)), 129 126 117 bytes <input id=i onfocus=l=0,n=Date.now onkeypress=event.which-97-l?i.outerHTML='Fail':24<l?i.outerHTML=n()-t:t=l++?t:n()> Click in the input and start typing! Also, my typing sucks; I take about 5 seconds even with practice. Edit: Saved 2 bytes thanks to @HermanLauenstein by switching language. Saved ...


39

Batch, 10 bytes On windows, this would suffice shutdown/s This will set up a shutdown in one minute. Alternatively, as @flashbang points out: shutdown/p This shuts down the computer immediately.


35

x86 machine code, Lenovo Z510, DOS COM or Bootloader, 7 bytes BITS 16 mov ax, (1 << 13) | (7 << 10) mov dx, 1804h out dx, ax Assembled into B8 00 3C BA 04 18 EF I'm exploiting "You are allowed to write code that only works in a specific environment/OS, if you wish" to the ultimate level: this will only work on Lenovo Z5101. This writes ...


34

GRUB shell, 4 bytes Golfed halt Command: halt --no-apm The command halts the computer. If the --no-apm option is specified, no APM BIOS call is performed. Otherwise, the computer is shut down using APM. Bonus Here is a proof that GRUB shell is indeed Turning-complete (see comments):


33

Mathematica, 10 bytes Checkbox[] Assumes Mathematica's notebook environment. The two states look like this:


33

6502 machine code (C64 PAL), 189 165 bytes 00 C0 A9 17 8D 18 D0 A9 40 85 FE E6 FE 20 E4 FF F0 FB 20 D2 FF C5 FE 38 D0 38 C9 5A 18 F0 33 C9 41 D0 E8 A9 00 85 FC 85 FD A9 18 85 FB A9 7F 8D 0D DD A9 7F 8D 18 03 A9 C0 8D 19 03 A9 D8 8D 04 DD A9 03 8D 05 DD A9 01 8D 0E DD A9 81 8D 0D DD D0 B9 A9 7F 8D 0D DD A9 47 8D 18 03 A9 FE AD 19 03 CE 0E DD B0 14 A9 0D 20 ...


32

65C02 machine code, 1 byte STP instruction (0xDB): STP stops the clock input of the 65C02, effectively shutting down the 65C02 until a hardware reset occurs (i.e. the RES pin goes low). This puts the 65C02 into a low power state. This is useful for applications (circuits) that require low power consumption, but STP is rarely seen otherwise. (Source: http:/...


31

HTML, 20 bytes Don't know how valid this will be as an answer. HTML requires the tag to be closed to legally validate, but modern browsers will automatically close them so it's executable. <input type=checkbox


27

Bash, 67 55 50 35 32 31 bytes :()(read -p$[i^=1] ›?9h -sn6 :) The code contains a CR byte (first newline) and a CSI byte (small right angle bracket with the Windows-1252 encoding). It requires xterm (or equivalent) and the ISO-8859-1 encoding (or similar). The code defines a function named :, which alternately displays a white 1 or 0 in a black ...


25

Matlab, 21 Bytes system('shutdown -s') I haven't tried this (closing all programs to do a restart in the middle of the day isn't really tempting), but it should work.. This works... I'll add a short explanation later, my laptop is currently off.


25

Scratch, 10 Scratch bytes Scratch was practically designed for things like this. Try it online!


22

Processing, 78 66 65 63 61 bytes 2 bytes saved thanks to @TuukkaX by using -a%2 instead of a%2*-1 2 bytes saved thanks to @TuukkaX by using a=-a int a=1;void draw(){background(a);}void mousePressed(){a=-a;} The checkbox alternates between being black and white. Explanation int a=1; //the variable that contains the state of the ...


22

HTML + JavaScript, 32 30 25 chars <p onclick=innerHTML^=1>0


21

MATLAB, 11 bytes !shutdown/p Somewhat similar to Stewie Griffin's approach. However, MATLAB has way shorter ways of invoking system commands; in this case, ! is used. Windows does not need .exe for command names, so that's left out as well. The / option is still supported (I'm running Windows 10), and negates the need for the space. Alternatives are: ...


20

Unix Shell (+x11-apps), 3 bytes Disclaimer The answer below is boring, borderline and "feels cheating" (at least to me). Yet, it does not seem to violate any of the challenge rules "as written", or "default loopholes", so I'm posting it. (If you can point a specific rule it breaks, please comment on !) Golfed xgc The xgc program demonstrates ...


20

GitHub Flavored Markdown - 6 bytes - [ ] (There is a trailing space) In a gist :


20

HTML + JavaScript (ES6), 66 64 62 bytes HTML <canvas id=c> JavaScript onclick=e=>c.getContext`2d`.fillRect(e.x,e.y,1,1) Saved 2 bytes thanks to Gustavo Rodrigues and 2 bytes from Shaggy. onclick=e=>c.getContext`2d`.fillRect(e.x,e.y,1,1) /* This css isn't needed for the program to work. */ *{margin: 0} #c{border:1px solid black} <...


19

SmileBASIC, 14 11 6 bytes OPTION Triggers a crash causing the 3DS to restart. I hope this counts. Works in the most recent version.


18

AHK, 25 bytes Gui,Add,Checkbox Gui,Show Output -


18

JavaScript (ES6) + HTML, 114 + 16 = 130 bytes Saved 16 bytes thanks to @Shaggy a=Array(96).fill` `;onkeypress=k=>(a[k.key.charCodeAt()-32]=k.key,O.innerText=a.join` `.match(/.{1,32}/g).join` `) <pre id=O></pre> It's so unbelievably satisfying to just mash the keyboard...


17

C + Win32, 209 200 195 bytes Thanks, Cody and Quentin! I was hoping to get rid of the #include <windows.h> but this leads to all sort of errors. At least it is working correctly with multiple monitors... #include<windows.h> struct{int h,m,w,x:16,y:16;}m;h;main(){for(h=CreateWindow("EDIT","",1<<28,0,0,199,199,0,0,0,0);GetMessage(&m,h,...


16

Bash, 7 6 bytes init 0 Assuming that the program is run as root.


16

Scratch, 2 blocks Put this script in the default sprite (which comes with 2 costumes)


15

QBasic 4.5, 81 85 bytes Added 4 bytes to comply with the spacing-rule. DO LOCATE 7,1 LINE INPUT A$:i=ASC(A$) LOCATE i\16-1,(i MOD 16+1)*2 ?CHR$(i) LOOP And the output will look like this (NOTE: Old screenshot, now every character is separated by a space): QBasic has the LOCATE command, which comes in handy here. A breakdown of this code: DO ...


14

Python REPL, 45 bytes from tkinter import* Checkbutton(Tk()).pack()


14

GeoGebra, 10 bytes Checkbox[] Entered into the input bar. Here is a gif of the execution:


Only top voted, non community-wiki answers of a minimum length are eligible