hunting for a random string

.. in a large (and completely undocumented) database, I’ve found the ways to get all tables that have a column name like ‘string’ and all rows that contain a string. A bit more optimized than my previous search&replace example.

select as tname, SCHEMA_NAME(schema_id) as sname, as cname
from sys.tables t join sys.columns c
on t.object_id=c.object_id
where like '%dns%'
order by sname, tname
EXEC SearchTables @Tablenames = '%',@SearchStr = 'host%'

Continue reading “hunting for a random string”

move a centos / scientificlinux install to a new drive

While dd / partimage might work just fine, these steps detail exactly what data is where and how it got to the disk during install. Assuming old=sda new=sdb

  1. fdisk -ucl /dev/sda, create identical ones on sdb, I’ll assume just a small ext4 sdb1 for boot and LVM sdb2 that fills the disk
  2. pvdisplay && pvcreate /dev/sdb2
  3. vgdisplay && vgcreate rootvg /dev/sdb2 -s 32M
  4. lvdisplay &&  lvcreate -L 300G -n rootlv rootvg
  5. mkfs.ext4 /dev/sdb1
  6. mkfs.ext4 /dev/mapper/rootvg-rootlv
  7. optional tune2fs -c 0 -i 0 /dev/mapper/rootvg-rootlv
  8. mount /dev/sdb1 newboot && mount /dev/mapper/rootvg-rootlv newroot
  9. rsync -aADHvxX /boot/ newboot/
  10. rsync -aADHvxX / newroot/
  11. rsync -aADHvxX /dev/ newroot/dev/
  12. blkid /dev/sdb1, write the UUID in newroot/etc/fstab
  13. mkswap /dev/mapper/rootvg-swaplv
  14. edit fstab
  15. edit newboot/boot/grub.conf
  16. mount –bind newboot/ newroot/boot
  17. mount –bind /dev/ newroot/dev
  18. mount -t proc none newroot/proc
  19. mount -t sysfs none newroot/sys
  20. chroot newroot
  21. echo -e “rootnoverify (hd1,0)\nsetup (hd1)” | grub –batch
  22. sync && poweroff

CPU throttling on an Acer Aspire 3000

When running the default (retail) XP SP3 OS, this laptop runs at full CPU speed, and becomes worryingly hot in the process. Since Acer’s e* Management package doesn’t seem to actually do anything, the solution so far is to:

  1. Download RMClock
  2. Keep only two profiles, 4.0@0.975V and 8.0@1.175V
  3. Set profile to “Performance on demand” and “Use PST”

If you don’t run with administrator privileges by default,

  1. Install AdmiLink (yes, it’s in Russian)
  2. Point it to the full path to RMClock.exe, ShowWindow -d10 SHOWDEFAULT, link in AutoStart folder, delay enough seconds for the shell to load

Enabling “legacy” VNC auth on the Mac

  1. You won’t need this if you connect with Apple’s client or with Jolly’s FastVNC. Most other clients though (tightvnc) require an initial password instead of presenting OS X’s login window.
  2. From a root prompt:
    1. Turn Screen Sharing off:
      sudo /System/Library/CoreServices/RemoteManagement/ -stop
    2. cat > /Library/Preferences/
      <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
      <plist version="1.0">
      <key>ARD_AllLocalUsers</key> <false/>
      <key>LoadRemoteManagementMenuExtra</key> <true/>
      <key>ScreenSharingReqPermEnabled</key> <true/>
      <key>VNCLegacyConnectionsEnabled</key> <true/>
    3. echo enabled >/Library/Preferences/
    4. Generate an encrypted password (actually it is not encrypted, only truncated to 8 characters and XORed with a fixed key):
      echo p4sv0rdd | perl -we 'BEGIN { @k = unpack "C*", pack "H*", "1734516E8BA8C5E2FF1C39567390ADCA"}; $_ = <>; chomp; s/^(.{8}).*/$1/; @p = unpack "C*", $_; foreach (@k) { printf "%02X", $_ ^ (shift @p || 0) }; print "\n"' | tee /Library/Preferences/
    5. Not sure why, but to start you must use stop again:
      sudo /System/Library/CoreServices/RemoteManagement/ -stop
      sudo /System/Library/CoreServices/RemoteManagement/ -activate -configure -access -on -users admin -privs -all -restart -agent

Referenced from here and here.

which java? (for applet security settings)

In Ubuntu:

update-alternatives --list java

the output should be something like

There are 2 choices for the alternative java (providing /usr/bin/java).
Selection    Path                       Priority   Status
* 0            /usr/bin/java-j2re1.6-ibm   1200      auto mode
  1            /usr/bin/java-j2re1.6-ibm   1200      manual mode
  2            /usr/bin/java-j2sdk1.6-ibm  1200      manual mode



and the file to edit is


File syntax is something like

grant codeBase "*" {

The Wikileaks scandal(s)

Media coverage and public interest in Julian Assange’s latest uncovering of a shitload of documents concerning the American-Afghan war seem to be way overblown, for what appears (after a cursory glance, there are more than 70 thousand of them) to be just accounting paperwork. Accounting of lost lives and destruction, but accounting nevertheless. America’s war is one of greed and petty interests, nothing glorious about it, nothing spectacular to reveal. To an outside observer, this might look like a careful mis-en-scène of a Hollywoodian spy flick, meant to create villains and heroes out of the dumb kids who went to fight in the desert and returned home covered in not just shame, but worse: instant oblivion. Nobody gives a fuck about them, they are in no way saviours of any country or ideal, there was no menace to defend their beloved homeland from to begin with, they were just sent out to collect on a protection tax that the Muslims stubbornly refuse to pay. I have noticed a single sane analysis of the deluge of documents, from Brendan O’Neill, an author who will go into my bookmarks tab: This is Truth as a religious-style revelation rather than Truth as the endpoint of thought, interrogation, question-asking, analysis. In reality, it is only through actively engaging with the world and its problems, through gathering facts and objectively analysing and organising them, that we can arrive at any Truth worth its name.

As for the sudden and chilling accusations that popped out immediately afterwards against Assange, the Guardian‘s dry humour is eloquent enough: It seems an unusual time to embark on a career of multiple rape.

Bad Behavior has blocked 78 access attempts in the last 7 days.