peshka.org – WP site

peshka.org – WP site

peshka's reminder site – ver. 2.0

peshka.org – WP site RSS Feed
 
 
 
 

Reminders

Create MySQL User    (показване)

GRANT ALL ON database.* TO user@localhost IDENTIFIED BY “password”;
FLUSH PRIVILEGES;

Пощенски кодове    (показване)

Младост 1 – 1750 / 1784
Младост 1а – 1729
Дружба 2 – 1582
Слатина – 1574

Apache    (показване)

Apache official site
Generating SSL sertificate for Apache – self signed :-)
Generating again…

Mplayer config file    (показване)

softvol=yes                        # sound volume – lvl up #
softvol-max=500             # sound volume – lvl up #
ass=yes                              # OSD fonts #
ass-font-scale=1.5            # font size #
ass-use-margins=yes
#ass-bottom-margin=50  # make black line under the film – 50px#
ass-color=FFFFFE00      # font colors and transparancy #
fontconfig=yes                  # for encoding opts #
subcp=cp1251

Burn UDF/ISO DVD - terminal    (показване)

growisofs -speed=4 -Z /dev/<dvd character device> -udf <directory to burn>

RECOVER Mysql root password    (показване)

Here is a good link to change mysql root password if you have root access to the machine:

The fastest way to change it (debian based):

create sql that changes the password – sometginh like this:

file= “/tmp/file-$$.sql”
echo “SET PASSWORD FOR root@localhost = PASSWORD(‘NEW ROOT PASS’);” > $file
/etc/init.d/mysql stop
mysqld_safe –init-file=$file &
killall -9 mysqld_safe
/etc/init.d/mysql start

Some additional links:

recoever mysql root pass
recoever mysql root pass (long explanation)

recoever 3 choice – more variants

WIRELESS devices in linux    (показване)

All for wireless in linux – supported by HP (good source)

The Linux Wireless WiKi – nice (supported modes for the diferent drivers)

ipw2200-ap – special driver to make AP from intel ipw2200 wifi card

also GOOD site to check about compatibility on any card/chip

build AP basics / build secure AP.. + basics again / have to read this too (no wpaX) / IBM Developers help on buliding AP

PostGres proccess list + OPTIMIZE    (показване)

SELECT p.procpid, p.usename, p.datname, p.query_start, p.backend_start, p.client_addr, p.current_query
FROM pg_stat_activity AS p;

general optimisation

VACUUM a table

Routine Reindex

Configuration Options


BD backup

Optmize Postgres 8.x    (показване)

# create new table space in different location – better on diferent disk
CREATE TABLESPACE ts_name LOCATION ‘‘;

# find indexes of the tabe
SELECT relname, relkind, reltuples, relpages FROM pg_class where relname like ‘table_name%’ AND relkind like ‘i’;

# change the user tablespace ( do for tables and index tables )
ALTER TABLE table_name SET TABLESPACE new_tablespace

nice explained performance tunning tips

postgresql documentation about configuration

USB boot from GRUB    (показване)

in the grub console write this (note that you have autocompleet):

> root (hd,…)
> kernel /casper/vmlinuz file=preseed/kubuntu.seed boot=casper ramdisk_size=1048576 root=/dev/ram rw quiet splash
> initrd /casper/initrd.gz
> boot

View webPage From console    (показване)

page body:

wget -qO – <URL>

curl <URL>

headers:

wget -S <URL>

curl -I <URL>

Добавяне на мрежов маршрут    (показване)

Добавяне на мрежа

route add -net <net ip> netmask <mask> gw <gateway ip for this route> <interface>

Добавяне на хост

route add -host <host ip> gw <gateway ip for this route> <interface>

Разглеждане и убиване на postgresql заявки    (показване)

Да кажем че базата се казва dbase -

Разглеждане на заявката:

psql -U postgres dbase -c “SELECT datname,procpid,query_start,current_query FROM pg_stat_activity;”

