Category Archives: General

Twenty Eleven Theme Colour Palette

As a follow up to my previous post: WordPress 3.2 Admin Colour Palette I was asked if I could do a Twenty Eleven version. See the previous post for the script used.

Standard “Light” colour scheme

#e5e5e5
#000000
#f7f7f7
#efefef
#444444
#0a0a0a
#ffffff
#555555
#aaaaaa
#d3d3d3
#575757
#f6f6f6
#999999
#777777
#3c3c3c
#252525
#f9f9f9
#666666
#222222
#cccccc
#e2e2e2
#dddddd
#373737
#fafafa
#f4f4f4
#eeeeee
#bbbbbb
#111111
#888888
#7a7a7a
#e0e6e8
#bfddf3
#fff9c0
#29628d
#ff4b33
#1982d1
#0861a5
#bd3500

Alternate “Dark” theme

Just a note here, Due to TwentyEleven’s structure, some of the colours in the above light theme will be used as part of this colour scheme, this is just for visual information purposes.

#282828
#888888
#060606
#444444
#000000
#2c2c2c
#aaaaaa
#555555
#090909
#a8a8a8
#959595
#c3c3c3
#777777
#111111
#1d1d1d
#242424
#0b0b0b
#ffffff
#999999
#333333
#bbbbbb
#0f0f0f
#dddddd
#222222
#383838
#272727
#cccccc
#0a0a0a
#858585
#eeeeee
#42caff
#40220c
#00b4cc
#00063f

Opera IRC Auto-reconnect

So, we all love using Opera as our browser, right? How many of you use IRC in Opera too? *cricket chirping*

Ok, Well, I do, and unfortunately Opera doesn’t support IRC auto-reconnection, this is rather annoying when you consider that hibernating the laptop will cause IRC to disconnect, and it doesn’t re-connect upon resuming windows.

“Simple, Just click Connect every time you resume!” yes well, I forget and can often not be on IRC for hours because of that.

So a solution. Add the IRC server to your speed dial! 

That might sound a bit strange, but it works, Simply add irc://irc.freenode.net/ (or your favourite IRC server) to your speed dial, sure enough, when you open a new tab next time you use Opera, the icon will refresh, the refresh triggers a re-connect if there isn’t already a connection! (Make sure you also have the channels you use in your connections outgoing-commands section)

It’s not perfect, but it’s doing the job for me :)

WordPress 3.2 Admin Colour Palette

So a ticket popped up on trac, mentioning the Gray colour scheme example colours were out of date, gave me a quick idea to make a script to make a colour palette of the colour schemes (ie. All colours used in the colour css file), so here we have it:

Fresh – Gray

#e9e9e9
#f5f5f5
#c3c3c3
#ededed
#909090
#a0a0a0
#ffffff
#d7d7d7
#f2f2f2
#dadada
#aaaaaa
#ebebeb
#555555
#b2b2b2
#888888
#e7e7e7
#c0c0c0
#606060
#d5d5d5
#fbfbfb
#c1c1c1
#d3d3d3
#e3e3e3
#e5e5e5
#444444
#cfcfcf
#e1e1e1
#6d6d6d
#bbbbbb
#f4f4f4
#666666
#dddddd
#e8e8e8
#9a9a9a
#fcfcfc
#000000
#ececec
#101010
#f9f9f9
#222222
#808080
#cccccc
#f1f1f1
#dfdfdf
#eeeeee
#eaeaea
#464646
#333333
#777777
#999999
#ebeaeb
#f0f6fb
#eaf2fa
#eaf3fa
#ededff
#ffebe8
#e4f2fd
#fffbe4
#ffffe0
#b6bdd2
#ddffdd
#ffdddd
#cfe1ef
#cee1ef
#ccf3fa
#b8d3e2
#fffbcc
#f0f0b8
#9fd0d5
#9999dd
#ffa0a0
#ff9999
#99ff99
#557799
#ffb78c
#ffec8b
#c3ff88
#ff6666
#264761
#e6db55
#448abd
#f04040
#cc4433
#ff853c
#298cba
#21759b
#13455b
#d54e21
#8dff1c
#0a246a
#bc0b0b
#0000ff
#ffcc00
#cc0000
#dd0000
#006505
#d98500
#ff0000

Classic – Blue

