XEN: Install Hypervisor (Dom0) under Debian

<?php
$URL="https://raw.githubusercontent.com/panticz/installit/master/install.xen.sh";
echo "wget -q --no-check-certificate $URL -O - | bash -";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>
Enable XL toolstacks
sed -i 's|TOOLSTACK=|TOOLSTACK=xl|g' /etc/default/xen

configure perfomance
http://wiki.xen.org/wiki/Credit_Scheduler
xm sched-credit
xm sched-credit -d www -w 512

# OPTIONAL: sync time
apt-get install -y ntpdate
ntpdate ntp.ubuntu.com
hwclock --systohc
rm /etc/cron.daily/ntpdate

# updae bootstrap
http://www.panticz.de/update_debootstrap

# manually update xen-create-image
wget http://ftp.de.debian.org/debian/pool/main/x/xen-tools/xen-tools_4.3.1-1_all.deb -O /tmp/xen-tools_4.3.1-1_all.deb
dpkg -x /tmp/xen-tools_4.3.1-1_all.deb /tmp/
mv /usr/bin/xen-create-image /usr/bin/xen-create-image.org
cp /tmp/usr/bin/xen-create-image /usr/bin/xen-create-image

# OPTIONAL: enable ip forward in dom0
cp /etc/sysctl.conf /etc/sysctl.conf.org
sed -i 's|#net.ipv4.ip_forward=1|net.ipv4.ip_forward=1|g' /etc/sysctl.conf

# OPTIONAL: PCI delegation
http://www.panticz.de/xen_pci_delegation

# reboot
reboot

# Ubuntu Xen Dom0
apt-get install -y xen-hypervisor-4.2-amd64 xen-tools

# LINKS
http://wiki.debian.org/Xen
http://wiki.xensource.com/xenwiki/XenBestPractices
http://www.panticz.de/configure_network_bridge
http://www.panticz.de/update_debootstrap
http://www.chrisk.de/blog/2008/12/how-to-run-xen-in-ubuntu-intrepid-without-compiling-a-kernel-by-yourself/
http://wiki.debian.org/Xen
https://help.ubuntu.com/community/Xen

Autostart script from USB device with Udev

Stage 1: Create Udev rule
<?php
$URL="http://dl.panticz.de/udev/autorun/70-persistent-usb_autorun.rules";
echo "sudo wget $URL -O /etc/udev/rules.d/70-persistent-usb_autorun.rules";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

Stage 2: Create autorun wrapper
<?php
$URL="http://dl.panticz.de/udev/autorun/usb_autorun.sh";
echo "sudo wget $URL -O /usr/sbin/usb_autorun.sh";
echo "\n";
echo "sudo chmod a+x /usr/sbin/usb_autorun.sh";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

Stage 3: Create autorun.sh script on your USB device (example)
<?php
$URL="http://dl.panticz.de/udev/autorun/autorun.sh";
echo "cd /media/YOUR_USB_DEVICE";
echo "\n";
echo "wget $URL -O ./autorun.sh";
echo "\n";
echo "chmod a+x ./autorun.sh";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

Linux Kernel Benchmark

# install apps
apt-get update -qq
apt-get install -y gcc make libc6-dev bzip2 bc --no-install-recommends

# download kernel
cd /dev/shm
#wget -q ftp://ftp.hosteurope.de/mirror/ftp.kernel.org/pub/linux/kernel/v3.0/linux-3.4.tar.bz2
wget ftp://ftp.hosteurope.de/mirror/ftp.kernel.org/pub/linux/kernel/v3.0/linux-3.9.tar.bz2

# view cpu name
echo CPU: $(cat /proc/cpuinfo | grep "model name" | head -1 | cut -d":" -f2)
echo Cores: $(cat /proc/cpuinfo | grep processor | wc -l)

# extract
time tar -xjf linux-3.*.tar.bz2

# optional
mount -o remount,size=2G /run/shm/
mount -o remount,

Linux software RAID

# create software raid
apt-get install -y mdadm parted --no-install-recommends