Колоната procpid е с номера на заявките – той се изполва при убиването. Да кажем че процеса е с pid номер 20128:

psql -U postgres dbase -c “SELECT * FROM pg_cancel_backend(20128); “

Mencoder to x264 and 2 pass    (показване)

average bitrate

mencoder “source.avi” -ovc x264 -x264encopts bitrate=1000:pass=1:threads=3:qp_min=1:qp_max=40:turbo=1 -oac copy -o /dev/null
mencoder “source.avi” -ovc x264 -x264encopts bitrate=1000:pass=2:threads=3:qp_min=1:qp_max=40 -oac copy -o “autput.avi”

ref:

http://web.njit.edu/all_topics/Prog_Lang_Docs/html/mplayer/encoding.html

man mencoder

Make apt repository with pgp key    (показване)

make deb files and put them in some directory (rep_dir)

go to this directory (cd rep_dir)

generate Packages, Sources and Release files (must have dpkg-dev installed)

dpkg-scanpackages . > Packages
dpkg-scansources . > Sources
gzip -c Packages > Packages.gz
gzip -c Sources > Sources.gz

echo “Archive: stable
Component: main
Origin: Economedia
Label: Economedia Debian repository
Architecture: i386
Description: Economedia debian repository
MD5Sum:
” > Release

Generate md5sums and put them in Release file. Here is a lame example for this:

ls Packages* Sources* Release | while read ln
do
md=`md5sum $ln |awk {‘ print $1 ‘}`
sz=`du -sb $ln`
echo ” $md $sz” >> Release.tmp
done

cat Release.tmp >> Release
rm -f Release.tmp

ls Packages* Sources* Release | while read ln
do
md=`md5sum $ln |awk {‘ print $1 ‘}`
sz=`du -sb $ln`
echo ” $md $sz” >> Release.tmp
done

echo “Archive: stable
Component: main
Origin: Economedia
Label: Economedia Debian repository
Architecture: i386
Description: Economedia debian repository
MD5Sum:
`cat Release.tmp`” > Release

put in sources.list the line for the repository
(
something like:
deb http://your.domain/path/if/you/have/ ./
)

This is all you need for repository not signed with pgp key.

If you want to generate pgp key and sign the Release file do this:

gpg –gen-key # generate key

you can see the new key number  – something like this “pub 1024D/3FD806D7″  – the number is 3FD806D7

gpg –export 3FD806D7 > gpg.key #you put the file in your repository dir

wget -q -O - http://your.domain/path/if/you/have/gpg.key | sudo apt-key add – # to put the key in the client

gpg –sign -bao Release.gpg Release # to sign your release file

that’s all .

dd + gzip + split - backup and restore     (показване)

# HDD backup + gzip commpress + splt into 2GB files
dd if=/dev/sda1 bs=4M | gzip -c | split -b 2000m – /path/to/baskup/sda1-backup.img.gz.

# Restore from multiple commpresed with gzip files
cat /path/to/baskup/sda1-backup.img.gz.* | gzip -dc | dd of=/dev/sda1 bs=4M

Replace string into file    (показване)

perl -p -i -e “s/<old str>/<new str>/g” <file /path/name>

??

perl -p -i.bak -e "next if /^sandwich,hamburger,/" comma.file
??
perl -n -i.bak -e "print unless /^sandwich,hamburger,/" comma.file

RAID1 - software raid with mdadm (for server)     (показване)

#Създаване на дялове на /dev/sda за (1 за swap и 1 за мирор на който ще се направят основните дялове после )

#Типа на дялаовете трябва да стане “Linux RAID autodetect” за да може да стартира от него
#това се прави за всеки дял:

fdisk /dev/sda
натискане на “t”
избор на “fd”
натискане на “w” за запис

sfdisk -d /dev/sda > sda.out  #дъмпване на таблицата с дяловета на диска
#промяна на буквите в sda.out от sda na sdb вътре в файла

sfdisk /dev/sdb < sda.out #копиране на таблицата от sda в sdb (мотамо)

