Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@ouranos ouranos commented Apr 1, 2014

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

@SteamWind

This comment has been minimized.

Copy link

@SteamWind SteamWind commented Apr 1, 2014

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

This comment has been minimized.

Copy link

@suhailvs 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

This comment has been minimized.

Copy link

@SteamWind SteamWind commented Apr 1, 2014

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

@0xdevalias

This comment has been minimized.

Copy link
Owner Author

@0xdevalias 0xdevalias commented Apr 1, 2014

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

This comment has been minimized.

Copy link

@pykler pykler commented Apr 1, 2014

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

@jimbuck

This comment has been minimized.

Copy link

@jimbuck jimbuck commented Apr 1, 2014

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

@SteamWind

This comment has been minimized.

Copy link

@SteamWind SteamWind commented Apr 2, 2014

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