Okay, so. Over the years I've come across several corrupt drives. And in my experience, if it is at all possible to make them usable again, this method will do it for you:

  1. Open cmd as an administrator.
  2. Rundiskpart.
  3. Type in select disk.
  4. Then enter select disk <yourdisk>.
  5. Type in clean.
  6. Then enter select disk <yourdisk> again.
  7. Finally run the command create partition primary.
  8. Open Windows Explorer, right click on your drive, and format it.

That's it, you should be able to use your drive normally again!

Basics

The following command creates a simple HTTP server from CMD:

@echo off
:main
(type index.html) | nc -w 1 -l -p 80 
goto :main

Here index.html is the file that is displayed to whoever accesses the webpage. It can be viewed by typing localhost in the browser on the same computer or your computer's IP address on any other computer on the network.

The first two lines of index.html must be the following to ensure proper working:

HTTP/1.0 200 OK
Content-Type: text/html

This is the file which I use for testing:

HTTP/1.0 200 OK
Content-Type: text/html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii">
        <title>Hi!</title>
    </head>
<body>
    <h1>Hello World!</h1>
    <p>Congrats! Your server is working!</body>
</html>

Advanced

You can also get information via POST requests!

HTML Body:

<body>
    <h1>hello world</h1>
    <form method="post">
    send something: <input type="text" name="postText" />
    <input type="submit" value="Submit" />
    </form>
</body>

And on the backend:

(type files\index.html) | nc -w 1 -l -p 80 | findstr "postText"

However, this just displays the output. In order to fetch the input in a variable so that you can carry out further operations, try this:

(type files\index1.html) | nc -w 1 -l -p 80 | findstr "postText" > par.txt 
for /f "delims== tokens=1,2" %%G in (par.txt) do set %%G=%%H 
        echo User input: %postText%

There is a bug in this code though. Often browsers will send the information multiple times, and will also sometimes send empty requests. To get around this, we can use the following code:

set postPrev=rahul2001BLEH
(type files\index.html) | nc -w 1 -l -p 80 | findstr "postText" > par.txt 
for /f "delims== tokens=1,2" %%G in (par.txt) do set %%G=%%H 
if NOT %postText% == "" (
    if NOT %postText% == %postPrev% (
        echo User input: %postText%
        set postPrev=%postText%
    )
)

This will ignore empty requests and those identical to the previous ones.

Complete Code

server.cmd:

@echo off
set postPrev=rahul2001BLEH
:main
(type files\index.html) | nc -w 1 -l -p 80 | findstr "postText" > par.txt 
for /f "delims== tokens=1,2" %%G in (par.txt) do set %%G=%%H 
if NOT %postText% == "" (
    if NOT %postText% == %postPrev% (
        echo User input: %postText%
        set postPrev=%postText%
    )
)
goto :main

index.html:

HTTP/1.0 200 OK
Content-Type: text/html


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii">
        <title>hello</title>
    </head>
<body>
    <h1>hello world</h1>
    <form method="post">
    send something: <input type="text" name="postText" />
    <input type="submit" value="Submit" />
    </form>
</body>
</html>

Enjoy!

I have a script which runs remotely on a school PC, which is part of a renderfarm I build for my friend. I needed it to be able to upload the rendered file to my server. Here's how I managed to do this:

On my server I have a page with this simple form to upload the file:

<form action="" method="POST" enctype="multipart/form-data">
<input type="file" name="rfile" />
<input type="submit"/>
</form>

This following command send a file via a POST request:

curl --form rfile=@renderedfile.jpg --form press=submit http://example.com/upload.php

This script is platform-independent. Enjoy!

A collection of ported Unix Utilities for Windows

Hi! This repo contains several utilities which are massively useful, for sysadmins, programmers and students.

Go ahead and explore! All utilities are kept up-to-date.

Links: Rahul's Windows Executable Repository; README

Hey, Rahul! Do you know how to make an app?

This is a statement that I've heard countless times over the past few years, ever since I've gained popularity in school as a geek/programmer.

The next statement is usually "I have a brilliant idea for a startup, I just need you to implement it."

From juniors, to seniors to even teachers, everyone appears to have amazing ideas which have never been though of before and hold the capibility to earn millions of dollars. But that's not how this works. There's a reason why most stratups fail, and it's because they don't even have a good idea, let alone plan.

I've never had my own startup, but even I know that the first thing to do is to find a real-life problem, then solve it using technology. You cannot just come up with some shattering new idea on the spot, that rarely happens, if ever.

It's even more annoying when they're after me for months to help them out with an idea that I know is destined to fail. I don't like to kill your enthusiasm, but the next time that you see me, please think before calling me out, does your idea actually have the capability to make a difference?

RICKROLLED!!

Rickroll WiFi is an awesome script which rickrolls whoever is searching for a WiFi network by changing the SSID of a hotspot to the lyrics of Never Gonna Give You Up.

mac-screenshot

windows-screenshot

An online friend of mine came up with this idea originally. I thought it was a great prank, but I don't currently have an Arduino... So Rickroll WiFi for Windows was born.

Here's the source code (licensed under the MIT License):

