Monday, July 26, 2010

FreeBSD: Unable to find device node for dev /dev/ar0s1b in /dev

Problem:
Sysinstall can't continue and stops with the error, "unable to find device node for dev /dev/ar0s1b in /dev".

Solution:
Remove the existing partition table by writing zeros at the start of the disk:
dd if=/dev/zero of=/dev/ar0 bs=64k count=1
(replace as necessary, e.g., ad0)

Saturday, July 17, 2010

Apache: Restricting folders by IP addresses

1st Problem:
You are running an Apache server. You need to restrict access to certain folders by IP addresses.

Solution to 1st problem:
Use .htacess to deny all access to that folder, then allow certain hosts/IP addresses.

AuthName "simoncpu's dark secret"
AuthType Basic

<Limit GET POST>
order deny,allow
deny from all
allow from 10.0.0.
allow from .example.org
allow from this.is.an.example.invalid
</Limit>

2nd Problem:
Your Apache is behind a proxy such as nginx. All requests to your Apache server appear to originate from your proxy.

Solution to 2nd problem:
Install mod_rpaf and restart your web server. .htaccess will now correctly restrict access to your folders.  Refer to its web page for installation instructions.

Sunday, July 04, 2010

Youtube comment hack

As of July 4, 2010, 9:30PM +8GMT, this Youtube comment hack works:
<script>IF_HTML_FUNCTION?<h1><div style="background-color:#00000<wbr>0; position: absolute; top: 0; left: 0; font-size: 100px; color: red">simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu simoncpu  <script>


Update: As of July 5, 2010, 2:40PM +8GMT, this hack no longer works.