Development – HM2K http://hm2k.org/ Research and development Mon, 30 Jan 2012 22:14:45 +0000 en-GB hourly 1 https://wordpress.org/?v=5.5.1 181873647 Is Google PageRank dead? https://hm2k.org/posts/is-google-pagerank-dead https://hm2k.org/posts/is-google-pagerank-dead#comments Thu, 06 Oct 2011 21:30:30 +0000 http://labs.phurix.net/?p=3314 Related posts:
  1. PageRank Viewer Launch Back in 2007, we were developing code for our domain...
  2. Google PageRank Script Welcome to the home of the Google PageRank script. You’ll...
  3. The Google Translate recursion bug Recently I found a bug in Google Translate. It’s not...
  4. get_favicon() php function I was after a php function that would get the...
]]>
PageRank is dead, long live PageRank.

As we said recently, there’s been lots of speculation as to whether PageRank is dead or not. It isn’t, just Google are moving the goals a bit. Basically, they don’t want you to focus on PageRank but it’s still massively important to them.

All this talk of dead, reminds me of the Monty Python dead parrot sketch, only in this case, it isn’t dead. An anti-dead-parrot if you will.

So what’s with all the news about PageRank being dead? Google just changed their code, that’s all…

What’s going on then?

Originally, everyone used the code in the Internet Explorer plugin, then the Firefox plugin came along.

The common thing about both was the URL they used to lookup the PageRank:

http://toolbarqueries.google.com/search?client=navclient-auto&ch=%s&features=Rank&q=info:%s

Note: The first %s is the checkhash, while the second is the actual URL you’re looking up.

Back in August, James Slater was investigating the new Google Related chrome plugin only to discover the new PageRank lookup URLs:

http://toolbarqueries.google.com/tbr?client=navclient-auto&ch=%s&features=Rank&q=info:%s

Also, if you used to use the host “www.google.com” this no longer works either, use “toolbarqueries.google.com” instead.

Let there be code!

As part of our ongoing commitment to our PageRank lookup tool, not only have we fixed our code, but we’ve released working PageRank scripts to GitHub.

PageRank is dead, long live PageRank.

]]>
https://hm2k.org/posts/is-google-pagerank-dead/feed 5 3314
Integrate a newsletter into your website https://hm2k.org/posts/integrate-a-newsletter-into-your-website https://hm2k.org/posts/integrate-a-newsletter-into-your-website#comments Wed, 07 Sep 2011 13:26:56 +0000 http://labs.phurix.net/?p=3257 Related posts:
  1. British fuel cost per mile I was trying to work out how to estimate how...
  2. How to Copyright your website People often ask me how to go about getting their...
  3. PHP coding standards and best practices I have been using PHP for a long time now,...
  4. Free icon sets for your website If you don’t have the time to make your own...
]]>
Over the years I’ve been asked how to integrate a newsletter into a website quite a few times.

These days I often find myself recommending a third party service such as MailChimp, however I soon discovered that as brilliant as it is, MailChimp its not for everyone.

For example, many of our web hosting clients want to run their own mail campaigns through their own website rather than use a third party service.

What software should we use?

From memory there’s a few ways to do that:

  • Mailman – Installed with cPanel
  • PHPList – Install yourself or through fantastico, I’m not a fan
  • Majordomo – Not installed

There’s quite a few other “free mailing list” solutions and there’s plenty of alternatives to Mailman, but Mailman is the preferred option for us, mainly because it’s reliable and established…

“cPanel currently uses Mailman, which is an open source product under the GNU Project”

– Adam Wien, Systems Administrator

It’s reassuring when software is used by a vendor such as cPanel, as you know it’s likely to be supported for the foreseeable future.

It’s really easy to get started with the Mailman Mailing Lists in cPanel, however there’s even a video tutorial if you’re a little unsure.

Tip: When you setup your mailing list call it “newsletter” so its purpose is easy to identify.

Now we’ve decided what software we’re using and we’ve setup our newsletter mailing list, we can now actually integrate it with our website.

When I first started looking into this, there wasn’t many ways to integrate Mailman using PHP, just an outdated article entitled How do I integrate Mailman with PHP, or any other web enabling technology?

Don’t worry about that, because we’re here to help…

Introducing the Mailman Widget for WordPress

What we want to achieve here is a widget on our website so users are able to subscribe to our newsletter.

If you’re using WordPress, this is no problem as we’ve got a WordPress Plugin to do it for you:

Simply login to your WordPress site as you normally would and go to the Add New Plugin screen. Just look for the “Mailman Widget”. If in doubt, take a look at the Mailman Widget screenshots to help you out.

Not using WordPress? Don’t panic!

We can use exactly the same library that’s used in the Mailman Widget on any PHP based website.

Simply download the file and take a look at the example to get you started.

The future of PHP Mailman

In future, using PHP Mailman should be even easier as it is turned into a PHP Pear package called Services_Mailman.

You can now download the Pear package via github:

Simply click the download button and extract the files. You can either require it like a normal class or install it as a Pear package by running the following:

pear install package.xml

Once the proposal for Services_Mailman has been passed, you should be able to simply do “pear install Services_Mailman” as it will be added to the Pear channel.

In summary

I hope this helps make it easier for you to add a newsletter to your website. Despite the rise of social media (such as twitter) email is still the number 1 way to communicate online, so it’s never been more important to keep in touch with your customers or peers.

Good luck!

]]>
https://hm2k.org/posts/integrate-a-newsletter-into-your-website/feed 1 3257
Google’s Official Profanity API https://hm2k.org/posts/googles-official-profanity-api https://hm2k.org/posts/googles-official-profanity-api#comments Wed, 17 Aug 2011 10:09:15 +0000 http://labs.phurix.net/?p=3180 Related posts:
  1. The rise and fall of WhoisX WhoisX is a domain name lookup service, similar to the...
  2. What is my IP? An IP address is a unique number which identifies a...
  3. get_favicon() php function I was after a php function that would get the...
]]>
Recently a list of “bad words” were made available through Google’s new website which asks: “What do you love?” (wdyl.com).

So, perhaps I was a bit hasty writing off WhoisX.

The list of profanities was discovered in the Javascript on the website, however Google reacted quickly and switched this to a URL lookup instead of a Javascript one therefore keeping the list away from prying eyes.

However, what this does mean is now we have an API to play with:

http://www.wdyl.com/profanity?q=xxx

This will return a true JSON response:

{“response”: “true”}

While looking up something like “lol” will return a false response:

http://www.wdyl.com/profanity?q=lol

{“response”: “false”}

All in all a pretty simple and easy way to figure out whether Google thinks it is a bad word or not.

On the down side, you can’t easily use it on your site, as, if you try to call it by AJAX you’ll be faced by the following error:

XMLHttpRequest cannot load http://www.wdyl.com/profanity. Origin http://example.org is not allowed by Access-Control-Allow-Origin.

On the upside, we don’t want to do that anyway, we can to use it from PHP.

<?php

$q=isset($_REQUEST['q'])?urlencode($_REQUEST['q']):'';
readfile('http://www.wdyl.com/profanity?q='.$q);

?>

That’s right, that’s all there is to it. Simply copy that into the a file called “profanity.php” and you’re ready to go!

Now you can do a JSON call to your ‘profanity.php’ to tell you whether the word is bad or not.

If that’s not enough, you could try using the Google Profanity API to avoid displaying ads on pages that contain profanities.

Now if only there was a way to avoid the Scunthorp problem

Going back to the reported Adsense problem on WhoisX.co.uk, the example query was:

adult-hardcore-sex.cuntspace.me.uk

Passing this to the API returned false.

But, changing all the non-word characters to spaces has a different effect:

adult hardcore sex cuntspace me uk