# За всеки дял се създава съответстващо RAID устроиство (за swap може RAID0, за другите 1):
# за основните дялове
mdadm –create /dev/md0 –level=1 –raid-devices=2  /dev/sda1 /dev/sdb1
# за swap
mdadm –create /dev/md1 –level=0 –raid-devices=2  /dev/sda2 /dev/sdb2

#Създаване на дяловете върху /dev/md0

# Форматиране на новите md дялове:
mkfs.ext2 -L boot /dev/md0p1
mkfs.ext4 -L root /dev/md0p5
mkfs.ext4 -L var /dev/md0p6
mkfs.ext4 -L tmp /dev/md0p7
mkfs.ext4 -L usr /dev/md0p8
mkfs.ext4 -L home /dev/md0p9
mkswap /dev/md1

# Създаване на конфигурационен файл:
echo “DEVICES” > /etc/mdadm.conf
mdadm  –examine  –scan –config=mdadm.conf >> /etc/mdadm/mdadm.conf

# Преглед на статуса
cat /proc/mdstat

PHP: compile module with working php     (показване)

# Това е в общия случай:
tar xzvf module-ver.tar.gz
cd module-ver
phpize
./configure
make
make install

# Ако при make се получи грешката “libtool: You should recreate aclocal.m4 …” се прави следното:
phpize
aclocal
libtoolize –force
autoheader
autoconf
./configure
make
make install

ALSA multiple device order setting    (показване)

in the file:
/etc/modprobe.d/alsa-base.conf
add a line like this:
options snd slots=snd-usb-audio,snd-hda-intel

snd-usb-audio will be the first device and snd-hda-intel the second

SW FU II Walkthrough    (показване)

http://www.gameranx.com/features/id/934/article/star-wars-the-force-unleashed-2-walkthrough-video-guide-in-hd/

todo    (показване)

  1. Врата на детската;
  2. Мрежи на прозорците;
  3. Шкафче до миялната (чертеж/схема);
  4. Рафт в коридора (чертеж/схема) – за компютъра?? ;
  5. 2 x 8cm. вентилатора на дом. сървъра + инсталация;
  6. Повторна поправка на улея на сокоизстисквачката;
  7. Слушалки Сони – поправка;
  8. крушки, нощна лампа;
  9. Smollville, white collar + … ;

Change pass. in MySQL     (показване)

mysqladmin -u root -p [oldpassword] [newpass]

Dump/Insert MySQL db    (показване)

bash> mysqldump -u root -p [database name] >file.sql ## dump dhe database
mysql> create database [database name]; ## create the database
mysql> use [database name]; ## select the database
mysql> source file.sql; ## import the database

Recover MySQL table    (показване)

bash> mysql -p
mysql> use [database name];
mysql> REPAIR TABLE xxxx USE_FRM;

Update the freeBSD ports    (показване)

cd /usr/ports
cvsup -g -L2 /etc/supfile.ports

Search in freeBSD ports    (показване)

cd /usr/ports
make fetchindex
make search name=[some name]

Archive things    (показване)

Extracting single file from archive (FreeBSD tested)
tar -xvzf [archive] [full path to file in archive]

Upgreading spamassassin    (показване)

sa-learn -D –mbox –spam [mbox file with spam] 1> spam.log 2>&1

Pipe all to LOG in bash    (показване)

<command> 1> <log file> 2>&1

SSH tunneling    (показване)

from the LAN host:
bash>ssh -N -f -R [new port on REAL-IP]:localhost:22 -l [REAL-IP user] [REAL-IP]
then on a computer anyware in the world:
connect on the REAL-IP computer
bash>ssh -l [LAN computer user] -p [new port on REAL-IP] localhost

Extract from coc archive    (показване)

mencoder [file name].mov -o [oudio output].mp3 -oac lavc -lavcopts acodec=mp3:abitrate=64 -ovc frameno

SC2 - Saves    (показване)

sc2 saves

StarCraft II