# view discs
lshw -short -c disc

# old
for DEV in sda sdb; do
umount /dev/${DEV}1
parted /dev/${DEV} -s rm 1
#parted /dev/${DEV} -s rm 2
#dd if=/dev/zero of=/dev/${DEV} bs=1M count=1
parted /dev/${DEV} -s mklabel msdos
parted /dev/${DEV} -s mkpart primary 1 256G
#parted /dev/sda -s mkpart primary 256G 128G
done

# new
for DEV in /dev/sd{a..b}; do
parted ${DEV} -s rm 1
parted ${DEV} -s mklabel msdos
parted ${DEV} -s mkpart primary 2048s 100%
parted ${DEV}

Fedora

# list groups
sudo dnf grouplist -v
MATE Desktop (mate-desktop-environment)
Minimal Install (minimal-environment)
Web Server (web-server-environment)

# additional repo
rpm -ivh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm

# install MATE desktop
dnf install @mate-desktop-environment -y
systemctl set-default graphical.target

# install applications
sudo dnf install -y ansible lxc* eclipse libreoffice smartmontools terminator docker thunderbird firefox

# Fedora PXE install
mkdir -p /var/lib/tftpboot/fedora/17

wget ftp://ftp.uni-kl.de

Compile IPFire (on 32bit system)

sudo apt-get install -y git
#sudo apt-get install -y git-core gcc g++ realpath make patch bzip2 byacc python-urlgrabber bison gawk texinfo

sudo apt-get install -y git-core g++ realpath patch make python-urlgrabber bison gawk texinfo autoconf screen
# byacc
wget http://mirrors.kernel.org/ubuntu/pool/universe/b/byacc/byacc_20130925-1_i386.deb
dpkg -i byacc_20130925-1_i386.deb

git config --global color.ui auto

# check out source
git clone git://git.ipfire.org/ipfire-2.x.git

ln -sf /bin/bash /bin/sh

cd ipfire-2.x/
./make.sh downloadsrc
./make.sh gettoolchain

Java: Add autocompletion to a (editable) JComboBox

1. Download this source code and add to your Java project:
http://www.orbital-computer.de/JComboBox/source/AutoCompletion.java

2. Add folowing code to enable autocompletion for your JComboBox:
AutoCompletion.enable(yourComboBox);

For further information about JComboBox and AutoCompletion see:
http://www.orbital-computer.de/JComboBox/
https://today.java.net/pub/a/today/2007/07/19/adding-auto-completion-to-swing-comboboxes.html

Create Oracle 10 XE Xen DomU domain

# download debian 32 bit domU installer
wget http://ftp.debian.org/debian/dists/squeeze/main/installer-i386/current/images/netboot/xen/initrd.gz -O /tmp/initrd.gz
wget http://ftp.debian.org/debian/dists/squeeze/main/installer-i386/current/images/netboot/xen/vmlinuz -O vmlinuz

# create lvm for domU
lvcreate --name oracle-disk --size 16G vg1
lvcreate --name oracle-swap --size 16G vg1

# create domU config for installation
cat < /etc/xen/oracle
kernel = '/tmp/vmlinuz'
ramdisk = '/tmp/initrd.gz'
vcpus = '2'
memory = '2048'
root = '/dev/xvda2 ro'
di

Compile extundelete

DIST=$(lsb_release -cs)
echo "deb http://archive.ubuntu.com/ubuntu/${DIST} restricted main multiverse universe" > /etc/apt/sources.list.d/${DIST}.list
apt-get update
sudo apt-get install -y extundelete

#
# old
#
# install apps
sudo apt-get -y install build-essential e2fslibs-dev

# download
wget http://kent.dl.sourceforge.net/project/extundelete/extundelete/0.2.0/extundelete-0.2.0.tar.bz2 -P /tmp

# extract
tar xjf /tmp/extundelete-0.2.0.tar.bz2 -C /tmp

# compile
cd /tmp/extundelete-0.2.0
./configure
make
# make install

# restore files
/tmp/extundelete-0.2.0/src/ex