@echo off 
title Rickroll WiFi for Windows
echo Rickroll WiFi for Windows
echo by http://rahul2001.com/
:Main
FOR /F "tokens=*" %%G IN (rickme.txt) DO (
netsh wlan set hostednetwork ssid="%%G" key=rahul_is_so_cool! >nul
netsh wlan start hostednetwork >nul
echo CURRENT SSID: %%G
timeout /t 1 >nul
netsh wlan stop hostednetwork >nul
)
echo REPEAT!
goto :Main

Save it as a batch file, and run it with administrator privileges. Be sure to change the password, and save all your data in rickme.txt. It will change the SSID every second with the subsequent line from the text file.

Here's what it looks like on Windows: Windows-Screenshot Here's what the rickme.txt file should look like:

NEVER GONNA GIVE YOU UP
NEVER GONNA LET YOU DOWN
NEVER GONNA MAKE YOU CRY
NEVER GONNA SAY GOODBYE

It literally took me 5 minutes to write this :P
It is still pretty crude though, and I'll update the code when I manage to make it a bit smoother.

The only disadvantage is that the SSID of a WiFi network cannot be longer than 32 characters, so all the lyrics don't work.
Unfortunately, the SSID doesn't change smoothly on Windows, but it still looks pretty cool :)

More information about how this works can be found here.

I really liked the default email app that used to come with Android. The bare-bones interface used to get the job done without any hassle.

Unfortunately, Google decided to kill it with Lollipop and integrated all other email services with Gmail. This was an unwelcome decision - I like to keep my inboxes separate... I tried some other apps on the play store, but most didn't work well, and the ones which did were filled with ads or required payment for basic features.

So I borrowed my friend's phone which still ran KitKat, and extracted the apk for the stock email app. This is the last working version of the app ever released. It doesn't have the material design icon, but that doesn't really matter...

You can download it here.

These aren't official, just general internet slang:

Level 0

The stuff you browse everyday: YouTube, DuckDuckGo, Facebook, etc.

Level 1 - Surface Web

This level is still accessible through normal means, but contains "darker" websites, such as Reddit.

Level 2 - Bergie Web

This level is the last one normally accessible: all levels that follow this one have to be accessed with a proxy, Tor or by modifying your hardware. In this level you can find some “underground” but still indexed websites, such as 4chan.

Level 3 - Deep Web

The first part of this level has to be accessed with a proxy. It contains Hacking, Adult Content, etc. This is the beginning of the Deep Web. The second part of this level is only accessible through Tor, and contains similar stuff.

Level 4 - Charter Web

This level is also divided in two parts. The first can be accessed through Tor. Things such as drug and human trafficking, banned movies and books and black markets exist there.

The second part can be accessed through a hardware modification: a “Closed Shell System”. This is serious. This part of the Charter Web contains Illegal Content, experimental hardware information ("Gadolinium Gallium Garnet Quantum Electronic Processors"), but also darker information, such as the "Law of 13", World War 2 experiments, and even the location of Atlantis.

Level 5 - Mariana's Web

A place where AIs come together and comment on cat videos. You need access to quantum computers to see this stuff...

Safe Mode can be really useful on your phone, when an app starts to misbehave, your phone starts crashing or your phone is infected by malware.

But what if you really need that superb backup tool you love? Well, don't fret, because I have the perfect solution for you...

UPDATE: This technique has been tested on the following devices:

  • Moto G (Turbo Edition) (Android 6.0.1)
  • Samsung Galaxy Note 5 (Android 5.1.1)
  • HTC Desire 816 (Android 5.0.1)

NOTE: This technique relies on something really simple that was probably overlooked by the developers and may be fixed in the future. I will be posting updates soon...

Step 1

Open the app in normal mode. normal app

Step 2

Exit the app, but make sure you don't swipe it away from the 'Recent Apps' menu. recent apps

Step 3

Reboot into Safe Mode by long-pressing the 'Power Off' option. The method to enter Safe Mode may vary on some devices. Safe mode

Step 4

You won't be able to run the app in Safe Mode enter image description here

Step 5

Open the 'Recent Apps' menu in Safe Mode Safe Mode - Recent Apps

Step 6

Tap on the app, and you will be able to run it. enter image description here

Enjoy!

Often while using command prompt, I want to create a directory and enter it. To do this I need to type in the following:

C:\Users\Rahul\Documents\Coding>md mydirectory
C:\Users\Rahul\Documents\Coding>cd mydirectory

This is such basic stuff, you would think that Windows would have functionality to do this with one command... But does it? No.

Which is why I've come up with the ultimate solution... Which is just common sense, really.

  • Open up command prompt and type copy con mdc.cmd.
    This let's you create and edit the file 'mdc.cmd', which is located by default in the System32 Folder.

  • Type @md %1 && cd /d %1, and press enter. These commends basically pass on the first command line argument of mdc.cmd to md, and then chose that directory with cd /d. I like to have the /d switch because it allows us to switch the current drive as well, but it is totally up to you.

  • Press Ctrl+Z and hit enter to stop editing the file.

Now everytime you want to create and enter a directory, just enter mdc mydirectory and Command Prompt will automatically enter mydirectory after creating it.