{“response”: “true”}

This is done in PHP using a simple regular expression:

echo preg_replace(‘/[\W+]/’,’ ‘,’adult-hardcore-sex.cuntspace.me.uk’);

I’m not sure this exactly solves the Scunthorp problem, but it definitely does identify “sex” as an adult theme which is perfect.

Now to turn it into a usable function:

<?php

function is_profanity($q,$json=0) {
	$q=urlencode(preg_replace('/[\W+]/',' ',$q));
	$p=file_get_contents('http://www.wdyl.com/profanity?q='.$q);
	if ($json) { return $p; }
	$p=json_decode($p);
	return ($p->response=='true')?1:0;
}

$q=isset($_REQUEST['q'])?$_REQUEST['q']:'';
echo is_profanity($q);

?>

We can use this function to check whether the query is considered a profanity or not. If it is, it will return a 1, otherwise a 0 is returned.

This function can now be used to include kittens (or whatever) rather than Google Adsense Ads on a pages with “adult themed” content.

Brilliant!

Now to submit for reconsideration

]]>
https://hm2k.org/posts/googles-official-profanity-api/feed 2 3180
The rise and fall of WhoisX https://hm2k.org/posts/the-rise-and-fall-of-whoisx https://hm2k.org/posts/the-rise-and-fall-of-whoisx#comments Mon, 15 Aug 2011 08:33:38 +0000 http://labs.phurix.net/?p=3051 Related posts:
  1. Google’s Official Profanity API Recently a list of “bad words” were made available through Google’s new...
  2. get_favicon() php function I was after a php function that would get the...
  3. Google AdSense won’t let me in! Back in 2004, I signed up my old site “hm2k.org”...
  4. WhoisX relaunch We’re ready now… So, we’ve been running WhoisX since 2004,...
]]>
WhoisX is a domain name lookup service, similar to the whois service provided by “domain tools”, but ours was primarily for UK domain names.

It began as a small project to help people check whether a domain was available or not. When a domain was available the visitor was linked to a place they could buy the domain.

We developed out the project into more of a whois lookup service because this was useful to customers who wanted to see details about their domain using a web service rather than understanding how to do a whois lookup from the command line.

However, we soon came to realise that the site was causing a high load on the server because it was being hammered by bots. These bots were visiting thousands of URLs in an attempt to get WhoisX to generate a link back to them. Little do they know that, that’s not how it works.

The project was revamped with a whole load of new features including caching and load checking, which worked very well.

It no longer just did domain lookups either, it did hostnames (showing the “domain parts” making it easy to navigate), ip lookups, country code lookups, reverse ip lookups, mail server lookups and various dns queries all displayed within a few seconds.

We expanded the “social” aspect to make it easier to share and made it ad supported using Google Adwords.

Personally, I found the tool very useful to quickly check a domain, or drop a link into an email so customers could check for themselves.

This was all working great. The tool was useful to us and it was bringing in a small revenue, so it was all worth while.

However, this ended when Google emailed with the subject “AdSense ad serving has been disabled to your site”, the email went on to say:

Hello,

