Sunday, September 29, 2013

find duplicates postgresql and mysql

pgsql:

SELECT t.id,t.name,t.type,t.content,t2.id,t2.name,t2.type,t2.content FROM records as t, records as t2 WHERE t.name = t2.name AND t.type = 'NS' AND t2.type = 'NS' AND t.content = t2.content AND t.id < t2.id limit 10;

mysql:

SELECT domain_id,name,type,content, count( * ) cnt FROM  records GROUP BY type HAVING cnt >1 ORDER BY cnt DESC LIMIT 100";

fixing pdns master/slave issue

Saturday, September 28, 2013

Сортировка массива в php без использования sort(), работающая с русским текстом (array sort in cycle)

Мой пост на хабре http://habrahabr.ru/sandbox/66466/

Как-то давно проходил собеседование, и там была задача — не используя встроенных функций сортировки, отсортировать массив(вернее список имен из файла) от «а» до «я». Задачу тогда не смог решить и ушел ни с чем… И вот тут недавно вспомнил, стало интересно, каково же, все таки, решение?


Нашел кое-что тут: muruganasm.blogspot.com/2011/01/sort-array-of-string-without-using-php.html. Немного доработал для работы с именами. Например, есть файл listnames.txt:

Salopatan Dolot
   Lucara Vanibo
   Xyxelan Ubem
   Irabon Seboribal
   Abasixi Abubodul
   Sasipabi Itatop
   Latanybor Ocifil
   Obi Onu
   Laso pubyl
владимир петров
Илья бронштейн
Александр Мельников
  алексей шнырюк
512


Для вывода «по-красивее», решил обработать стринги функцией ucwords(). Но, как ни странно, она не захотела работать с русской кодировкой. setlocale() тоже не помогла нисколько. Тут, возможно сыграли настройки сервера. Вобщем, пошел довольно таки сложным путем. Надеюсь, кому-нибудь будет интересно:

<?php
$filename = 'listnames.txt';
$file_cont = (file_exists($filename))? file_get_contents($filename):die('No such file '.$filename);
$str2 = (!empty($file_cont))? preg_split("/[\n,]|[\r,]+/",$file_cont):die('No content was given from '.$filename);
print_r($str2);
$str = array_map("trim",$str2);
$str = array_map("ucwords", $str);
$str = array_map("non_en_to_uppercase", $str);
function non_en_to_uppercase($str){
    if( preg_match("/[А-я]{1,}+(\s+[А-я]{1,})?/i", $str)){
       $arr = preg_split("/[\s,]+/",$str);
       var_dump($arr);
       $new_str = "";
       foreach($arr as $word){
           $word = trim($word);
           $strlen = mb_strlen($word);
           $word = mb_strtoupper(mb_substr($word,0,1,'UTF-8'),'UTF-8') . mb_strtolower(mb_substr($word,1,$strlen),'UTF-8');
           $new_str .= " ".$word;
       }
       return trim($new_str);
    }
    else return $str;
}
$array_length = sizeof($str);

 for($x = 0; $x < $array_length; $x++) {
 
  for($y = 0; $y < $array_length; $y++) {
  
   
   if(strcasecmp($str[$x],$str[$y])<0) {
      $hold = $str[$x];
      $str[$x] = $str[$y];
      $str[$y] = $hold;
   }
  }
 }
$str = array_filter($str);
echo "<br />After sorting<br />";
print_r($str);
?>


Проверяем, если есть заданный файл. Если есть — читаем и построчно засовываем в массив $str2:

$file_cont = (file_exists($filename))? file_get_contents($filename):die('No such file '.$filename);
$str2 = (!empty($file_cont))? preg_split("/[\n,]|[\r,]+/",$file_cont):die('No content was given from '.$filename);


Удаляем пробелы, табуляцию с краев для каждого элемента массива:

$str = array_map("trim",$str2);


Приводим имена в «нормальный» вид. Т.е. иван петров в Иван Петров

$str = array_map("ucwords", $str);
$str = array_map("non_en_to_uppercase", $str);


Скорее всего, я где-то перемудрил с функцией non_en_to_uppercase(), но суть ее — проверить, если стринг в русской кодировке, и, если да, принудительно конвертировать первые буквы имени и фимилии в заглавные, а остальные — в строчные.

