Hawkee snippets stats

Platform:  mIRC
Published  Apr 15, 2012
Updated  Apr 16, 2012
With this script you can see how much snippets there are on hawkee.
I haven't found this script or a look-a-like. And its very useful (for some of us...)

Example
<Aha2Y> !hawkee snippets
<Bot> .Net: 20 :: Applescript: 2 :: Autohotkey: 2 :: AutoIt: 1 :: Bash: 9 :: Byond: 5 :: C++: 45 :: Cold Fushion: 1 :: CSS: 6 :: Hi5: 1 :: Ipad: 1 :: Iphone: 3 :: Java: 21 :: JavaScript: 33 :: jQuery: 1 :: mIRC: 7,442 :: mySQL: 2 :: OpenSocial: 2 :: Perl: 39 :: PHP: 209 :: Python: 32 :: Ruby: 6 :: TCL: 62 :: VisualBasic 5 on *:text:$($iif(!hawkee snippets = $strip($1),$1)):#:{
set %hawkee.static.channel $chan
sockClose hstatsnippets
sockOpen hstatsnippets www.hawkee.com 80
}
on *:SockOpen:hstatsnippets: {
sockwrite -nt hstatsnippets GET /snippets/ HTTP/1.0
sockwrite -nt hstatsnippets Host: www.hawkee.com
sockwrite -nt hstatsnippets $crlf
}
on *:SockRead:hstatsnippets:{
var %read
sockread %read
if ($regex(%read,/(.+) \050(\d+|\d+,\d+)\051/)) {
if (*.NET* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.dotnet $remove($2,$chr(40),$chr(41))
}
if (*AppleScript* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.applescript $remove($2,$chr(40),$chr(41))
}
if (*AutoHotkey* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.autohotkey $remove($2,$chr(40),$chr(41))
}
if (*AutoIt* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.autoit $remove($2,$chr(40),$chr(41))
}
if (*Bash Shell* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.bash $remove($3,$chr(40),$chr(41))
}
if (*BYOND* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.byond $remove($2,$chr(40),$chr(41))
}
if (*C++* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.c++ $remove($2,$chr(40),$chr(41))
}
if (*Cold Fusion* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.cfush $remove($3,$chr(40),$chr(41))
}
if (*CSS* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.css $remove($2,$chr(40),$chr(41))
}
if (*Hi5* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.hi5 $remove($2,$chr(40),$chr(41))
}
if (*iPad* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.ipad $remove($2,$chr(40),$chr(41))
}
if (*<iPhone* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.iphone $remove($2,$chr(40),$chr(41))
}
if (*Java* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.java $remove($2,$chr(40),$chr(41))
}
if (*Javascript* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.javascript $remove($2,$chr(40),$chr(41))
}
if (*jQuery* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.jquery $remove($2,$chr(40),$chr(41))
}
if (*mIRC* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.mirc $remove($2,$chr(40),$chr(41))
}
if (*mySQL* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.mysql $remove($2,$chr(40),$chr(41))
}
if (*OpenSocial* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.opensocial $remove($2,$chr(40),$chr(41))
}
if (*Perl* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.perl $remove($2,$chr(40),$chr(41))
}
if (*PHP* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.php $remove($2,$chr(40),$chr(41))
}
if (*Python* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.python $remove($2,$chr(40),$chr(41))
}
if (*Ruby / Rails* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.ruby $remove($4,$chr(40),$chr(41))
}
if (*TCL* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.tcl $remove($2,$chr(40),$chr(41))
}
if (*Visual Basic* iswm %read) {
tokenize 32 $noHTML(%read)
set %hawkee.static.visualbasic $remove($3,$chr(40),$chr(41))
msg %hawkee.static.channel .Net: %hawkee.static.dotnet 3:: Applescript: %hawkee.static.applescript 3:: Autohotkey: %hawkee.static.autohotkey 3:: AutoIt: %hawkee.static.autoit 3:: Bash: %hawkee.static.bash 3:: Byond: %hawkee.static.byond 3:: C++: %hawkee.static.c++ 3:: Cold Fushion: %hawkee.static.cfush 3:: CSS: %hawkee.static.css 3:: Hi5: %hawkee.static.hi5 3:: Ipad: %hawkee.static.ipad 3:: Iphone: %hawkee.static.iphone 3:: Java: %java 3:: JavaScript: %hawkee.static.javascript 3:: jQuery: %hawkee.static.jquery 3:: mIRC: %hawkee.static.mirc 3:: mySQL: %hawkee.static.mysql 3:: OpenSocial: %hawkee.static.opensocial 3:: Perl: %hawkee.static.perl 3:: PHP: %hawkee.static.php 3:: Python: %hawkee.static.python 3:: Ruby: %hawkee.static.ruby 3:: TCL: %hawkee.static.tcl 3:: VisualBasic %hawkee.static.visualbasic
unset %hawkee.static.*
sockclose hstatsnippets
}
}
}
alias noHTML return $regsubex($1, /<[^>]+(?:>|$)|^[^<>]+>/g, $null)

Comments

Sign in to comment.
Aha2Y   -  Apr 16, 2012
@hawkee @Jethro I updated the script. :)
Only thing i want to change now is the

Code

 

But i haven't found a solution for it..
 Respond  
Jethro   -  Apr 15, 2012
Yeah, actually you didn't have to match HTML as Hawkee has pointed out. You can match the pattern, which should always show up as:

snippet1 (40)
snippet2 (2)
snippet3 (89)
...
.....

Then you apply regex to match them and aim for the names of snippet and their statistics. The example below will show both the stats for scripts and snippets:

Code

 

Quote

AppleScript 1
C++ 2
iPhone 1
Java 4
mIRC 334
Perl 3
PHP 10
Python 1
Windows 1
.NET 20
AppleScript 2
AutoHotkey 2
AutoIt 1
Bash Shell 9
BYOND 5
C++ 45
Cold Fusion 1
CSS 6
Hi5 1
iPad 1
iPhone 3
Java 21
Javascript 33
jQuery 1
mIRC 7,444
mySQL 2
OpenSocial 2
Perl 39
PHP 209
Python 32
Ruby / Rails 6
....
......
Then finally you can do the parsing yourself and make it pretty with colors and its display horizontally.
 Respond  
ulquiorra4   -  Apr 15, 2012
wow....
 Respond  
Hawkee   -  Apr 15, 2012
You shouldn't match the HTML so closely as it's likely to change in the very near future. It would be better to match against the DOM tree rather than strings. I don't know if somebody made an mIRC DOM parser, but it would be much better to use that method.
 Respond  
fraguk   -  Apr 15, 2012
Good work Aha2Y , keep it up mate :)
 Respond  
Jethro   -  Apr 15, 2012
You can save many bytes and repetitions by using regex:

Code

 
But then I have to praise you for the hard work you took and time you spent on this script.
 Respond  
SunnyD   -  Apr 15, 2012
Small typo on the "Loading Snippets..." output message.
 Respond  
Lenooox   -  Apr 15, 2012
w00t Script Stats script , awesome mate !! nice nice :) :)
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.