#e9e9e9
#606060
#aaaaaa
#ebebeb
#f2f2f2
#464646
#dddddd
#e8e8e8
#9a9a9a
#dadada
#e5e5e5
#444444
#b2b2b2
#c9c9c9
#f5f5f5
#c3c3c3
#f4f4f4
#fcfcfc
#888888
#555555
#d7d7d7
#ffffff
#101010
#bbbbbb
#d5d5d5
#e7e7e7
#000000
#666666
#222222
#cccccc
#c1c1c1
#f9f9f9
#808080
#333333
#eaeaea
#dfdfdf
#777777
#999999
#eeeeee
#c0c0c0
#f1f1f1
#d3d3d3
#ebeaeb
#f7fcfe
#f5fafd
#efede7
#f0f6fb
#eff8ff
#eaf3fa
#eaf2fa
#ededff
#ecf8fe
#ffebe8
#e4f2fd
#fffbe4
#d0dfe9
#cfdfe9
#bdccd5
#ffffe0
#d1e5ee
#b6bdd2
#ffdddd
#ddffdd
#cfe1ef
#cee1ef
#bed1dd
#b0c8d7
#ccf3fa
#b8d3e2
#fffbcc
#f0f0b8
#a0c3d5
#9fd0d5
#9999dd
#ffa0a0
#99ff99
#ff9999
#557799
#ffb78c
#ffec8b
#c3ff88
#5a8fad
#5589aa
#ff6666
#264761
#e6db55
#448abd
#f04040
#cc4433
#ff853c
#185069
#298cba
#174f69
#21759b
#13455b
#d54e21
#8dff1c
#0a246a
#bc0b0b
#ff0000
#ffcc00
#cc0000
#d98500
#dd0000
#0000ff
#006505

Script used

[php]
<?php
$file = ABSPATH . ‘wp-admin\\css\\colors-classic.dev.css';
$file = escapeshellarg($file );

$in = shell_exec("grep -i -o -e #[0-9a-f]\\{3,6\\}\\b $file | uniq -i");