Далее в двойном цикле с помощью регистронезависимой функции strcasecmp сравниваем элементы массива, и меняем их местами в зависимости от результата сравнения:

 if(strcasecmp($str[$x],$str[$y])<0) {
      $hold = $str[$x];
      $str[$x] = $str[$y];
      $str[$y] = $hold;

Для примера Код:
$a = 'a';
$b = 'b';
echo strcasecmp($a,$b); //-1

выводит -1
и
echo strcasecmp($b,$a); //1

выдаст 1
Для пущей наглядности можно запустить этот код и увидеть, как элементы меняются местами:
$str = array('Z','c','A','C','E','B','M','N');
$array_length = sizeof($str);
 for($x = 0; $x < $array_length; $x++) { 
  for($y = 0; $y < $array_length; $y++) {  
   if(strcasecmp($str[$x],$str[$y])<0) {   
      $hold = $str[$x];
      $str[$x] = $str[$y];
      $str[$y] = $hold;
      echo "[$x] => $str[$x] <br />[$y] => $str[$y]<br /><br />";
   }
  }
 }


Напомню, что strcasecmp() не работает нормально с русской кодировкой. буквы «а» и «А» не равны. Поэтому мне пришлось выше приводить имена к единому регистру самописной функцией non_en_to_uppercase($str)

Теперь очистим вывод от пустых значений и печатаем отсортированный массив:

$str = array_filter($str);
echo "<br />After sorting<br />";
print_r($str);

How do I add syntax highlighting to my Blogger blog?

what is the difference between INPUT and RH-Firewall-1-INPUT

I am running CentOS 6.3 and configuring a NFS server.The NFS service cannot be started due to Firewall rules not being correctly set.
Starting NFS quotas: Cannot register service: RPC: Authentication error; why = Client credential too weakrpc.rquotad: unable to register (RQUOTAPROG, RQUOTAVERS, udp). [FAILED]
Rules applied:
-A INPUT -p udp -m multiport --dports 111,662,875,892,2049,32769 -j ACCEPT

-A INPUT -p tcp -m multiport --dports 111,662,875,892,2049,32803 -j ACCEPT

However, after I tried to change the word from "INPUT" to "RH-Firewall-1-INPUT", it works like a charm:
-A RH-Firewall-1-INPUT -p udp -m multiport --dports 111,662,875,892,2049,32769 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m multiport --dports 111,662,875,892,2049,32803 -j ACCEPT
I googled it and it turns out that starting from RH6, the RH firewall chain is removed, so the two notations are of the same meaning (if i understand it correctly)
So that comes to the question, if they are the same, why INPUT doesn't work while RH-Firewall-1-INPUT make it work?Is there any hidden meaning of it?
Thanks

 http://www.centos.org/modules/newbb/viewtopic.php?topic_id=40446&forum=58

howto to trace a linux program

Можно попробовать strace -fx -eopen programmname и посмотреть какую последнюю либу пытается загрузить. Ну и для общего развития

ldd programmname
objdump -T programmname

original: http://otvety.google.ru/otvety/thread?tid=14d434b2e4af367c

Sunday, September 22, 2013

Apache – how to configure VirtualHost(example)

<VirtualHost *:80>
    DocumentRoot “/var/www/html/pr1″
    ServerName rec.host.com
    ServerAlias rec3.host.com
    <Directory “/var/www/html/pr1″>
        Order Allow,Deny
        allow from all
        Options -Indexes
    </Directory>
    <Directory “/var/www/html/pr1/config”>
        Order Deny,Allow
        deny from all
    </Directory>
    <Directory “/var/www/html/pr1/dl”>
        Order Allow,Deny
        Allow from all
        Options +Indexes
    </Directory>

</VirtualHost>

How to find big files in linux

find . -size +20000k -exec du -h {} \;


du : Estimate file space usage
sort : Sort lines of text files or given input data
head : Output the first part of files i.e. to display first 10 largest file
Here is what you need to type at shell prompt to find out top 10 largest file/directories is taking up the most space in a /var directory/file system:
# du -a /var | sort -n -r | head -n 10

Handy stuff for cisco routers

to add a route:
config t
ip route ipaddress subnetmask destination
to remove a route:
config t
no ip route ipaddress subnetmask destination
to null route an IP address:
config t
ip route ipaddress subnetmask null0
to find a dsl login:
sh user | include xxxxx
where xxxxx = either the login name or IP address
to show interfaces of a certain type quickly:
sh ip int brief | include ATM
where ATM can be whatever text identifies the interfaces
to show how much is blocked by access lists:
sh access-lists
to find a DSL user on a specific IP:
sh caller ip | include ipaddress
to reset a DSL user:
clear int vi4.28
to reinit a DSL user:
config t
int atm5/ima2.100 POI (or whatever their interface number is)
shut
no shut
exit
to track down non-existant dsl user:
config t
logging 216.144.x.x  (ip of syslog host)
debug pppoe or pppatm or whatever events you need.
debug ppp authentication
debug vpdn pppoe-events (att or sbc)
no debug all (to turn it off)
cle router
term mon
debug ppp auth
debug pppoe event (watch for login and write it down with vpi/vci)
no debug all
term no mon
ATM pinging from a cisco:
ping ATM INT a5/ima1.100 vpi vci e
Example: ping atm int a5/ima1.100 1 83 e
the e means ping endpoint.
Explains how to use a cisco router to track a flood
columbus- build a dlci based dsl interface
config t
int s2/1.136 poi
frame-relay interface-dlci 136 IETF
exit (once)
bridge-group 1
columbus find userr-col1#sh arp | include 216.144.63.24
Internet 216.144.63.24 18 0010.dcf8.1dd1 ARPA BVI1
r-col1#sh bridge 1 | include 0010.dcf8.1dd1
0010.dcf8.1dd1 forward Serial6/0.131 0 627740 172240
lookup dlci 131 in chart
Access Lists (hssi1/0.500 and hssi2/0)clear ip access-lists counters
sh ip access-lists 152
no ip access-group 152 out
Hung VPDN tunnels
sh vpdn tunnel sum
look for wt-ctl
sh config and look for atm5/ima1.something
config t to shut no shut

[bash] Remove Users and their directories from LDAP server, that NOT in active users list

this is also from 2009:
Task: Remove Users and their directories from LDAP server, that NOT in active users list
 users1.txt – userlist from HR We will leave only theses users
 users2.txt – all LDAP users:
smbldap-userlist -u > users.txt
awk -F"|" '{ print $2 }' users.txt > users_1.txt

Next we will clean tab signs and spaces:
cat users_1.txt | sed 's/^[ t]*//;s/[ t]*$//' > users2.txt
Next we will create PHP (php_script.php) to compare two files (http://php.net/manual/en/function.array-diff.php:
<?php
$file_array1 = file( "users1.txt" );
//print_r ($file_array1);

$file_array2 = file( "users2.txt" );
//print_r ($file_array2);

$result = array_diff($file_array2, $file_array1);
print_r ($result);
?>
To run this PHP script use:
root@localhos:~# /usr/bin/php -f php_script.php > users3.txt
clean up:
awk -F"=>" '{ print $2 }' tmp.txt > users_to_delete.txt
Then we will delete non-active users:
#!/bin/bash
for i in `cat users_to_delete.txt`;
do echo "going to remove user $i";
/usr/sbin/smbldap-userdel -r $i;
echo "going to remove directory of $i";
rm -R /home/$i;
done;

Asterisk 1.4.0 CLI commands

Introduction
Asterisk CLI supports large variety of commands which can be used for testing, configuration and monitoring. In this tutorial we will describe all commands available at the standard Asterisk version 1.4.0. We will divide this tutorial into few sections in order to facilitate the reading.
General CLI commands
! – Execute a shell command
abort halt – Cancel a running halt
cdr status – Display the CDR status
feature show – Lists configured features
feature show channels – List status of feature channels
file convert – Convert audio file
group show channels – Display active channels with group(s)
help – Display help list, or specific help on a command
indication add – Add the given indication to the country
indication remove – Remove the given indication from the country
indication show – Display a list of all countries/indications
keys init – Initialize RSA key passcodes
keys show – Displays RSA key information
local show channels – List status of local channels
logger mute – Toggle logging output to a console
logger reload – Reopens the log files
logger rotate – Rotates and reopens the log files
logger show channels – List configured log channels
meetme – Execute a command on a conference or conferee
mixmonitor – Execute a MixMonitor command.
moh reload – Music On Hold
moh show classes – List MOH classes
moh show files – List MOH file-based classes
no debug channel (null)
originate – Originate a call
realtime load – Used to print out RealTime variables.
realtime update – Used to update RealTime variables.
restart gracefully – Restart Asterisk gracefully
restart now – Restart Asterisk immediately
restart when convenient – Restart Asterisk at empty call volume
sla show – Show status of Shared Line Appearances
soft hangup – Request a hangup on a given channel
stop gracefully – Gracefully shut down Asterisk
stop now – Shut down Asterisk immediately
stop when convenient – Shut down Asterisk at empty call volume
stun debug – Enable STUN debugging
stun debug off – Disable STUN debugging
udptl debug – Enable UDPTL debugging
udptl debug ip – Enable UDPTL debugging on IP
udptl debug off – Disable UDPTL debugging
AEL commands
ael debug contexts – Enable AEL contexts debug (does nothing)
ael debug macros – Enable AEL macros debug (does nothing)
ael debug read – Enable AEL read debug (does nothing)
ael debug tokens – Enable AEL tokens debug (does nothing)
ael nodebug – Disable AEL debug messages
ael reload – Reload AEL configuration
Agents commands
agent logoff – Sets an agent offline
agent show – Show status of agents
agent show online – Show all online agents
AGI commands
agi debug – Enable AGI debugging
agi debug off – Disable AGI debugging
agi dumphtml – Dumps a list of agi commands in html format
agi show- List AGI commands or specific help
dnsmgr reload – Reloads the DNS manager configuration
dnsmgr status – Display the DNS manager status
http show status – Display HTTP server status
Console commands
console active – Sets/displays active console
console answer – Answer an incoming console call
console autoanswer – Sets/displays autoanswer
console boost – Sets/displays mic boost in dB
console dial – Dial an extension on the console
console flash – Flash a call on the console
console hangup – Hangup a call on the console
console mute – Disable mic input
console send text – Send text to the remote device
console transfer – Transfer a call to a different extension
console unmute – Enable mic input
Core related commands
core clear profile – Clear profiling info
core set debug channel – Enable/disable debugging on a channel
core set debug – Set level of debug chattiness
core set debug off – Turns off debug chattiness
core set global – Set global dialplan variable
core set verbose – Set level of verboseness
core show applications – Shows registered dialplan applications
core show application – Describe a specific dialplan application
core show audio codecs – Displays a list of audio codecs
core show channels – Display information on channels
core show channel – Display information on a specific channel
core show channeltypes – List available channel types
core show channeltype – Give more details on that channel type
core show codecs – Displays a list of codecs
core show codec – Shows a specific codec
core show config mappings – Display config mappings (file names to config engines)
core show file formats – Displays file formats
core show file version – List versions of files used to build Asterisk
core show functions – Shows registered dialplan functions
core show function – Describe a specific dialplan function
core show globals – Show global dialplan variables
core show hints – Show dialplan hints
core show image codecs – Displays a list of image codecs
core show image formats – Displays image formats
core show license – Show the license(s) for this copy of Asterisk
core show profile – Display profiling info
core show switches – Show alternative switches
core show threads – Show running threads
core show translation – Display translation matrix
core show uptime – Show uptime information
core show version – Display version info
core show video codecs – Displays a list of video codecs
core show warranty – Show the warranty (if any) for this copy of Asterisk
Database commands
database del – Removes database key/value
database deltree – Removes database keytree/values
database get – Gets database value
database put – Adds/updates database value
database show – Shows database contents
database showkey – Shows database contents
Dialplan commands
dialplan add extension – Add new extension into context
dialplan add ignorepat – Add new ignore pattern
dialplan add include – Include context in other context
dialplan reload – Reload extensions and *only* extensions
dialplan remove extension – Remove a specified extension
dialplan remove ignorepat – Remove ignore pattern from context
dialplan remove include – Remove a specified include from context
dialplan save – Save dialplan
dialplan show – Show dialplan
DUNDI commands
dundi debug – Enable DUNDi debugging
dundi flush – Flush DUNDi cache
dundi lookup – Lookup a number in DUNDi
dundi no debug – Disable DUNDi debugging
dundi no store history – Disable DUNDi historic records
dundi precache – Precache a number in DUNDi
dundi query – Query a DUNDi EID
dundi show entityid – Display Global Entity ID
dundi show mappings – Show DUNDi mappings
dundi show peers – Show defined DUNDi peers
dundi show peer – Show info on a specific DUNDi peer
dundi show precache – Show DUNDi precache
dundi show requests – Show DUNDi requests
dundi show trans – Show active DUNDi transactions
dundi store history – Enable DUNDi historic records
GTalk & Jabber commands
gtalk reload – Enable Jabber debugging
gtalk show channels – Show GoogleTalk Channels
jabber debug – Enable Jabber debugging
jabber debug off – Disable Jabber debug
jabber reload – Enable Jabber debugging
jabber show connected – Show state of clients and components
jabber test – Shows roster, but is generally used for mog’s debugging.
IAX2 commands
iax2 provision – Provision an IAX device
iax2 prune realtime – Prune a cached realtime lookup
iax2 reload – Reload IAX configuration
iax2 set debug – Enable IAX debugging
iax2 set debug jb – Enable IAX jitterbuffer debugging
iax2 set debug jb off – Disable IAX jitterbuffer debugging
iax2 set debug off – Disable IAX debugging
iax2 set debug trunk – Enable IAX trunk debugging
iax2 set debug trunk off – Disable IAX trunk debugging
iax2 show cache – Display IAX cached dialplan
iax2 show channels – List active IAX channels
iax2 show firmware – List available IAX firmwares
iax2 show netstats – List active IAX channel netstats
iax2 show peers – List defined IAX peers
iax2 show peer – Show details on specific IAX peer
iax2 show provisioning – Display iax provisioning
iax2 show registry – Display IAX registration status
iax2 show stats – Display IAX statistics
iax2 show threads – Display IAX helper thread info
iax2 show users – List defined IAX users
iax2 test losspct – Set IAX2 incoming frame loss percentage
Manager commands
manager show command – Show a manager interface command
manager show commands – List manager interface commands
manager show connected – List connected manager interface users
manager show eventq – List manager interface queued events
manager show users – List configured manager users
manager show user – Display information on a specific manager user
MGCP commands
mgcp audit endpoint – Audit specified MGCP endpoint
mgcp reload – Reload MGCP configuration
mgcp set debug – Enable MGCP debugging
mgcp set debug off – Disable MGCP debugging
mgcp show endpoints – List defined MGCP endpoints
Module management
module load – Load a module by name
module reload – Reload configuration
module show – List modules and info
module show like – List modules and info
module unload – Unload a module by name
PRI commands
pri debug span – Enables PRI debugging on a span
pri intense debug span – Enables REALLY INTENSE PRI debugging
pri no debug span – Disables PRI debugging on a span
pri set debug file – Sends PRI debug output to the specified file
pri show debug – Displays current PRI debug settings
pri show spans – Displays PRI Information
pri show span – Displays PRI Information
pri unset debug file – Ends PRI debug output to file
Queue commands
queue add member – Add a channel to a specified queue
queue remove member – Removes a channel from a specified queue
queue show – Show status of a specified queue
rtcp debug ip – Enable RTCP debugging on IP
rtcp debug – Enable RTCP debugging
rtcp debug off – Disable RTCP debugging
rtcp stats – Enable RTCP stats
rtcp stats off – Disable RTCP stats
rtp debug ip – Enable RTP debugging on IP
rtp debug – Enable RTP debugging
rtp debug off – Disable RTP debugging
say load – Set/show the say mode
show parkedcalls – Lists parked calls
show queue – Show information for target queue
show queues – Show the queues
SIP commands
sip history – Enable SIP history
sip history off – Disable SIP history
sip notify – Send a notify packet to a SIP peer
sip prune realtime – Prune cached Realtime object(s)
sip prune realtime peer – Prune cached Realtime peer(s)
sip prune realtime user – Prune cached Realtime user(s)
sip reload – Reload SIP configuration
sip set debug – Enable SIP debugging
sip set debug ip – Enable SIP debugging on IP
sip set debug off – Disable SIP debugging
sip set debug peer – Enable SIP debugging on Peername
sip show channels – List active SIP channels
sip show channel – Show detailed SIP channel info
sip show domains – List our local SIP domains.
sip show history – Show SIP dialog history
sip show inuse – List all inuse/limits
sip show objects – List all SIP object allocations
sip show peers – List defined SIP peers
sip show peer – Show details on specific SIP peer
sip show registry – List SIP registration status
sip show settings – Show SIP global settings
sip show subscriptions – List active SIP subscriptions
sip show users – List defined SIP users
sip show user – Show details on specific SIP user
Skinny commands
skinny reset – Reset Skinny device(s)
skinny set debug – Enable Skinny debugging
skinny set debug off – Disable Skinny debugging
skinny show devices – List defined Skinny devices
skinny show lines – List defined Skinny lines per device
Voicemail commands
voicemail show users – List defined voicemail boxes
voicemail show users for – List defined voicemail boxes for target context
voicemail show zones – List zone message formats
Zaptel commands
zap destroy channel – Destroys a channel
zap restart – Fully restart zaptel channels
zap show cadences – List cadences
zap show channels – Show active zapata channels
zap show channel – Show information on a channel
zap show status – Show all Zaptel cards status


backup and restore MySQL database

backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql

restore:# mysql -u root -p[root_password] [database_name] < dumpfilename.sql
Dump only certain tables from a MySQL Database
mysqldump --user=XXXXXXXX --password=XXXXXXXX --databases DB_NAME --tables TABLE_NAME > /PATH/TO/DUMPFILE.SQL
on Heart server in /root/mysqltools i have some scripts:
to backup only one table run:
# ./one-table-dump.sh <dbname> <tablename>
#!/bin/bash
# one-table-dump.sh
/usr/bin/mysqldump --user=root --password=bigfoot123 --databases $1 --tables $2 | /bin/gzip -9 > $1.$2-/usr/bin/mysqldump --user=root --password=bigfoot123 --databases $1 --tables $2 | /bin/gzip -9 > $1.$2-`date +'%Y-%d-%m'`.gz

Recover MySQL root Password

You can recover MySQL database server password with following five easy steps.
Step # 1: Stop the MySQL server process.
Step # 2: Start the MySQL (mysqld) server/daemon process with the --skip-grant-tables option so that it will not prompt for password.
Step # 3: Connect to mysql server as the root user.
Step # 4: Setup new mysql root account password i.e. reset mysql password.
Step # 5: Exit and restart the MySQL server.
Here are commands you need to type for each step (login as the root user):

Step # 1 : Stop mysql service

# /etc/init.d/mysql stop
Output:
Stopping MySQL database server: mysqld.

Step # 2: Start to MySQL server w/o password:

# mysqld_safe --skip-grant-tables &
Output:
[1] 5988
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[6025]: started

Step # 3: Connect to mysql server using mysql client:

# mysql -u root
Output:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>

Step # 4: Setup new MySQL root user password

mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit

Step # 5: Stop MySQL Server:

# /etc/init.d/mysql stop
Output:
Stopping MySQL database server: mysqld
STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[6186]: ended
[1]+  Done                    mysqld_safe --skip-grant-tables

Step # 6: Start MySQL server and test it

# /etc/init.d/mysql start
# mysql -u root -p

if you have lost RAID in ubuntu

do
df
to see all mounted devices. If you cant see your mounted RAID, check:
cat /proc/mdstat
cat /sys/block/md0/md/array_state

cat /sys/block/md5_d/md/array_state
to check status use
mdadm -D /dev/md0
mdadm -D /dev/md_d5
check conf file, if its empty, add your own entry, as it highlighted below to  to /etc/mdadm/mdadm.conf. To find out your device UUID use blkid

# mdadm.conf
#
# Please refer to mdadm.conf(5) for information about this file.
#

# by default, scan all partitions (/proc/partitions) for MD superblocks.
# alternatively, specify devices to scan, using wildcards if desired.
DEVICE partitions

# auto-create devices with Debian standard permissions
CREATE owner=root group=disk mode=0660 auto=yes

# automatically tag new arrays as belonging to the local system
HOMEHOST 

# instruct the monitoring daemon where to send mail alerts
MAILADDR root

# definitions of existing MD arrays
ARRAY /dev/md0 level=raid1 num-devices=4 UUID=f6a9dc91:113e2dcc:e98f006c:315aa4a8

# This file was auto-generated on Tue, 29 Dec 2009 03:16:26 +0800
# by mkconf $Id$

ARRAY /dev/md_d5 level=raid5 num-devices=4 UUID=815a9f2b:ed3c8759:f827a6be:9a5128ee

Saturday, September 21, 2013

howto restart startx

sudo kill `cat /tmp/.X0-lock`
startx

howto move table to another db

ALTER TABLE base1.table RENAME base2.table

Dell PowerConnect 3024/48/5012 Password Reset


Found this on the Dell Forums:
For the 3024/3048/5012 products:
1. Connect to the switch via the console port and manually reboot the switch
2. As soon as power is applied, press and hold the ESC key
3. At the command prompt, type “EmergencyPasswordReset” (case-sensitive without the quotation marks)
4. At the confirm (Y/N) prompt, type X
5. If done properly, you will receive a message stating that the password has been disabled
6. Type G and hit enter to reboot the switch
The switch will reboot with the password disabled.
This saved us in a pinch. Just goes to show that Physical Security is still the first and most important security.