Category: Uncategorized

  • wget & mod_gzip

    wget & curl are very good command line tools to test and pretend to be any browser. Here I’m testing Google webservers and support for content compression. # pretend to be Firefox 1.5 wget –server-response –user-agent “Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5″ –header=”Accept-Encoding: gzip, deflate” http://www.google.com # pretend to be IE6…

  • JavaScript compression with Dojo Rhino

    http://dojotoolkit.org/~alex/js_with_compress.jar This is a modified version of Rhino (the Mozilla JS interpreter written in Java). We (the Dojo project) have added a “compressor” method to the built-in Decompile class. Since we’re operating on the token stream from the parser, this system is somewhat less prone to errors and “overzealousness”. A new “-c” flag sends the…

  • mod_gzip/mod_deflate, JavaScript & IE problem

    Description: They are not a very good combination as problems have been reported in different applications with JavaScript not loading when served with mod_gzip/mod_deflate on. The error is not deterministic and cannot guarantee 100% error replication but it happens frequent enough. Affected: The problem only occurs in Internet Explorer (6 and probably lower versions) and…

  • Masters of their Domains

    Forget condos and strip malls. Domain names, the real estate of the Web, have been delivering far greater returns. How some of the savviest speculators on the Net are making millions from their URL portfolios. read more | digg story

  • Opera & page body margin

    body { margin: 0px; } In IE & Firefox there will be no margin for the page. In Opera there is still the spacing. Why? Because Opera has in its default styles, just as the CSS2 specification suggests (see appendix A) body { margin: 0px; padding: 8px; } To have no spacing between page body…

  • HOWTO: clear bash history?

    [root@ ~]# history -c

  • Get CPU information

    $make = exec(“cat /proc/cpuinfo|grep ‘model name’|cut -d : -f 2|cut -c 2-“); $speed = exec(“cat /proc/cpuinfo|grep MHz|cut -d : -f 2|cut -c 2-“); $count = exec(“grep processor /proc/cpuinfo|wc|awk ‘{print $1}’”); $hyperthreaded = exec(“grep flags /proc/cpuinfo|grep ‘ ht’”); Sample Output: Make: AMD Opteron(tm) Processor 244 Speed: 1792.558 Count: 2 Hyperthreaded: No

  • View & sort existing RPM packages

    rpm -qa –qf ‘%{SIZE} %{NAME}\n’ | sort -nr | less Sample Output: 186925230 kernel-source 184937329 kernel-source 74392320 rpmdb-redhat 44488420 emacs 42509842 glibc-common 41262406 libstdc++-ssa-devel 31483893 frontpage 27851009 perl 25825586 comps 23352847 kernel 23219902 libgcj-ssa-devel 22570875 kernel 21628214 rpm-devel 21543354 kernel-smp 20757085 kernel-smp 18808196 gcc-gnat 17833551 MySQL-server 17596278 ant-libs

  • wget, login & cookie

    If you need to sign into a site and download a file automatically with wget, here is a shell script for that: #!/bin/sh COOKIE_FILE=cookie.txt LOGIN_URL=”http://example.com/login?username=xxxx&password=xxxx” login() { echo “Signing in….” wget –save-cookie cookie.txt $LOGIN_URL return } print_usage() { echo “Usage: $0 [URL]” return } if [ $# -eq 0 ] ; then print_usage exit 1…

  • phpESP 1.8 – Poll/Survey Script – DB Design

    — # table of different surveys available CREATE TABLE survey ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, name CHAR(64) NOT NULL, owner CHAR(16) NOT NULL, realm CHAR(64) NOT NULL, public ENUM(‘Y’,’N’) NOT NULL DEFAULT ‘Y’, status INT UNSIGNED NOT NULL DEFAULT ‘0’, title CHAR(255) NOT NULL, email CHAR(64), subtitle TEXT, info TEXT, theme CHAR(64), thanks_page…