Category Archives: Misc.

Discussions Gone – Google Search

It looks like Google has removed the discussions search filter for some browsers (currently using Chrome Version 32.0.1700.76 m).

Hoping this is a bug and not another part of the “simplicity” trend they’re on at the moment.

Solution #1: Append &tbm paramter to url
A temporary fix is to add “&tbm=dsc” to the end of the search url. SilentEcho has added this script to automate it if you’re going to be using it a fair bit: http://userscripts.org/scripts/reviews/293082

Solution #2: Change Use Agent String
You can also use a user agent string of a browser that it still works for (I’ve heard Opera but haven’t verified).

Solution #3: Sign Out of Google Account
This didn’t work for me, however quite a few people are saying it does the job for them.

Thanks to this thread for the links/info: http://productforums.google.com/forum/#!msg/websearch/Psb6OmlLJTg/NoW2hr-qytcJ

Working IPN Handler with Parallel Payments – PayPal Adaptive Payments

Hey everyone,

Just a dummy implementation of a Parallel Payment and an accompanying IPN Handler using the C#/.NET SDK. Feel free to use it however you like.

//Handles PayPal IPN
        public String IPN()
        {
            //Post back to either sandbox or live
            string strSandbox = "https://www.sandbox.paypal.com/cgi-bin/webscr";
            //string strLive = "https://www.paypal.com/cgi-bin/webscr";
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(strSandbox);

            ////Set values for the request back
            req.Method = "POST";
            req.ContentType = "application/x-www-form-urlencoded";
            byte[] param = Request.BinaryRead(Request.ContentLength);
            string strRequest = Encoding.ASCII.GetString(param);
            strRequest += "&cmd=_notify-validate";
            req.ContentLength = strRequest.Length;

            //Send the request to PayPal and get the response
            StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);
            streamOut.Write(strRequest);
            streamOut.Close();
            StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream());
            string strResponse = streamIn.ReadToEnd();
            streamIn.Close();

            if (strResponse == "VERIFIED")
            {
                //check the payment_status is Completed
                //check that txn_id has not been previously processed
                //check that receiver_email is your Primary PayPal email
                //check that payment_amount/payment_currency are correct
                //process payment
            }
            else if (strResponse == "INVALID")
            {
                //log for manual investigation
            }
            else
            {
                //log response/ipn data for manual investigation
            }


            return "";
        }

        //Pay for an order
        public void Pay(int OrderId)
        {
            RequestEnvelope envelopeRequest = new RequestEnvelope();
            envelopeRequest.errorLanguage = "en_US";
            PaySample paySample = new PaySample();
           
            List listReceiver = new List();
            // Amount to be credited to the receiver's account
            Receiver receiverA = new Receiver(Convert.ToDecimal("4.00"));

            // A receiver's email address
            receiverA.email = "test_buyer1@learnerlessons.com.au";
            listReceiver.Add(receiverA);

            // Amount to be credited to the receiver's account
            Receiver receiverB = new Receiver(Convert.ToDecimal("2.00"));

            // A receiver's email address
            receiverB.email = "test_buyer2@learnerlessons.com.au";
            listReceiver.Add(receiverB);

            ReceiverList receiverList = new ReceiverList(listReceiver);

            PayRequest requestPay = new PayRequest(envelopeRequest, "PAY", "http://localhost:53034/orders/cancel", "AUD", receiverList, "http://localhost:53034/orders/return");
            requestPay.reverseAllParallelPaymentsOnError = true;
            requestPay.ipnNotificationUrl = "http://123.123.123.123/Orders/IPN";

            //Send request to paypal, retrieve payKey
            PayResponse payResponse = paySample.PayAPIOperations(requestPay);

            Response.Redirect("https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_ap-payment&paykey=" + payResponse.payKey);
        }

Configuring Custom Settings – PayPal C# SDK

Hey everyone,

I’ve been mucking around with the C# SDK for PayPal Adaptive Payments. Unfortunately the docs aren’t too great and the samples are a little confusing until you get your head around them.

One of the main issues I’ve had is working out how to configure payment request settings i.e. reverseAllparallelPaymentsOnError.

To do this, simple utilise the PayRequest class:

PayRequest requestPay = new PayRequest(envelopeRequest, "PAY", "http://localhost:53034/orders/cancel", "AUD", receiverList, "http://localhost:53034/orders/return");
requestPay.reverseAllParallelPaymentsOnError = true;

