Author Archive
Installing PHP and Apache module under /home
by CyberShadow on Jan.25, 2013, under Random
Let’s say you have your own Apache 2 setup in your home directory, and you want to build and install PHP as well, and set it up as an Apache module without root privileges (e.g. if you want to use a different PHP version than the one installed globally).
You may run into problems such as PHP’s configure script not detecting apxs2 (and thus not building an Apache module). (continue reading…)
Very Sleepy fork
by CyberShadow on Jan.11, 2013, under Code
I got fed up with waiting/pestering Richard Mitton (aka Kayamon / @grumpygiant) to integrate the Very Sleepy patches I’ve sent him last year or putting the code on a software forge, so I’m publishing my patches on GitHub myself.
Very Sleepy is a polling Windows profiler with a wxWidgets-based GUI. This is a fork of the latest released version at the time of writing (0.82).
There have been a few more forks of Very Sleepy (e.g. here and here), but these are based off older versions. It’s possible that their changes had already been merged into the official version.
My improvements over the official version:
- Fix several issues with the /r command-line option
- Lower profiler thread priority when sampling ends (greatly improves UI responsiveness during analysis of collected data)
- Add cancelable symbol query progress (existing dialog was always at 0% and was not cancelable)
- Don’t go through symbol lookup if sampling was aborted (abort means abort)
- More minor UI improvements
- Don’t completely abort due to one failed GetThreadContext call (fixes “Error: ProfilerExcep: GetThreadContext failed.” errors by ignoring the occasional seemingly-harmless error condition)
DHCP test client
by CyberShadow on Jan.10, 2013, under Code
While trying to set up my home network, I was dismayed that there was no simple way to test the DHCP server. Snooping packets is limited to examining existing traffic.
DHCP test tools exist (DHCPing and dhquery), however both are outdated and don’t work with the latest versions of their requirements, and both won’t work on Windows.
I’ve written a simple DHCP “client” which can receive and decode broadcasted DHCP replies, as well as send out DHCP “discover” packets.
64-bit CacheSet
by CyberShadow on Dec.14, 2012, under Code
SysInternals CacheSet has a limitation: it is unable to set a cache size larger than 4GB. This is due to the fact that it is a 32-bit application, and the respective API (NtSetSystemInformation) accepts new settings as a 32-bit byte count.
The solution: use the 64-bit API, which uses 64-bit integers. I’ve written a very simple 64-bit CacheSet-alike – just enter the desired cache size (in bytes). You can use the original CacheSet to check the new settings (just don’t hit “Apply”, or your settings might get clobbered).
SSD TRIM check tool
by CyberShadow on Dec.09, 2012, under Code
8 Comments :D, open-source, storage, tools, Windows more...Fixing DirectMusic on some 64-bit Windows versions
by CyberShadow on Jul.14, 2011, under Random
If you’re getting error messages such as “No sound device detected. Sounds might not play.” or “Failed to create Direct Music Performance.” when running Game Maker games, the following may help you. Here’s what I did to fix them on my system:
- Download the DirectX redistributable
- Unpack it
- Unpack dxnt.cab
- In dmusic.inf, search and replace “HKCR,” with “HKCR,Wow6432Node\”
- Install the edited dmusic.inf (from the right-click menu)
- Copy missing DLLs (dm*.dll) to %WINDIR%/SysWOW64.
That’s it! The same method could work for other DirectX components as well.
Referrer spam
by CyberShadow on Feb.04, 2011, under Website
I got tired of pesky referrer spambots junking up my logs, so I decided to find a way to get rid of them. Turns out, almost all referrer spam on my blog is generated with a small number of User-Agents:
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; Media Center PC 6.0; InfoPath.2; MS-RTC LM 8)
Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.2 (KHTML, like Gecko) Chrome/4.0.221.7 Safari/532.2
Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 8.50
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Opera/9.64(Windows NT 5.1; U; en) Presto/2.1.1
Mozilla/5.0 (X11; U; Linux i686; it-IT; rv:1.9.0.2) Gecko/2008092313 Ubuntu/9.25 (jaunty) Firefox/3.8
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.14) Gecko/2009082707 Firefox/3.0.14 (.NET CLR 3.5.30729)
All of these refer to outdated browsers, very rare configurations (the ones with non-English language codes), and genuinely fake UA strings.
Programmatically print SWF
by CyberShadow on Jan.17, 2011, under Code
I was looking for a way to programmatically print a SWF file. The stand-alone Flash player has an option to print a SWF, however there is no shell action registered for it.
After looking around a bit, I found that probably the easiest way is to use the ActionScript PrintJob API: (continue reading…)
Wolfram|Alpha IRC script
by CyberShadow on Jan.02, 2011, under Code
If you’re hanging out on the same GameSurge channel(s) as me, you probably know about Byte‘s tehh6x bot. I’ve recently added a Wolfram|Alpha command to it, allowing it to query W|A and return the results in a somewhat IRC-compatible format. Here’s the code:
(continue reading…)
Wikipedia Watchlist RSS
by CyberShadow on Jan.02, 2011, under Code
Wikipedia’s Watchlist has a RSS feed, which is a nice way to keep track changes on your watched articles. However, the RSS feed doesn’t seem to conform to the RSS standard, and confuses some feedreaders – notably, Opera M2.
Here’s a simple PHP script, which you can place on your website, that’ll fix the RSS feed. You’ll need to give it the URL to your RSS feed (which you can get by subscribing to your watchlist), since it contains your secret API key.
<?php
$rss_url = 'http://en.wikipedia.org/w/api.php'
. '?action=feedwatchlist'
. '&allrev=allrev'
. '&hours=72'
. '&wlowner=YOUR_USERNAME_HERE'
. '&wltoken=YOUR_API_KEY_HERE'
. '&feedformat=rss';
$feed = `wget -q -O - '$rss_url'`;
$rows = explode("\n", $feed);
header('Content-type: application/rss+xml');
foreach ($rows as $row)
{
if (strpos($row, '<item>')!==false)
$alldata = '';
if (strpos($row, '<guid>')!==false)
continue;
$alldata .= $row;
if (strpos($row, '</item>')!==false)
$row = '<guid isPermaLink="false">'
. md5($alldata)
. "</guid>\n"
. $row;
echo $row . "\n";
}