$in = str_replace(array(‘:’, ‘#’, ‘ ‘), ”, $in);

$in = explode("\n", $in);
$in = array_filter($in);

foreach ( $in as $i => $v ) {
if ( strlen($v) == 3 )
$in[$i] = $v[0] . $v[0] . $v[1] . $v[1] . $v[2] . $v[2];
}

$out = array();
foreach ( $in as $rgb ) {
$r = hexdec( substr($rgb, 0, 2) );
$g = hexdec( substr($rgb, 2, 2) );
$b = hexdec( substr($rgb, 4, 2) );
$hsl = rgb2hsl($r, $g, $b); // we’ll sort it by the Saturation
$out[ strtolower($rgb) ] = $hsl;
}

uasort($out, function($a, $b) {
return $a[1] > $b[1];
});

foreach ( $out as $c => $hsl ) {
$f = ($hsl[2] > 0.6 ) ? ‘000’ : ‘fff';
echo "<div style=’background-color: #$c; color:#$f; width: 80px; height: 40px; display: inline-block;’>#$c</div>";
}

foreach ( $out as $c => $hsl ) {
$f = ($hsl[2] > 0.6 ) ? ‘000’ : ‘fff';
echo htmlentities("<div style=’background-color: #$c; color:#$f; width: 80px; height: 40px; display: inline-block;’>#$c</div>") . ‘<br />';
}

function rgb2hsl($r, $g, $b) {
$var_R = ($r / 255);
$var_G = ($g / 255);
$var_B = ($b / 255);

$var_Min = min($var_R, $var_G, $var_B);
$var_Max = max($var_R, $var_G, $var_B);
$del_Max = $var_Max – $var_Min;

$v = $var_Max;

if ($del_Max == 0) {
$h = 0;
$s = 0;
} else {
$s = $del_Max / $var_Max;

$del_R = ( ( ( $var_Max – $var_R ) / 6 ) + ( $del_Max / 2 ) ) / $del_Max;
$del_G = ( ( ( $var_Max – $var_G ) / 6 ) + ( $del_Max / 2 ) ) / $del_Max;
$del_B = ( ( ( $var_Max – $var_B ) / 6 ) + ( $del_Max / 2 ) ) / $del_Max;

if ($var_R == $var_Max) $h = $del_B – $del_G;
else if ($var_G == $var_Max) $h = ( 1 / 3 ) + $del_R – $del_B;
else if ($var_B == $var_Max) $h = ( 2 / 3 ) + $del_G – $del_R;

if ($h < 0) $h++;
if ($h > 1) $h–;
}

return array($h, $s, $v);
}
?>
[/php]

This post was edited to correct a few things, including sorting by the saturation of the colour rather than alphabetically.

World IPv6 Day

So I’m a bit late to the party, but who cares in the end.

As of today, well, 15minutes ago, This hostname is IPv6 enabled.

C:\Users\DD32>tracert -6 dd32.id.au

Tracing route to dd32.id.au [2402:9400:1000:2::8e]
over a maximum of 30 hops:

1 53 ms 51 ms 52 ms 2001:44b8:61::220
2 52 ms 258 ms 265 ms vl67.cor1.adl6.internode.on.net [2001:44b8:8060:8000::1]
3 51 ms * 50 ms gi5-3.bdr1.adl6.internode.on.net [2001:44b8:8060:12::1]
4 51 ms 51 ms 51 ms vocus.ipv6.adelaide.pipenetworks.com [2001:7fa:c::3]
5 73 ms 74 ms 74 ms ge-0-1-3.cor02.syd03.nsw.VOCUS.net.au [2402:7800:0:1::55]
6 75 ms 73 ms 73 ms 2001:44b8:b060:4::4826:1
7 74 ms 74 ms 74 ms 2402:7800:0:3::6
8 73 ms 75 ms 86 ms 2402:9400:1000:2::8e

What does it mean to most of you? Absolutely nothing, to the rest of you? Well, It shows that I’m a computer geek :)

Resources:
World IPV6 day: http://www.worldipv6day.org/
Am I using IPv6?: http://test-ipv6.com/

svn blame output format

>svn blame http://core.svn.wordpress.org/trunk/license.txt@HEAD
  7131       ryan                   GNU GENERAL PUBLIC LICENSE
  7131       ryan                      Version 2, June 1991
  7131       ryan
 10085       matt  Copyright (C) 1989, 1991 Free Software Foundation, Inc.
 15668     scribu  51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 10085       matt
  7131       ryan  Everyone is permitted to copy and distribute verbatim copies
  7131       ryan  of this license document, but changing it is not allowed.
  7131       ryan

So, Most of have seen that, and a few of us have had a need to parse it now and then.. Googling for an answer never seems to bring up a reasonable answer either.. So here you have it, an explanation of the output format of SVN Blame.

Honestly, It’s quite simple, it’s just fixed width columns, with a twist, by default the columns are 6 characters wide, but will expand to fit the largest revision ID, or the longest commitors username. The author’s field is followed by a single space, and then, the line data.

Why go to the trouble of this? Well, It comes back to the fact that although it looked like fixed width.. it couldn’t just be fixed width.. and what rules are behind it? I checked the source of svn blame and this comment was what I wanted to know how the fixed width was selected:

  /* The standard column width for the revision number is 6 characters.
     If the revision number can potentially be larger (i.e. if the end_revnum
     is larger than 1000000), we increase the column width as needed. */

Updated Regular expression: (Original had a bug where it didn’t handle empty lines in the file)

preg_match_all('!^\s*(?P<revision>\d+)\s+(?P<author>.+?)( (?P<data>.*))?$!m',
 $output_from_svn_blame$matchesPREG_SET_ORDER);

Example output:

array
 0 =>
 array
 'revision' => string '7131' (length=4)
 'author' => string 'ryan' (length=4)
 'data' => string ' Version 2, June 1991' (length=41)
 1 =>
 array
 'revision' => string '7131' (length=4)
 'author' => string 'ryan' (length=4)
 'data' => string '' (length=0)
 2 =>
 array
 'revision' => string '10085' (length=4)
 'author' => string 'matt' (length=4)
 'data' => string ' Copyright (C) 1989, 1991 Free Software Foundation, Inc.' (length=56)

It’s probably not the most efficient, but it does the job for what I needed for now. Also note, I’ve removed the numeric keys from the example output there (preg_match returns both named and numeric results in the array set)



Disable plugin update notification for a specific plugin in WordPress 3.1

Just  quick sniplet of code to drop into a plugin file to disable plugin update notifications.

The reason i’ve written this is a plugin which has been heavily modified has a update, and, wanted to stop hearing about it; Sure, I could’ve just changed the name, but this felt more Politically Correct (and isn’t that what we’re all supposed to do!?)

So, The code:

add_filter('site_transient_update_plugins', 'dd_remove_update_nag');
function dd_remove_update_nag($value) {
 unset($value->response[ plugin_basename(__FILE__) ]);
 return $value;
}

Have fun, and happy Hacking!

1 week into the month…

..and the bots are going crazy:
-bash-3.2# cat /var/log/secure | grep "Failed password" | wc -l
72595

72 thousand invalid password attempts (most of those are against root, although theres a lot for <random 5 character usernames>).

Thats 10,000 a day, about one every 10 seconds..