Skip to content

Instantly share code, notes, and snippets.

@4lun
Created December 7, 2015 16:28
Show Gist options
  • Save 4lun/48dcc76418da4658b758 to your computer and use it in GitHub Desktop.
Save 4lun/48dcc76418da4658b758 to your computer and use it in GitHub Desktop.
Simple script to help demo load balancing.
<?php
$id = sha1(getenv('HOSTNAME'));
function rgbcode($id){
return '#'.substr(md5($id), 0, 6);
}
?><html>
<style>
body { padding: 30px; background-color: <?php echo rgbcode($id); ?>; font-family: sans-serif; }
h1 { background: #000; color: #fff; margin: 0; padding: 5px; float: left; }
</style>
<h1><?php echo $id; ?></h1>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment