DeutschEspañolFrançaisItalianoNederlandsPortuguêsΕλληνικάРусскийالعربية中文(简体)中文(繁體)日本語한국어
 
Donate Bitcoins
Google
 
www smithii.com
 

Blogs

Accessing KDE desktop via VNC

I wanted to be able to connect to my Linux system's boot up screen remotely using VNC.

To do that, I needed to install x11vnc. Since I'm running Kubuntu, the KDE version of Ubuntu, I simply typed:

$ sudo apt-get install x11vnc

After poking around I found the xauth file in /var/run/xauth, so to start x11vnc, I typed

$ XAUTH=`ls -t /var/run/xauth/* | head -n 1`
$ nohup x11vnc -display :0 -auth $XAUTH &

Since x11vnc complains there is no password, I could have instead used:

$ XAUTH=`ls -t /var/run/xauth/* | head -n 1`
$ nohup x11vnc -passwd insert_password_here -display :0 -auth $XAUTH &

I tried:

$ XAUTH=`ls -t /var/run/xauth/* | head -n 1`
$ x11vnc -usepw -display :0 -auth $XAUTH

and even

$ x11vnc -storepasswd insert_password_here $HOME/.vnc/passwd
$ XAUTH=`ls -t /var/run/xauth/* | head -n 1`
$ x11vnc -passwdfile $HOME/.vnc/passwd -display :0 -auth $XAUTH

but couldn't get either to work.

When I was done with this VNC instance, I removed it from memory via:

$ killall x11vnc

This doesn't kill the actual desktop, just the x11vnc instance in memory.

To create a new virtual KDE desktop, I installed vnc4server via:

$ sudo apt-get install vnc4server

and then created the desktop with:

$ vnc4server -geometry 1024x768 -depth 24 :1

For -geometry, I can effectively use any values I want, but I generally use smaller values, as a larger desktop takes longer to repaint.

For -depth I usually use 24, or 32.

When I was done with this desktop, I removed it from memory via:

$ vnc4server -kill :1

nirsoft_installer 1.35 has been released (announcement)

nirsoft_installer 1.35 has been released. Details at http://smithii.com/nirsoft_installer.

This seemingly duplicate entry has been created as some RSS readers, such as Google Reader, do not display updates to existing blog entries, even if the update date was changed. This entry will be deleted in a week or so. Therefore, please do not post comments to this entry. Post them to the above URL instead. Thanks!

nirsoft_installer 1.35 has been released (announcement)

aria2 1.3.3 for Windows has been released (updated 12-May-09)

aria2 is a download utility with resuming and segmented downloading.

Using the makefile aria2.mak, I successfully ported aria2 to Windows using the Debian MinGW cross-compiler. While aria2 compiles under native MinGW and Cygwin, the resultant executable was buggy using the supplied gcc version 3.4.5, and numerous unit tests fail.

After installing gcc 4.3.0 in MinGW using get_mingw.cmd and am now able to produce working binaries in my Windows environment. This leads me to believe that gcc 3.4.5 is not reliable under MinGW.

The latest MinGW binary, and source code is available at https://sourceforge.net/projects/aria2/files/.

Automatically Slipstream Windows XP with SP3 and All Post-SP3 Security Hotfixes with a Single Command (Updated 03-May-09)

For information about slipstreaming Windows XP SP2, visit http://smithii.com/slipstream_xpsp2.

I've written the batch file xpsp3.cmd (updated 03-May-09) to automatically download and slipstream a standard Windows XP boot disk with Service Pack 2 and all post-SP3 security hotfixes.

It uses wget or curl (if either are found in the PATH), or your installed browser to download the updates. I have tested this with Internet Explorer, Firefox, and Opera. Other browsers should work, as well.

The batch file xpsp3local.cmd (updated 03-May-09) will update the copy of Windows XP that is installed on the computer you run the command on. You may wish to do this, if you do not have, or want, the machine you want to hotfix connected to the internet, or if you are unable to run Windows Update for some reason (for example, if Internet Explorer isn't installed, or doesn't work properly, due to a virus or similar mishap).

To slipstream the hotfixes, and burn the slipstreamed disk, I've created the makefile xpsp3.mak (updated 03-May-09). Details on usage below.

Automatically Slipstream Windows XP with SP2 and All Post-SP2 Security Hotfixes with a Single Command (Updated 03-May-09)

For information about slipstreaming Windows XP SP3, visit http://smithii.com/slipstream_xpsp3.

I've written the batch file xpsp2.cmd (updated 03-May-09) to automatically download and slipstream a standard Windows XP boot disk with Service Pack 2 and all post-SP2 security hotfixes.

It uses wget or curl (if either are found in the PATH), or your installed browser to download the updates. I have tested this with Internet Explorer, Firefox, and Opera. Other browsers should work, as well.

The batch file xpsp2local.cmd (updated 03-May-09) will update the copy of Windows XP that is installed on the computer you run the command on. You may wish to do this, if you do not have, or want, the machine you want to hotfix connected to the internet, or if you are unable to run Windows Update for some reason (for example, if Internet Explorer isn't installed, or doesn't work properly, due to a virus or similar mishap).

To slipstream the hotfixes, and burn the slipstreamed disk, I've created the makefile xpsp2.mak (updated 03-May-09). Details on usage below.

Automatically changing screen positions and default printer based upon my location

Here's my startup.cmd script I wrote to automatically change thr screen positions, and the default printer, whenever I change locations. I place this in the directory C:\WINDOWS\system32\repl\import\scripts, so it will be executed automatically when I login. It uses res_set to change the screen locations and resolutions.

@echo off

set scriptdir=%~dp0
pushd "%scriptdir%" >nul

if not "%1" == "" (set location=%1) else (set location=)

if not "%location%" == "" goto found

ipconfig | findstr "Gateway" | findstr "10\.0\.0\.1" >nul
if not errorlevel 1 set location=home

ipconfig | findstr "Gateway" | findstr "192\.168\.1\.1" >nul
if not errorlevel 1 set location=work

ipconfig | findstr "Gateway" | findstr "192\.168\.3\.1" >nul
if not errorlevel 1 set location=work2

if not "%location%" == "" goto found

echo Cannot determine location.
popd >nul
exit /b 1

:found
echo Configuring system for %location%...
goto %location%

:home
res_set -m 0 -w 1920 -h 1200 -b 32 -x 0 -y 0
res_set -m 2 -w 1920 -h 1200 -b 32 -x 0 -y -1200
cscript /nologo /b "SetDefaultPrinter.vbs" "hp LaserJet 1320 PCL 6 (home)"
goto eos

:work
res_set -m 0 -w 1920 -h 1200 -b 32 -x 0 -y 0
res_set -m 1 -w 1920 -h 1200 -b 32 -x -1920 -y -120
cscript /nologo /b "SetDefaultPrinter.vbs" "HP LaserJet 2100 PCL6 (work)"
goto eos

:work2
cscript /nologo /b "SetDefaultPrinter.vbs" "HP LaserJet 1020 (work2)"
goto eos

:eos
popd >nul
exit /b 0

Here's the SetDefaultPrinter.vbs script:

dim WshNetwork 
dim sout
dim oFS  
const StdOut = 1  
  
set oFS = CreateObject("Scripting.FileSystemObject")  
set sout = oFS.GetStandardStream(StdOut)  
sout.Write "Changing default printer to: " + Wscript.arguments.Item(0)

set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.SetDefaultPrinter Wscript.arguments.Item(0)

si_installer 1.13 has been released (announcement)

si_installer 1.13 has been released (announcement)

Details at http://smithii.com/si_installer.

This seemingly duplicate entry has been created as some RSS readers, such as Google Reader, do not display updates to existing blog entries, even if the update date was changed. This entry will be deleted in a week or so. Therefore, please do not post comments to this entry. Post them to the above URL instead. Thanks!

nirsoft_installer 1.33 has been released (announcement)

Details at http://smithii.com/nirsoft_installer.

This seemingly duplicate entry has been created as some RSS readers, such as Google Reader, do not display updates to existing blog entries, even if the update date was changed. This entry will be deleted in a week or so. Therefore, please do not post comments to this entry. Post them to the above URL instead. Thanks!

nirsoft_installer 1.33 has been released (announcement)

Logging in as root in SecureCRT

My sysadmin turned off root access, but gave me sudo rights to login as root.

To continue to login directly as root I copy pasted a connection profile, and then edited the property Connection / Logon Scripts / Logon script and pointed to the script sudo_root.vbs:

# $language = "VBScript"
# $interface = "1.0"

Sub Main
  crt.Screen.WaitForString "$"
  crt.Screen.Send "sudo su - root" & Chr(10)
End Sub

nirsoft_installer 1.32 has been released (announcement)

Details at http://smithii.com/nirsoft_installer.

This seemingly duplicate entry has been created as some RSS readers, such as Google Reader, do not display updates to existing blog entries, even if the update date was changed. This entry will be deleted in a week or so. Therefore, please do not post comments to this entry. Post them to the above URL instead. Thanks!

nirsoft_installer 1.31 has been released (announcement)

Dumping the GRANT statements in MySQL

The following script will display your GRANT statements in MySQL in *nix:

$ mysql -e "SELECT
CONCAT('SHOW GRANTS FOR ',QUOTE(user),'@',QUOTE(host),';')
FROM mysql.user" --column-names=false -B | 
mysql --column-names=false -B 2>/dev/null |
sed 's/$/;/'

Here's a sample output:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'
IDENTIFIED BY PASSWORD '*FD1111DEADBEEFDEADBEEFDEADBEEFDEADBEEFDE'
WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' 
IDENTIFIED BY PASSWORD '*FD1111DEADBEEFDEADBEEFDEADBEEFDEADBEEFDE'
WITH GRANT OPTION;

On Windows, replace /dev/null with NUL, and remove the sed command:

c:> mysql -e "SELECT CONCAT('SHOW GRANTS FOR ',QUOTE(user),'@',QUOTE(host),';')
FROM mysql.user" --column-names=false -B | mysql --column-names=false -B 2>nul

You will then need to add the ; character manually.

You could even do this from inside the mysql client, in *nix:

$ mysql
mysql> SELECT CONCAT('SHOW GRANTS FOR ',QUOTE(user),'@',QUOTE(host),';')
FROM mysql.user INTO OUTFILE '/tmp/grants.sql';
mysql> source /tmp/grants.sql

and in Windows:

C:> mysql
mysql> SELECT CONCAT('SHOW GRANTS FOR ',QUOTE(user),'@',QUOTE(host),';')
FROM mysql.user INTO OUTFILE 'c:/grants.sql';
mysql> source c:/grants.sql

If you get an error message, try your %TEMP% directory:

C:> cd /d "%TEMP%"
C:> dir /x ..
Volume in drive C is volname
Volume Serial Number is FEED-FACE

Directory of C:\DOCUME~1\ross\LOCALS~1

01/23/2008  11:09 AM    <DIR>                       Apps
08/07/2008  03:10 PM    <DIR>                       Temp
               0 File(s)              0 bytes
               2 Dir(s)   6,727,245,824 bytes free
c:> mysql
mysql> SELECT CONCAT('SHOW GRANTS FOR ',QUOTE(user),'@',QUOTE(host),';')

Mediawiki's Openness Is Not a Good Thing Anymore

Spammers found my MediaWiki based website, and flooded the site with over 1.2GB of link spam. To fix this, I locked down my site, so only sysops can change it, by adding the following to the end of my LocalSettings.php file:

// Implicit group for all visitors
$wgGroupPermissions['*'    ]['createaccount']   = true;
$wgGroupPermissions['*'    ]['read']            = true;
$wgGroupPermissions['*'    ]['edit']            = false;
$wgGroupPermissions['*'    ]['createpage']      = false;
$wgGroupPermissions['*'    ]['createtalk']      = false;

// Implicit group for all logged-in accounts
$wgGroupPermissions['user' ]['move']            = false;
$wgGroupPermissions['user' ]['read']            = true;
$wgGroupPermissions['user' ]['edit']            = false;
$wgGroupPermissions['user' ]['createpage']      = false;
$wgGroupPermissions['user' ]['createtalk']      = false;
$wgGroupPermissions['user' ]['upload']          = false;
$wgGroupPermissions['user' ]['reupload']        = false;
$wgGroupPermissions['user' ]['reupload-shared'] = false;
$wgGroupPermissions['user' ]['minoredit']       = false;

// Implicit group for accounts that pass $wgAutoConfirmAge
$wgGroupPermissions['autoconfirmed']['autoconfirmed'] = true;

// Implicit group for accounts with confirmed email addresses
// This has little use when email address confirmation is off
$wgGroupPermissions['emailconfirmed']['emailconfirmed'] = true;

// Users with bot privilege can have their edits hidden
// from various log pages by default
$wgGroupPermissions['bot'  ]['bot']             = true;
$wgGroupPermissions['bot'  ]['autoconfirmed']   = true;
$wgGroupPermissions['bot'  ]['nominornewtalk']  = true;

// Most extra permission abilities go to this group

$wgGroupPermissions['sysop' ]['move']            = true;
$wgGroupPermissions['sysop' ]['edit']            = true;
$wgGroupPermissions['sysop' ]['createpage']      = true;

nirsoft_installer 1.31 has been released (announcement)

Details at http://smithii.com/nirsoft_installer.

This seemingly duplicate entry has been created as some RSS readers, such as Google Reader, do not display updates to existing blog entries, even if the update date was changed. This entry will be deleted in a week or so. Therefore, please do not post comments to this entry. Post them to the above URL instead. Thanks!

nirsoft_installer 1.31 has been released (announcement)

php_installer 1.12 (for PHP 5.2.6) has been released (06-Jun-08)

php_installer is an NSIS installer I whipped up to download and install PHP 5.2.6, PECL, the PHP CHM manual, and the Zend Optimizer found at http://www.php.net.

You can download the binary here and the binary with the source code here.

Here's the changelog.txt:

php4_installer 1.5 (for PHP 4.4.8) has been released (23-Jan-08)

php4_installer is an NSIS installer I whipped up to download and install PHP 4.4.8, and the PHP CHM manual found at http://www.php.net.

You can download the binary here and the binary with the source code here.

Syndicate content
DeutschEspañolFrançaisItalianoNederlandsPortuguêsΕλληνικάРусскийالعربية中文(简体)中文(繁體)日本語한국어
 
Donate Bitcoins
Google
 
www smithii.com
 
Special thanks to Riester Rente Online for a generous donation!