Application ID – PayPal Sandbox

Hey everyone,

Just setting up an app that using the .NET Adaptive Payments SDK. Looking through the sandbox I was able to find the api signature, password and username but not the application ID (My Account > Overview > Account Information > API Access).

It turns out that ALL sandbox apps share the same ID:

Application ID: APP-80W284485P519543T

Chrome Incognito Mode not Working – Registry Fix

Hey everyone,

I use incognito mode at work as a quick test for cookie/caching issues. I ran into a bit of an issue with it this morning after an MOE update yesterday. Using the shortcut (ctrl + shift + n) did nothing, and the tools option showed incognito mode greyed out.

After a bit of Googling I came across a registry value that had been added to prevent incognito mode. The fix for this is pretty simple, just remove the value. There are a few variations on this so you may have to do a bit of digging to find which one has been added to your machine (Run > regedit or C:Windowsregedit.exe).

One additonal note, my unwanted registry key was added during the login process each time I removed it. A quick way around this is to do up a quick batch script to remove it. Just modify my one below to include your registry key and throw it in your startup folder:

reg delete HKEY_LOCAL_MACHINESOFTWAREPoliciesGoogleChrome /v IncognitoModeAvailability /f

wget or curl on Windows

Hey everyone,

Just a quick post on a Window’s equivalent to wget/curl.

To start, you’ll need to open PowerShell (run > powershell.exe). To retrieve the page, you’ll just need to enter the following one liner:

(new-object System.Net.WebClient).DownloadFile('http://www.whatibroke.com','C:my_output_file.txt')

The page contents will be stored in the output file provided as the second parameter to DownloadFile. To view it, just open the file in a text editor.

If you’d rather something with a GUI, winwget has been recommended on SuperUser.

Australian Tax File Number Generator (TFN)

I’m looking for projects – if there are any tools like this that you need and think you’d be willing to pay a $5-$10 subscription for shoot me a message or leave a comment below

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.

Get the generator: TFN Generator

A bookmarklet to generate random TFNs

A bookmarklet to generate random TFNs

For info on how it all works, checkout the Wikipedia page: Australian Tax File Number

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.

Coinroll.it Betting Bot – Martingale System

Hey everyone,

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

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.

How to Block PayPal eCheque Payments

Hey everyone,

Just a quick post on how to block eCheque payments. These are payments that take up to seven days to process and be approved. The site I am currently working on is in no position to reserve services for such a long period of time, so the request has been made to block non-instant payment methods.

In the sandbox environment, you just need to do the following:

  • Login to your applications PayPal account at sandbox.paypal.com
  • Press the My Account tab
  • Select profile (just underneath my account)
  • Under selling preferences, click Payment Receiving Preferences
  • Under Block the following payments, check ‘Payments by eCheque on your website. Note: You may not block echeque payments on eBay’

The credit card statement name can also be set here. Let me know if you have any trouble.

Cheers,
Chris

Refresh Folder Hotkey – Sublime Text 2

Hey everyone,

Just a quick post on how to setup a refresh hotkey in Sublime on Windows. All you have to do is the following:

1) Open sublime
2) Select Preferences from the top menu and then click “Key Bindings – Default”
3) Go to the end of the file and add a comma to the last entry:

        //Original
	{ "keys": ["enter"], "command": "hide_panel", "context":
		[{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}]
	},
	{ "keys": ["shift+enter"], "command": "find_prev", "context":
		[{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}]
	},
	{ "keys": ["alt+enter"], "command": "find_all", "args": {"close_panel": true},
		"context": [{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}]
	}

        //Modified
        //Original
	{ "keys": ["enter"], "command": "hide_panel", "context":
		[{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}]
	},
	{ "keys": ["shift+enter"], "command": "find_prev", "context":
		[{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}]
	},
	{ "keys": ["alt+enter"], "command": "find_all", "args": {"close_panel": true},
		"context": [{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}]
	}

4) Add the following entry:

//Custom
{ "keys": ["f5"], "command": "refresh_folder_list" }

Now all you have to do is save the file and F5 will now refresh your project! If you want to change the hotkey, simply switch [“f5”] for another value.

Leave a comment below if you have any issues or tips!