Skip to content

Instantly share code, notes, and snippets.

@0xdevalias
Last active August 29, 2015 13:57
Show Gist options
  • Save 0xdevalias/9905949 to your computer and use it in GitHub Desktop.
Save 0xdevalias/9905949 to your computer and use it in GitHub Desktop.
A quick little hack to automagically mine unicoins (stackoverflow.com April Fools 2014) <3 /dev/alias (www.devalias.net)

First, go to stackoverflow.com then define this in your Javascript console:

var hackMeSomeUnicoins = function(myFkey) {
  console.log("Ok, let's hack you some shiny unicoins! <3 /dev/alias (www.devalias.net)")
  console.log("The powers that be say you can only mine a rock every 10sec, so we do it every 11sec to be sure.")
  window.setInterval(function(){
    $.get( "http://stackoverflow.com/unicoin/rock", function( data ) {
      var rockId = data.rock;
      $.post( "http://stackoverflow.com/unicoin/mine?rock=" + rockId, { fkey: myFkey })
      .done(function( data ) {
        console.log(data);
      });
    });
  }, 11000);
};

Once you have done that, just call this from the console:

hackMeSomeUnicoins(StackExchange.options.user.fkey);

(Thanks to @ouranos for the fkey options string)

You can get your fkey by inspecting the POST made when you successfully (manually) mine a rock. (It's also stored in a data-fkey type value somewhere, but haven't been bothered to find it and automagically pull it out (feel free to contribute some JS to do it)

Pimping this:

@ouranos
Copy link

ouranos commented Apr 1, 2014

You can get the key with StackExchange.options.user.fkey

@SteamWind
Copy link

This thing is realy great secured, i don't think we can do better than your code. Maybe if you would like to auto launch the script in one paste because you are lazy, so run this:

var hackMeSomeUnicoins = function(myFkey) {
  console.log("Ok, let's hack you some shiny unicoins! <3 /dev/alias (www.devalias.net)")
  console.log("The powers that be say you can only mine a rock every 10sec, so we do it every 11sec to be sure.")
  window.setInterval(function(){
    $.get( "http://stackoverflow.com/unicoin/rock", function( data ) {
      var rockId = data.rock;
      $.post( "http://stackoverflow.com/unicoin/mine?rock=" + rockId, { fkey: myFkey })
      .done(function( data ) {
        console.log(data);
      });
    });
  }, 11000);
};
hackMeSomeUnicoins(StackExchange.options.user.fkey);

I tried some posts but it gives me back a teapot haha.
Thank you for your job.

@suhailvs
Copy link

suhailvs commented Apr 1, 2014

I have forked this and created a much nicer solution can be used for any stackexchange sites:::

function minec(){ 
    $.getJSON('/unicoin/rock',function(data) {
        setTimeout(function(){$.post('/unicoin/mine?rock='+data.rock,{fkey:StackExchange.options.user.fkey});
    },10000)});
    setTimeout(UniMine,11000);
}
minec();

@SteamWind
Copy link

Unfortunately, the server give less and less coins while you try to mine...

@0xdevalias
Copy link
Author

ouranos: Cool, thanks for that :)

suhailvs: Definitely a nicer looking version than what I hacked together :)

SteamWind: I noticed that I seemed to be getting a LOT of 0 coins after a while, but still managed to get enough through this to buy all the features :)

@pykler
Copy link

pykler commented Apr 1, 2014

@suhailvs small typo in your setTimeout, should be minec not UniMine

@jimbuck
Copy link

jimbuck commented Apr 1, 2014

Updated with a few more features: https://gist.github.com/JimmyBoh/9917943

@SteamWind
Copy link

Sad it's already finish... :(
Nobody have think about doing a chrome extension to keep it anyway ? ^^

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