During a recent review of your account we found that you are currently
displaying Google ads in a manner that is not compliant with our program
policies
(https://www.google.com/support/adsense/bin/answer.py?answer=48182&stc=aspe-1pp-en).

————————————————–
EXAMPLE PAGE: http://whoisx.co.uk/adult-hardcore-sex.cuntspace.me.uk

Please note that this URL is an example and that the same violations may
exist on other pages of this website or other sites in your network.

VIOLATION(S) FOUND:

LINKS TO ADULT CONTENT: As stated in our program policies, AdSense
publishers are not permitted to place Google ads on pages with adult or
mature content. This includes displaying ads on pages that provide links
for or drive traffic to adult or mature sites. More information about this
policy can be found in our help center
(https://www.google.com/adsense/support/as/bin/answer.py?hl=en&answer=105957).

ADULT SEARCH RESULTS: As stated in our program policies, AdSense
publishers are not permitted to place Google ads on pages with adult or
mature content. This includes search results pages for adult or mature
terms, images or videos with adult keywords or tags, and user generated
comments that are mature in nature. More information about this policy can
be found in our help center (
https://www.google.com/adsense/support/as/bin/answer.py?hl=en&answer=105957
).

ACTION TAKEN: We have disabled ad serving to your site.

ACCOUNT STATUS: ACTIVE
Your AdSense account remains active. However, please note that our team
reserves the right to disable your account at any time. As such, we
encourage you to become familiar with our program policies and monitor
your network accordingly.

Issue ID# XXXXXXX

————————————————–
Thank you for your cooperation.

Sincerely,

The Google AdSense Team
—————-
For more information regarding this email, please visit our Help Center:
https://www.google.com/adsense/support/bin/answer.py?answer=113058&stc=aspe-ai4-en.

Although I agree with Google’s terms, this was an outside case and I couldn’t understand why they had chosen the example they had, since the “visit website” link on the page links to a website that doesn’t exist.

At the very worst, the URL contains an adult word, which is almost impossible to filter due to the “Scunthorpe problem” and that Google have not supplied a “bad word list” for us to work off.

This meant that without spending a lot of time on developing a very complex filter system so that ads aren’t displayed on pages containing potentially bad words, there was very little we could do about it.

So, this signals the end for WhoisX as we know it.

Consider this 30 days that the site will be closing down in it’s current form.

However, we do have plans to open a new domain lookup service, supported by Phurix in it’s place.

Watch this space!

]]>
https://hm2k.org/posts/the-rise-and-fall-of-whoisx/feed 1 3051
What is my IP? https://hm2k.org/posts/what-is-my-ip https://hm2k.org/posts/what-is-my-ip#respond Tue, 09 Aug 2011 08:48:14 +0000 http://labs.phurix.net/?p=3193 Related posts:
  1. Google’s Official Profanity API Recently a list of “bad words” were made available through Google’s new...
  2. PageRank Viewer Launch Back in 2007, we were developing code for our domain...
  3. Is Google PageRank dead? PageRank is dead, long live PageRank. As we said recently,...
  4. Over sixteen ways to obfuscate e-mail addresses Back in 2007 I wrote about email addresses on your...
]]>
An IP address is a unique number which identifies a machine on a network.

On the Internet IP addresses are allocated in blocks to ISPs in each country by regional registries, making it possible to identify which country an IP address originated in.

Often, if you are connected to the Internet behind a router, you share an online IP address with everyone else on your local area network (LAN).

Sometimes you need to know your external IP address and using something like ipconfig will only return your LAN IP address (something like 192.168.0.1).

That is why many “what is my ip” websites exist, making it easy for you to lookup your external IP address.

My favourite IP lookup service has been for a long time one run by NASDAQ-100 content delivery specialists “Akamai Technologies”:

It’s brilliant in its simplicity but it’s not very pretty.

We decided to do something different. We made a pretty “What is my IP address?” lookup:

Part of its beauty is that the audience its aimed at is able to quickly read and understand the information at a glance, without any prompts. While those who don’t understand it can marvel at its pretty form and ponder over its usefulness.

The other part of its beauty is that it’s highly parsable.

It’s easy to parse the IP address, mainly because the presentation (CSS) is separate from the markup (HTML), but also because of the headers.

Here’s a short demonstration to show how you can use the headers to get the IP address using this tool:

<?php $h=get_headers(‘http://ip.phurix.net’,1); echo trim($h[‘Location’],’/’); ?>

However, this method isn’t very portable, so may not be suitable if you’re checking against multiple sources at once.

So instead, we can also demonstrate using a simple regular expression and a function that can get http contents (such as file_get_contents() in PHP).

<?php echo preg_replace(‘/.*?(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}).*/s’,’$1′,file_get_contents(‘http://ip.phurix.net’));?>

The brilliance in this little snippet is that it will work with any useful “What is my IP?” lookup website.

So as you can see, it’s really easy to work with as a pretty API as well.

Beyond the IP address, you only need to look at the source code to understand that it’s easy to parse the other details.

I hope you found this useful!

]]>
https://hm2k.org/posts/what-is-my-ip/feed 0 3193
PageRank Viewer Launch https://hm2k.org/posts/pagerank-viewer-launch https://hm2k.org/posts/pagerank-viewer-launch#comments Wed, 03 Aug 2011 14:55:28 +0000 http://labs.phurix.net/?p=3142 Related posts:
  1. Is Google PageRank dead? PageRank is dead, long live PageRank. As we said recently,...
  2. Google PageRank Script Welcome to the home of the Google PageRank script. You’ll...
  3. get_favicon() php function I was after a php function that would get the...
  4. HM2K’s code repository HM2K’s code repository is now open for business! This repository...
]]>
Back in 2007, we were developing code for our domain lookup service.

One of the features we wanted was to display the Google PageRank of a domain right there in the lookup along side the whois details.

At the time we didn’t know how to pull this information and there was very limited details on it, so some research was required which resulted in a PageRank PHP script.

Over time, the resulting “pagerank.php” script became very popular and was developed further by fixing bugs and making it easier to use.

Now we wanted to show off our work in the form of a demo, so we launched a website…

We’ve had a demo of the PageRank Viewer online since 2010, but this week we’ve developed a whole new site along side entirely new code.

The original code we used was reverse engineered from the Internet Explorer toolbar, however it was much later that improved code based on the Google Toolbar for Mozilla Firefox surfaced.

The code from the Google Toolbar for Mozilla Firefox was interesting. By downloading the plugin “xpi” file, unzipping it and taking a look at the javascript you are able to see that Google regards PageRank quite highly or has sense of humour:

HASH_SEED_=”Mining PageRank is AGAINST GOOGLE’S TERMS OF SERVICE. Yes, I’m talking to you, scammer.”;

The simplicity of this code made it very easy to port over to any scripting language. So along side the launch of the all new PageRank Viewer website, we’re also shipping code in PHP, Python, Perl, TCL, C++ and D, all with the new code so you can write your own solution.

We bring this to you just in time too, there’s a perceived deprecation of PageRank after Google didn’t offer any official PageRank tool in their Google Chrome web browser.

PageRank was removed from webmaster tools, dismissed by a Google employee who said:

“it was silly to tell people not to think about it, but then to show them the data, implying that they should look at it”

– Susan Moskwa 14/10/2009

Although we agree with the point Google is trying to make, we felt there is still a lot of value on PageRank to webmasters.

For example, Google have made it very clear that having a reliable web hosting provider will help with ranking.

With that in mind, we decided to redevelop the PageRank Viewer and release new code to improve availability of PageRank lookups.

We welcome the all new PageRank Viewer to the family as a Phurix Labs project.

Enjoy!

]]>
https://hm2k.org/posts/pagerank-viewer-launch/feed 1 3142
Presenting Coinb.in https://hm2k.org/posts/presenting-coinb-in https://hm2k.org/posts/presenting-coinb-in#respond Wed, 27 Jul 2011 10:22:20 +0000 http://labs.phurix.net/?p=3070 Related posts:
  1. Tracking an IP address In my job I have to manage lots of machines...
  2. longip perl script I wanted to create a script that would convert a...
]]>
Bitcoin is a peer-to-peer cryto currency and we’ve been working on a free service for bitcoin users to help with accepting payments.

Coinb.in is what is known as a “Bitcoin eWallet Service” with an easily accessible API aimed at web developers, to allow the acceptance of bitcoins and to process the payments automatically and anonymously from our network via an unbranded interface, at no fee, without having to run a bitcoin client.

