Adaptec RAID controller / arcconf

arcconf GETLOGS 1 DEVICE

# list logical devices
arcconf GETCONFIG 1 LD

# list phisical devices
arcconf GETCONFIG 1 PD

# start adaptec verifi
arcconf TASK START 1 DEVICE 0 0 VERIFY

arcconf GETSTATUS 1

# create JBOD on all devices
# get device count
COUNT=$(arcconf GETCONFIG 1 PD | grep "Hard drive" | wc -l)

# create JBOD on all devices
for CHANNEL in `echo $(seq 1 ${COUNT})`; do
CHANNEL=$((CHANNEL-1))
echo ${CHANNEL}

arcconf CREATE 1 JBOD 0 ${CHANNEL} noprompt
done

# delete devices
arcconf DELETE 1 LOGICALDRIVE ALL noprompt

Magento: Replace broken Webservicex.net currency exchange with Yahoo finance

# go to your Magento installation
cd /var/www/

# create Yahoofinance.php
mkdir -p ./app/code/local/JT/Directory/Model/Currency/Import/
wget http://www.panticz.de/sites/default/files/magento/CurrencyExchange/Yahoofinance.php -O ./app/code/local/JT/Directory/Model/Currency/Import/Yahoofinance.php

# update configuration
# (TODO): create module configuration xml
# add bevore end of the global node in ./app/etc/local.xml

--- /var/www/app/etc/local.xml.org 2010-07-23 13:07:49.000000000 +0200
+++ /var/www/app/etc/local.xml 2013-04-13 10:01:51.000000000 +0200
@@ -49,6 +49,16 @@

Simple Java currency converter

package Helper;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;

public class ExchangeRate {

private double getRate(String from, String to) {
try {
URL url = new URL("http://quote.yahoo.com/d/quotes.csv?f=l1&s=" + from + to + "=X");
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String line = reader.readLine();
if (line.length() > 0) {
return Double.parseDouble(line);
}
read

Install Adobe AIR under Linux

sudo apt-get install ia32-libs

if [ "$(uname -m)" == "x86_64" ]; then
# 64 bit
URL=http://update.devolo.com/linux/apt/pool/main/a/adobeair/adobeair_2.6.0.19170_amd64.deb
else
# 32 bit
URL=http://update.devolo.com/linux/apt/pool/main/a/adobeair/adobeair_2.6.0.19170_i386.deb
fi
wget ${URL} -P /tmp
sudo dpkg -i /tmp/adobeair_*.deb

# install a AIR app
sudo /usr/bin/Adobe\ AIR\ Application\ Installer /PATH/TO/AIR/FILE.air

# Links
http://askubuntu.com/questions/87447/how-can-i-install-adobe-air

Compile smartmontools

<?php
$URL="https://raw.githubusercontent.com/panticz/scripts/master/compile.smartmontools.sh";
echo "wget $URL -O - | bash -";
echo "

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

";
?>

check smartctl version
smartctl -V

Links
http://sourceforge.net/projects/smartmontools/files/smartmontools/ - sorce code download
http://sourceforge.net/apps/trac/smartmontools/wiki/Download#Installprecompiledpackage

htaccess

# Redirect http to https
RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.panticz\.de [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^(.*) http://www.panticz.de/$1 [L,R=301]

RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{HTTP_HOST}/$1 [L]

RewriteCond %{HTTP_HOST} ^(www.)?YourDomain.com$
RewriteRule ^(/)?$ page [L]

# Allow directory listing
# enable "AllowOverride All" in VHost configuration first
Options +Indexes

# Allow show bash files

Allow from all
AddType text/plain .sh .bash

# Enable PHP5
AddType

Burning iPXE into Intel network adapter

# install required packages
apt-get install -y build-essential liblzma-dev git linux-headers-$(uname -r)

# list controller
#lspci -nn | grep Ethernet

# get device id
lspci -nn | grep Ethernet | cut -d"[" -f3 | cut -d"]" -f1 | tr -d ":"

# v1 (intel 100 mbit, WORKING)

# build ipxe rom
git clone git://git.ipxe.org/ipxe.git /tmp/ipxe

# preconfigure boot server (local, www.panticz.de)
cat < /tmp/ipxe/src/boot.ipxe
#!ipxe

dhcp && chain http://\${next-server}/\${mac} || chain http://preseed.panticz.de/\${mac}
EOF

# compile
cd /tmp/ipxe/src
make bin/80861229.rom EMBE