Sunday, June 26, 2016

SneakyBrian/nano-service by SneakyBrian

SneakyBrian/nano-service
By SneakyBrian



nano-service is an example of building a platform that allows rapid deployment of web application code. The server-side script that runs is written in JavaScript, and executes in the context of the request, returning the evaluated result.

git clone https://github.com/SneakyBrian/nano-service


Created At: June 26, 2016 at 04:57PM
via GitHub https://github.com/SneakyBrian/nano-service

Wednesday, June 8, 2016

SneakyBrian/escws by SneakyBrian

SneakyBrian/escws
By SneakyBrian

Embedded Static Content Web Server, written in Go

June 8, 2016 at 09:38PM
via GitHub https://github.com/SneakyBrian/escws

Monday, July 22, 2013

Using a Raspberry Pi to Mine LiteCoins

Raspberry_Pi_Logo.svgLitecoin_Logo
In this tutorial I assume that you already know about LiteCoin, and have already signed up to a mining pool. If not, probably best go start reading here.

To begin, lets install the latest Raspbian image on to your SD card from here. I use Win32DiskImager for this:

image

Now we boot up the pi and run through the initial setup steps. We could skip this part, but you may want to run through the steps to expand your SD card and/or overclock your pi. Be warned: overclocking may shorten the life of your pi.

After logging in to the command line, first make sure our distro is running the latest and greatest software by running the following commands

sudo apt-get update

Then…

sudo apt-get upgrade

20130721_230222

Agree to the prompt to make changes. Go and make a cup of tea while this runs, it won't be quick.

Some time later, when we have a command prompt back, we need to install the pre-requisites we need:

sudo apt-get install make automake build-essential git libcurl4-openssl-dev

20130721_232207

Agree to the prompt to continue. You may already have some of these (git for instance), which is fine.

Now we need to get the source code from Github:

git clone git://github.com/pooler/cpuminer.git
cd cpuminer


20130721_233059

We now have the cpuminer source, so now we build it

./autogen.sh
./configure CFLAGS="-O3"
make

20130721_233343


This should compile the source code into the binary we need to run. Note that the CFLAGS="-O3" option is the capital letter O for Orange, not zero.

Now we can run the miner. Provide your pool url and username/password and off you go:

./minerd --url=<pool url> --user=<username> --pass=<password> -–debug

I have specified the debug flag here in order to diagnose if there are any issues. You may want to leave that out if you're feeling confident.

You should now see something like this:

20130721_235043

As you can see, the hash rate is barely worth the effort. Even with the low power usage of the Raspberry Pi, you will be spending far more in electricity than you will gain in LiteCoins. If you have some solar panels or other free electricity source then this may become viable, but really you’d be better off selling the electricity!

If you like this article, and you’re feeling generous, here is my LTC address: LKRove4ktG8mksNCfVzcnhvdbiFBwW4tF2

Wednesday, July 17, 2013

Visual Studio Remote Debugging

Rubber_duck_assisting_with_debuggingI had some problems today getting Visual Studio to connect to the Remote Debugging tool (MSVSMON.exe) running on an ASP.NET application server. The error message I received when I clicked on “Debug” –> “Attach to Process…” was along the lines of:

The Microsoft Visual Studio Remote Debugging Monitor (MSVSMON.EXE) does not appear to be running on the remote computer.



…even though I definitely was running MSVSMON on the server via an RDP session. There were no firewalls enabled on either machine, or sitting on the network between us.


In order to resolve this I shared my locally installed version of MSVSMON over the network so that it could be accessed by the server in question and ran the tool directly from the share. Once I had done this I had no problems connecting. Typically MSVSMON can be found in the “<Visual Studio Install Directory>\Common7\IDE\Remote Debugger” folder in both x64 and x86 flavours.

Wednesday, May 15, 2013

10 Things I Learnt Watching A Video About 10 Things Paul Irish Learnt From The jQuery Source

Great, if slightly quirky, video from Paul Irish. Some good points about IIFE’s and jQuery selector performance.

I’ve even added a Cornify button for you to click here:

Cornify

Saturday, May 11, 2013

One or more types required to compile a dynamic expression cannot be found. Are you missing a reference?

Just had an issue trying to use a dynamic object in a .NET test project – at build time I had the compiler error:

One or more types required to compile a dynamic expression cannot be found. Are you missing a reference?

In the end all I had to do was reference “Microsoft.CSharp” from my test project.

Wednesday, May 8, 2013

AntiScrape - IIS ASP.NET Http Module

Download Code

no-scrapeAntiScrape is an IIS ASP.NET Http Module to help in the fight against website scrapers!

How does it work?

AntiScrape hooks into the IIS ASP.NET request/response pipeline.

When your website users request a page, it automatically adds secret hidden links to the page that normal users in web browsers won't see. However, website scrapers that are scanning the HTML of the page will see the link and follow it.

Once the scraper has followed the secret link, they are recorded as being a scraper, and from then on what happens is entirely up to you!

You can either:

  • Return custom content and/or HTTP status code for every other request the scraper makes (even for legitimate content), or
  • Introduce a configurable random delay for all requests that the scraper makes, slowing the scraper down, or
  • Do nothing, other than log the scraping activity.

The settings for AntiScrape are integrated into the web applications web.config.

How are the scraping requests logged?

The module comes with a reference implementation of the data persistence layer for SQL Server, but other implementations can be easily added by implementing the IDataStorage interface in an assembly that resides in the web applications bin folder (remembering to remove the assembly containing the SQL Server reference implementation). AntiScrape uses Microsoft Unity to resolve the IDataStorage interface at run-time.

Development Goals

As part of this project I wanted to ensure that the module could be integrated with an existing web solution as easily as possible. Therefore the sample web project is just a vanilla web forms project created with File, New Web Project in Visual Studio, plus the dlls and some config changes. There are some other minor tweaks to show the results of the scraping requests in a table, but that’s it!

Development Status

This software is currently in active development, and so not recommended for production environments at present.

Stuff I have yet to deal with:

  • Legitimate scrapers – such as search engine crawlers
  • Randomizing the honeypot url

Once I have something reasonable that answers these I shall put together a NuGet package that integrates the module and applies the config transforms.

Live Demo

Live demo is available on Windows Azure here: AntiScrape Demo

Source Code

Source code is available on Github here.

Technology Used