For a project I’m currently working on I needed a dynamic robots.txt. Because our test environment is public facing we want to keep it from being indexed by Google etc. It took a bit of Googling to find a solution that worked, but in the end it was actually pretty simple.
Here’s the action in one of the API Controllers:
public class UtilitiesController : CustomBaseApiController
{
[Route("Robots.txt")]
[HttpGet]
public HttpResponseMessage GetRobotsFile()
{
var resp = new HttpResponseMessage(HttpStatusCode.OK);
var stringBuilder = new StringBuilder();
if (Helpers.IsProduction())
{
// Allow bots in production
stringBuilder.AppendLine("user-agent: *");
stringBuilder.AppendLine("disallow: ");
}
else
{
// Don't allow bots in non-production environments
stringBuilder.AppendLine("user-agent: *");
stringBuilder.AppendLine("disallow: *");
}
resp.Content = new StringContent(stringBuilder.ToString());
return resp;
}
}
Also need to add the following to your web.config so that the robots.txt file can processed by the routing handler. Without this IIS will attempt to serve it as a static file and will return a 404 when it’s not found:
I ran into a bit of an issue turning a menuitem into a link with Material UI and React-Router. The main problems being that underlines appeared and threw the spacing out.
To summarize, use the component attribute on the ListItem:
The solution is to add the May 2018 Windows Security Update on both the remote and local machines. If that’s not possible a registry entry can be added to the local machine to circumvent the issue. This can be done by running the following command in a command prompt as administrator:
The cause is actually because of a security update in windows. If either the remote or local machine has the update and the other does not the error is triggered. There’s more info available on the following page: https://github.com/stascorp/rdpwrap/issues/480
I’ve just setup an INA219B Voltage/Current sensor on my RaspberryPi. Just thought I’d link the tutorials and libraries I used – there’s a lot of really useful info out there.
Enable Low Power Between Reads ina.configure(ina.RANGE_16V)
while True:
print "Voltage : %.3f V" % ina.voltage()
ina.sleep()
time.sleep(60)
ina.wake()
If you’re getting the following error:
OSError: [Errno 121] Remote I/O error
Run the following command:
i2cdetect -y 1
And check to ensure that your device is showing up on 40. If it’s a different number you’ll just need to update the address in your code e.g. (0x40, 0x41, etc.)
Sample Australian Tax File Numbers/Test Australian Tax File Numbers:
865414088
459599230
125486619
656077298
796801997
754601340
243494429
953615761
551953801
946489031
996506823
615315318
412042562
907974668
565051603
I came across an old VB Script used to generate random TFNs for testing. I’ve just done up a quick JavaScript bookmarklet to replace it. Just drag the button on the page below to your bookmarks bar and you’ll be able to generate random TFNs.
UPDATE:
If you’re using IE, right click on the link and press add to favourites. Once you’ve added it, click the link in your favourites sidebar. The generator will appear in the top right hand corner of the page.
Let me know if you have any trouble. If you’d like to a custom or corporate copy please contact me.
I received an odd request for a script the other day – a bot for an bitcoin gambling website. The request was for a simple JavaScript bookmarklet that would execute the martingale betting system autonomously.
The code I ended up with as follows:
javascript: /* MANUAL CONFIGURATION - Initialisation Only */ var reset_to = 0.00001; /* Amount to reset to */ /* Initialise bot */ initialise_bookmarklet(); var previous_bet = null; var bot_running = false; create_message('Bot initialised, hit run to start...'); /* Runs the bot */ function run_bot(){ /* Check to see whether bot needs to be run/stopped */ if(bot_running == true){ /* Create vars */ var bet_amount = $("#betamount").val(); var parent_id = $('#bets .item:first').attr('id'); var result = $('#bets .item:first-child .lucky'); /* Check if result is same as previous */ if(result == null || result.length == 0){ create_message('No bets on screen... waiting for next run.'); } else if(parent_id != previous_bet){ /* Set previous bet to current bet */ previous_bet = parent_id; /* Check the current bet amount */ if(bet_amount >= $('#max_bet').data('max_bet') || bet_amount > $('#account-balance').text()){ /* Reset bet amount */ $('#betamount').val(reset_to); create_message('MAXXED OUT'); } /* Check if first item is a win */ if($(result).hasClass('win')){ /* Adjust bet amount to reset amount and roll */ $('#betamount').val(reset_to); roll(); } else if($(result).hasClass('lose')){ /* Double amount and roll again */ setDouble(); roll(); } else{ create_message('Unknown status, not a win or loss... wait for next run...'); } } else if ($('#betbutton').hasClass('pressed') == false){ create_message('Assumed 503, press again...'); roll(); } else{ create_message('Previous bet is still there, wait ' + $('#bot_timeout').val() + 'ms...'); } /* Schedule next run */ setTimeout(function(){ run_bot(); }, $('#bot_timeout').val()); } else if(bot_running == false){ /* Update status to prevent bot running again */ create_message('Bot stopped...'); } else{ /* Error occurred */ create_message('Error: Unknown status.'); create_message('Bot stopped...'); } } /* Run when button clicked */ function bot_status_change(button){ /* Check whether to start or stop bot */ if(bot_running == false){ /* Run bot and display message */ create_message('Running bot...'); $(button).text('Pause'); bot_running = true; run_bot(); } else if(bot_running == true){ /* Update status to prevent bot running again */ create_message('Stopping bot...'); bot_running = false; $(button).text('Run'); } else{ /* Error occurred */ create_message('Error: Unknown status.'); create_message($(button).text('Run')); bot_running = false; } } /* Creates a message */ function create_message(message){ console.log(message); $('#status_div').prepend(message + ' '); } /* Sets the max bet */ function set_max_bet(){ /* Retrieve max bet */ var txt_max_value = parseFloat($.trim($('#max_bet').val())); /* Check if new bet is not a number */ if(isNaN(txt_max_value) == false){ /* Set max bet and display to user */ $('#max_bet').data('max_bet', txt_max_value); create_message('New Max Bet: ' + txt_max_value + ""); } else{ create_message('
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'); create_message('Max bet is not a number, not updated.'); create_message('Current Max Bet: ' + max_bet); create_message('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'); } } /* Displays button to start bot etc */ function initialise_bookmarklet(){ /* Create vars */ var controls; var div_styles = "max-width:250px; width:250px;position: fixed; top: 10px; left: 10px; text-align: left; background-color: rgba(238, 238, 238, 0.84); padding: 10px; border: 1px solid rgba(116, 116, 116, 0.46); border-radius: 3px; box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.2); color: #333;"; var status_div = ""; /* Set controls */ controls = "
" + /* Wrapper start */ "Timeout: " + "Run
" + /* Timeout button */ "Max Bet: " + "Set" + /* Max Bet */ "
Timeout: How many milliseconds the bot should wait between each bet.
Max Bet: The bot will revert to the reset amount if the bet exceeds this value (eg. 0.041)
" + "
"; /* Close wrapper */ /* Append status div */ controls += status_div; /* Add button to body */ $('body').append(controls); }
To add the bookmarklet, simply create a bookmark using the code above as the url. Go to CoinRoll, enter a bet and a starting value of 0.0001. Finally, click the bookmark icon, choose your max bet and hit start.
Martingale Bot for CoinRoll.it
Note that this is just a quick script and has a lot of potential to be optimised. I should also mention that this is not an exploit, just a bot. The martingale system is still gambling and if you play long enough you WILL lose.