linux

warning: Creating default object from empty value in /data/web/1/000/027/003/273448/htdocs/panticz.de/modules/taxonomy/taxonomy.pages.inc on line 33.

Install VirtualBox

wget https://raw.githubusercontent.com/panticz/installit/master/install.virtualbox.sh -O - | bash -

#!/bin/sh

if [ ! -z $1 ]; then
    USER=$1
fi

# install debconf-utils
sudo apt-get install debconf-utils

# add debconf answer
sudo debconf-set-selections <<\EOF
virtualbox virtualbox/group-vboxusers note
EOF

# add key
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -

# install repository key
wget -q -O - http://www.virtualbox.org/download/oracle_vbox_2016.asc | apt-key add -

# update repository list
echo "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
sudo apt-get update -qq

# install
sudo apt-get install -y virtualbox-5.1

# install extension pack
VERSION=$(dpkg-query -W -f='${Version}' "virtualbox*" | cut -d "-" -f1)
wget http://download.virtualbox.org/virtualbox/${VERSION}/Oracle_VM_VirtualBox_Extension_Pack-${VERSION}.vbox-extpack -P /tmp/
sudo VBoxManage extpack install /tmp/Oracle_VM_VirtualBox_Extension_Pack-${VERSION}.vbox-extpack

# add current user to vboxusers group
sudo adduser ${USER} vboxusers

--allow-unauthenticated

Fix kernel module
sudo /etc/init.d/vboxdrv setup

Links
http://wiki.ubuntuusers.de/VirtualBox/Installation
http://www.virtualbox.org/wiki/Linux_Downloads
http://www.panticz.de/node/143

LSI / Broadcom MegaRAID Storcli

# install storcli (MegaCli)
# https://www.broadcom.com/products/storage/raid-controllers/megaraid-sas-9361-4i#downloads

apt install unzip
wget http://docs.broadcom.com/docs-and-downloads/raid-controllers/raid-controllers-common-files/1.21.16_StorCLI.zip -qO /tmp/StorCLI.zip
unzip /tmp/StorCLI.zip -d /tmp/
unzip /tmp/versionChangeSet/univ_viva_cli_rel/storcli_All_OS.zip -d /tmp/versionChangeSet/univ_viva_cli_rel/
dpkg -i /tmp/versionChangeSet/univ_viva_cli_rel/storcli_All_OS/Ubuntu/storcli_1.21.06_all.deb
ln -s /opt/MegaRAID/storcli/storcli64 /usr/local/sbin/

or

Install Wine

wget https://raw.githubusercontent.com/panticz/installit/master/install.wine.sh -O - | bash -

#!/bin/bash

# add repository
sudo dpkg --add-architecture i386
wget -q https://dl.winehq.org/wine-builds/Release.key -O - | sudo apt-key add -
sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/
sudo apt-get update -qq

# pre-answer installation questions
sudo debconf-set-selections <<\EOF
msttcorefonts msttcorefonts/defoma note
ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula boolean true
ttf-mscorefonts-installer msttcorefonts/present-mscorefonts-eula note
EOF

# install wine
if [ "$1" == "-s" ]; then
  # staging release
  sudo apt-get install -y --install-recommends winehq-staging
else
  # stable release
  sudo apt-get install -y --install-recommends winehq-stable
fi

# install latest winetricks
sudo apt-get install -y winetricks
sudo winetricks --self-update

Downgrade to lastest Wine 1.2 (64 bit)
sudo apt-get remove wine1.4
cd /tmp
wget http://ie.archive.ubuntu.com/ubuntu/pool/universe/w/wine1.2/wine1.2_1.2.3-0ubuntu1_amd64.deb
wget http://ie.archive.ubuntu.com/ubuntu/pool/universe/n/nss-mdns/lib32nss-mdns_0.10-3.1ubuntu1_amd64.deb
sudo dpkg -i wine1.2_1.2.3-0ubuntu1_amd64.deb lib32nss-mdns_0.10-3.1ubuntu1_amd64.deb
wine --version

OPTIONAL: fake ie6 installation
wget kegel.com/wine/winetricks -P /tmp; sh /tmp/winetricks fakeie6

Compile wine
sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo apt-get build-dep wine1.3
sudo apt-get --build source wine1.3
./configure
make

LINKS
http://appdb.winehq.org/ - supported applicatinos
http://www.winehq.org/site/download-deb - Wine for Debian based distributions
http://wiki.winehq.org/AdobePhotoshop
http://wiki.winehq.org/AdobeAcrobatPro