Coinb.in works by providing your customer with a unique wallet address, which is linked to your account. The coinb.in service then checks the Bitcoin p2p network at regular intervals. Once the payment has been confirmed, you will receive a notification by email and the transaction data will be sent to a script of your choice, which can then be used to process the order and populate your database.

There are a number of different ways to implement Coinb.in. The most simple and least complex way would be to implement a “buy it now” button, which does not require the user to register first.

For example, on a small project we run, called Gallush the following code could be added to a product page as a bitcoin “buy it now” button.

<script src="http://coinb.in/merchant.js"></script>
<script>
    var cb = {'uid':'2',
    'amount':'3.00',
    'fromcurrency':'USD',
    'description':'Starter shell. 1 month',
    'ref':'I10',
    'requestemail':1,
    'callback':'http://www.gallush.com/btc-payments.php'};
</script>
<a href="javascript:;" onClick="coinbin(cb);">Buy it now!</a>


Here’s an example: Buy it now!

The html and javascript above, would generate a link that would require no site registration because when it is clicked it will request that the visitor enters in their email address before they can continue, because of the &requestemail parameter being set.

Once the user has provided their email address, coinb.in will convert 3 USD to the equivalent value in bitcoins, and return this value plus an address to make a payment to.

The &description parameter  should contain a full description of the purchase and the &reference parameter in our example contains the item id (I10).

Once the user had made a payment, and it has been confirmed 6 times, all of the above data and additional transaction data is then sent to the callback URL provided so that it may populate the database and process the order accordingly.

Coinb.in comes complete with, examples, documentation and an API that can output the results into several different formats including XML and JSON objects

Now the question is, would you buy web hosting with bitcoins?

]]>
https://hm2k.org/posts/presenting-coinb-in/feed 0 3070
eggtcl project https://hm2k.org/posts/eggtcl-project https://hm2k.org/posts/eggtcl-project#respond Tue, 19 Jul 2011 23:12:38 +0000 http://www.hm2k.com/?p=3009 Related posts:
  1. HM2K’s code repository HM2K’s code repository is now open for business! This repository...
  2. weather.tcl Update: This script is now part of the eggtcl project....
  3. Universal Currency Converter TCL for Eggdrop Update: This script is now part of the eggtcl project. This...
  4. MSN via IRC Quite some time ago I decided that I wanted to...
]]>
I’m pleased to announce that the eggdrop TCL scripts from the HM2K code repository will become part of the eggtcl project.

The eggtcl project is a repository of approved TCL scripts for eggdrop that allow you to easily update them as new versions are released.

The plan is to maintain a library collection of good quality eggdrop tcl scripts to ensure the longevity of this project and the eggdrop project.

A dedicated team of highly skilled people will develop and approve only the best scripts for eggdrop.

The team:

  • FireEgl – notable for his Tcldrop
  • hrz – long serving #eggtcl EFnet channel op and script writer
  • Pixelz – eggdrop and Tcldrop contributor and script writer
  • simple – eggheads
  • thommey – eggheads and tclhelp.net
  • and of course HM2K

The project hopes to make poorly written eggdrop scripts a thing of the past and to become the official eggdrop tcl repository.

Check out the eggtcl project.

Looking to run your own Eggdrop? Try Gallush Shells.

]]>
https://hm2k.org/posts/eggtcl-project/feed 0 3009
Announcing Phurix Labs https://hm2k.org/posts/announcing-phurix-labs https://hm2k.org/posts/announcing-phurix-labs#respond Thu, 14 Jul 2011 23:06:31 +0000 http://www.hm2k.com/?p=3017 Related posts:
  1. PageRank Viewer Launch Back in 2007, we were developing code for our domain...
  2. Is Google PageRank dead? PageRank is dead, long live PageRank. As we said recently,...
  3. HM2K’s code repository HM2K’s code repository is now open for business! This repository...
  4. What is my IP? An IP address is a unique number which identifies a...
]]>
I’ve been thinking about retiring this site for some time now, but have been toying with the pros and cons.

