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а – 1729
Дружба 2 – 1582

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

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

пеша сме