Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save KnightsWhoSayNi0/a89d104d481cd3670462fcecee68731b to your computer and use it in GitHub Desktop.
Save KnightsWhoSayNi0/a89d104d481cd3670462fcecee68731b to your computer and use it in GitHub Desktop.
Different Ways You Shouldn’t use Your Computer, Going for every Lang

Ways To Not Use Your Unix Machine

(You probably shouldn't do this)

rm Remove Command

All commands delete the Root in different ways

  • The Classic
rm -rf / --no-preserve-root
  • All files except root
rm -rf /*
  • Something more Elaborate
cd / && find /* | xarg rm -rf

"If you're gonna delete your filesystem, at least lay pipes and arguments like a Linux chad."


dd Disk Destroyer Command

  • The Classic
  • NOTE: root may not be your root, check your Operating System's root.
dd if=/dev/null of=/root
  • Overriding Ram
  • NOTE: /dev/mem does not exist on most Kernel configurations.
dd if=/dev/urandom of=/dev/mem
  • Writing Random Files to your disk
  • NOTE: /dev/sda may not be your disk, it can be hdX, sdX, or nvme0nX
dd if=/dev/random of=/dev/sda
  • Cleaning all Partitions on a Disk
dd if=/dev/zero of=/dev/sda  bs=512  count=1

Some More Elaborate Ways

  • Fork Bombing
:(){ :|: & };:
How This Works

:() means you are defining a function called {:|: &} means run the function : and send its output to the : function again and run that in the background. : – load another copy of the ‘:’ function into memory | – and pipe its output to : – another copy of ‘:’ function, which has to be loaded into memory Therefore, ‘:|:’ simply gets two copies of ‘:’ loaded whenever ‘:’ is called & – disown the functions, if the first ‘:’ is killed, all of the functions that it has started should NOT be auto-killed } – end of what to do when we say ‘:’ ; Command Seperator : runs the function first time

  • Destroying your Home File System
mv ~ /dev/null

This moves your home directory to the null directory, where it is disposed of.

  • shred, Might Take a While
shred -n 5 -vz /dev/sda

Shred is a GNU command which deletes the contents of your disk in 7 rounds, so that it can't be recovered.

  • If an Arch user is getting a little annoying, run this on their computer
sudo pacman -Rcs systemd
  • For Grub Users
rm -r /boot/grub/grub.cfg

Removes the Grub config file, this prevents you from booting into Linux

  • Reformatting your Drive
mkfs.ext4 /dev/sda 

Formats and deletes the data on your disks parition.

  • Black Hole?
mv / /dev/null

Moves your root directory to null were it is disposed of.

  • Delete your Super User
rm -f /usr/bin/sudo ; rm -f /bin/su

Removing your super user, prevents you from doing super user tasks.


How Not To Program

X86 Flat Assembler/FASM for Linux

format ELF executable
entry start
start:

Assembly Language

section .text
global _start

_start:
mov rbx,57

func:
mov rax,rbx            
syscall                	; Invoke the system call
jmp short func		; Calling the system call 

Proof of concept, I'm not sure if this would work yet.

Bash

#!/bin/bash

func() { 
     func | func
     & 
}; func

This is the equivalent of :(){ :|: & };:

C/C++ for Unix

#include <unistd.h>
 
int main(void) {
    for(;;)
    fork();
    return 0;
}

Go

package main

func main() {
     for {
          go main()
     }
}

Haskell

import Control.Concurrent

f = do a <- forkIO g
       b <- forkIO g
       return ()

g = do a <- forkIO f
       b <- forkIO f
       return ()

Java

public class Main { 

    public static void Main(String[] args) {
        while (true) {
            Runtime.getRuntime().exec(new String[]{"javaw", "-cp", System.getProperty("java.class.path"), "Main"});
        }
    }
}
  • If you came to Java for the coffee beans, you can roast them with this method.
import java.lang.Thread;

public class Heater { 

    public static void Main(String[] args) {
        for (int i = 0; i < 22; i++) {
            new Thread(() -> {
                while (true);
            }).start();
        }
    }
}

Python

import os

while 1:
     os.fork()

PHP (Poor Helpless Programmers)

while(pcntl_fork()|1);

R (shit language btw)

# R CPU Heater
i <- 1
while (true) {
  i <- i + 1
  print(i)
}

Kotlin (horrible fucking language I hate it so much but I couldn't think of anything else)

// kotlin CPU heater
fun main() {
  var i = 0
  while (true) {
    println(i)
    i++
  }
}

The Killer Poke (Commodore PET 2001)

POKE 59458,62

Honorable Mention

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment