#make sure you add unstable entries to sources.list
apt-get install sun-java6-jdk
apt-get install tomcat5.5
apt-get install tomcat5.5-admin
apt-get install tomcat5.5-webapps
$CATALINA_HOME/webapps/ROOT/index.jsp
/usr/share/tomcat5.5-webapps/ROOT/index.jsp
#it will be listening on port 8180
Tuesday, June 2, 2009
Debian package manager
#useful Debian/Ubuntu package commands
apt-get install package
apt-get remove package
apt-get update #good for updating your database after editing sources.list
apt-cache search search_string
dpkg --list
dpkg --install program.deb
dpkg --remove program
#Sometimes you have to add this to /etc/apt/sources.list
# etch is a version of Debian, replace with your version
deb http://security.debian.org/ etch/updates main contrib
deb-src http://security.debian.org/ etch/updates main contrib
deb http://ftp.debian.org/debian/ etch main
deb-src http://ftp.debian.org/debian/ etch main
#these are good for install outside packages like java
deb http://ftp.debian.org/debian/ unstable non-free
deb-src http://ftp.debian.org/debian/ unstable non-free
apt-get install package
apt-get remove package
apt-get update #good for updating your database after editing sources.list
apt-cache search search_string
dpkg --list
dpkg --install program.deb
dpkg --remove program
#Sometimes you have to add this to /etc/apt/sources.list
# etch is a version of Debian, replace with your version
deb http://security.debian.org/ etch/updates main contrib
deb-src http://security.debian.org/ etch/updates main contrib
deb http://ftp.debian.org/debian/ etch main
deb-src http://ftp.debian.org/debian/ etch main
#these are good for install outside packages like java
deb http://ftp.debian.org/debian/ unstable non-free
deb-src http://ftp.debian.org/debian/ unstable non-free
Power configuration from command line with xp
powercfg /setactive "always on"
powercfg /query
powercfg /query
net time commands
net time (time from domain server)
net time /querysntp
net time /set \\another_pc
net time /setsntp:time.apple.com
net time /querysntp
net time /set \\another_pc
net time /setsntp:time.apple.com
Monday, June 1, 2009
Change a computer name with vbscript
Scripting the changing of computer names in windows is straight-forward with a vbscript.
You can change a computer via the registry, so this is the approach used here.
Set the computer name you want in the sNewName variable.
sNewName = "new_pc_name"
Set oShell = CreateObject ("WSCript.shell")
sCCS = "HKLM\SYSTEM\CurrentControlSet\"
sTcpipParamsRegPath = sCCS & "Services\Tcpip\Parameters\"
sCompNameRegPath = sCCS & "Control\ComputerName\"
With oShell
.RegDelete sTcpipParamsRegPath & "Hostname"
.RegDelete sTcpipParamsRegPath & "NV Hostname"
.RegWrite sCompNameRegPath & "ComputerName\ComputerName", sNewName
.RegWrite sCompNameRegPath & "ActiveComputerName\ComputerName", sNewName
.RegWrite sTcpipParamsRegPath & "Hostname", sNewName
.RegWrite sTcpipParamsRegPath & "NV Hostname", sNewName
End With ' oShell
You can change a computer via the registry, so this is the approach used here.
Set the computer name you want in the sNewName variable.
sNewName = "new_pc_name"
Set oShell = CreateObject ("WSCript.shell")
sCCS = "HKLM\SYSTEM\CurrentControlSet\"
sTcpipParamsRegPath = sCCS & "Services\Tcpip\Parameters\"
sCompNameRegPath = sCCS & "Control\ComputerName\"
With oShell
.RegDelete sTcpipParamsRegPath & "Hostname"
.RegDelete sTcpipParamsRegPath & "NV Hostname"
.RegWrite sCompNameRegPath & "ComputerName\ComputerName", sNewName
.RegWrite sCompNameRegPath & "ActiveComputerName\ComputerName", sNewName
.RegWrite sTcpipParamsRegPath & "Hostname", sNewName
.RegWrite sTcpipParamsRegPath & "NV Hostname", sNewName
End With ' oShell
VBScript tricks : no logo, filesystem, control blocks, argument
'When running from the console, here is how to hide the logo
cscript //Nologo myscript.vbs
'How to reference an argument
WScript.Arguments.Item(0)
'Here is how to read a file
set f = fso.opentextfile(source, 1,false)
if fso.fileexists(source) then
while not f.atendofstream
inputline = f.readline
msgbox inputline
wend
end if
Inserting a blank line with sed
#I found this to be a bit tricky
sed -e '/pattern/i\
\ # <-- this is the key
' input_file > output_file
sed -e '/pattern/i\
\ # <-- this is the key
' input_file > output_file
Subscribe to:
Posts (Atom)