A decision had to be made.

You see, the context of the HM2K blog has always had a subtle undertone of my business and the work I do online. That business is Phurix web hosting.

Phurix has always supported me and the blog, but unfortunately, because of other commitments I have less and less time to write and publish.

At first I thought the best solution would be to shut down the blog and call it a day, while a colleague said he thinks I should keep it online.

I’ve been thinking about a solution for a long time but then, while I was on holiday, it hit me.

Merge it into the Phurix brand and it made sense too:

  • HM2K.com was a hard concept to explain
    • Easier concept: Phurix Labs:”Where we experiment with ideas and findings”
  • HM2K.com had no context, it would often seem random
    • Makes more sense in the context of the business
  • HM2K.com had no real focus or agenda
    • Focus on what is important: the business
  • HM2K.com was a burden on one person
    • Shared with Phurix
  • HM2K.com was not making money
    • By improving brand awareness business will increase

A proposal was put forward and it went better than expected, it all seemed to fit together nicely. Perfect!

The decision was made and I have no regrets.

Today, we started by introducing a new “Phurix Labs” theme to HM2K.com, so that’s phase one is done.

Over the next few days, the website will be migrated from here to “labs.phurix.net” (where it now belongs). That’s phaze two.

Thanks for reading and I hope you continue to support the new Phurix Labs project.

These are exciting times, watch this space!

About Phurix

Since 2004, Phurix has offered affordable and reliable hosting services with a no nonsense approach. Phurix will continue to provide a high quality of service and engage with customers to ensure its future and growth.

Authorised cPanel Partner and OpenSRS partner.

About Phurix Labs

Phurix Labs is where we experiment with ideas and findings. You’ll find all sorts of useful tools and information.

]]>
https://hm2k.org/posts/announcing-phurix-labs/feed 0 3017
Converting your logo to ASCII art https://hm2k.org/posts/converting-your-logo-to-ascii-art https://hm2k.org/posts/converting-your-logo-to-ascii-art#respond Wed, 25 May 2011 12:11:25 +0000 http://www.hm2k.com/?p=2907 Related posts:
  1. email address on your website This is something that people don’t seem to realise, and...
  2. Storing mySQL database settings for php and perl in one file I have a situation where there’s two scripts. The main...
]]>
If you’re a geek like me or you’ve just  seen Iron Man 2 you’ll probably like the idea of having a custom motd display something cool when you login to your shell or terminal server.

Sure, you can use figlet to create a text banner, but how cool would it be if you could display your own logo instead. Right?

Can an image be converted into ASCII art?

Challenge accepted.

First of all, let’s get our logo image. We’re going to use the Gallush logo and to make it easier we’ll rehost the original image. Let’s go…

I started off by trying some online converts:

There’s a lot out there, which got me thinking…

What about software? Here’s the ASCII art converters I found:

What about scripts? There must be a PHP, Perl or Python script out there…

Then a brainwave, I want the image to fit a standard terminal screen (80 columns by 24 rows, according to putty’s default settings).

Since 1 pixel (usually) equates ASCII character, to make the ASCII art fit the screen I should resize the image from 128x128px to 24x24px.

Unfortunately at that size (24×24) it makes it almost impossible to work out what it’s meant to be, while at double the size (48×48) you can still make out all the defining features of the image. This is the resized image.

After doing this, my favourite so far was from “converthub.com”, which results in something a little like this which is exactly 24 lines so should fit your standard console screen.

So here it is:

So as you can see, you can make out the logo pretty clearly and it fits on the screen! Pretty cool huh?

Just need to render some text in figlet and use PabloDraw to combine the two, and you should end up with something like this:

Note: I used the “Rounded” font on the patorjk.com Text Ascii Art Generator.

Here’s what that looks like over PuTTY:

Kinda cool huh?

]]>
https://hm2k.org/posts/converting-your-logo-to-ascii-art/feed 0 2907