Install androidscreencast under Ubuntu

# install android sdk

# install java
wget http://dl.dropbox.com/u/4170695/scripts/install.sun-java6-jre.sh -O - | bash -

# set path to android sdk
PATH=$PATH:~/android-sdk-linux_86/tools

# start android sdk server
adb start-server

# start androidscreencast
wget http://androidscreencast.googlecode.com/svn/trunk/AndroidScreencast/dist/androidscreencast.jnlp -P ~/
javaws ~/androidscreencast.jnlp

# Links
http://code.google.com/p/androidscreencast/

Install MS SQL Server JDBC Driver

# get driver
#URL=http://jaist.dl.sourceforge.net/project/jtds/jtds/1.2.5/jtds-1.2.5-dist.zip
URL=http://jaist.dl.sourceforge.net/project/jtds/jtds/1.3.1/jtds-1.3.1-dist.zip
wget ${URL} -P /tmp/
unzip /tmp/jtds-*-dist.zip -d /tmp/
sudo cp /tmp/jtds-*.jar /usr/share/java/

Eclipse > Build Path > Configure Build Path
Libraries > Add External JARs
/usr/share/java/jtds-1.2.5.jar

# fix tomcat
sudo cp /usr/share/java/jtds-1.2.5.jar /var/lib/tomcat6/webapps/builder3/WEB-INF/lib/

# Links
http://www.java-tips.org/other-api-tips/jdbc/how-to-connect-microsoft-sql-server-using-jdbc.html

nmap

scan for IPs and ports
nmap -PR -oN /tmp/nmap.out 192.168.1.0/24

search hosts
nmap -sP 192.168.1.*
nmap -PR -oN /tmp/nmap.out 192.168.1.0/24

scan for open ports
nmap -T4 -sS 192.168.1.100

get more detailed information
sudo nmap -O 192.168.1.100 -T4

scan one port
nmap -sV -P0 -p 22 -vv 192.168.1.100

LINKS
http://linuxwiki.de/nmap

sed

# remove third line
sed -i 3d

# insert line on beginning of a file
sed -i '1i MY_TEXT'

# String replace with sed
sed -i 's|STRING_FROM|STRING_TO|g' FILE
sed -i 's|[#]*param=[yes|no]*|param=yes|g' FILE

# add line to a file
sed -i '13i\YOUR_TEXT' FILE

# add line before last line
sed -i '$i test_line' /path/to/file

# search block
sed -n '/FOO/,/BAR/p' /path/to/file

# remove digits
echo $FOO | sed 's/[^0-9]*//g'

# remove blanks
cat FILE | sed 's/ */ /g'
# remove blanks and tabs
cat FILE | sed "s/

[ ]*/ /g"
 
# write to file

apt / dpkg

# run update
LANG=en_US.UTF-8 apt-get update -y && apt-get dist-upgrade -y && apt-get autoremove -y && apt-get clean -y

# allow unauthenticated repository
apt-get update --allow-unauthenticated

# view avaiable package version
apt-cache show wget
apt-cache madison wget

# install specific version
apt-get install package name=version
apt-get install wget=1.6

# install from specific repository
apt-get install -t squeeze-backports wget

# view available versions
apt-cache policy chromium-browser

# autoupdate
http://www.panticz.de/debian-ubuntu-automatic-upgrades

SSH

create SSH key
ssh-keygen -q -b 4096 -f ~/.ssh/id_rsa -N '' -C "${USER}@$(hostname -f)"

Copy public key to server (/home/foo/.ssh/authorized_keys)
ssh-copy-id foo@example.com

show log
tail -f /var/log/auth.log
journalctl _COMM=sshd -f

# configuration
~/.ssh/config: user configuration
/etc/ssh/ssh_config: system-wide client configuration
/etc/ssh/sshd_config: system-wide server configurtion

http://www.panticz.de/SSH-server-enable-disable-password-authentication
http://www.panticz.de/ssh_pre-shared-key_authentication

vi

goto line
:12 ENTER

search and replace
:%s/foo/bar/g

view hidden chars
:set list
:set nolist

reformat tabs to 4 spaces
:set tabstop=4 expandtab
:retab 4

# convert endline
:set ff=unix
:set ff=dos

# vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 textwidth=75

Links
http://www.lagmonster.org/docs/vi2.html
http://vim.wikia.com/wiki/Search_and_replace

Syndicate content