Forbered lyd for afspilning i Asterisk

1: Lav lyden i Garageband, mix den ned og eksporter den som Mp3
2: Åben filen i Audacity
3: Skær det ene spor væk og gem det andet som en wav fil
4: Upload wav filen til serverens rodbibliotek
5: Log ind på serveren
6: cd til /usr/share/asterisk/sounds
7: kør kommandoen : sox /skjultnummer.wav -r 8000 -c 1 -s -w skjultnummer.wav

Herefter kan du afspille lyden med flg. kommando i en dialplan:

exten => 1000,50,Playback(“skjultnummer”);

Udgivet i Knowledge Base, Old Base | Skriv en kommentar

MySQL udtræk med automatiske linienumre

mysql> select lecture,title,@i:=@i+1 as iterator from opgaver,(select @i:=0) foo where lecture=11 order by `order`;
+---------+---------------------+----------+
| lecture | title               | iterator |
+---------+---------------------+----------+
|      11 | Gruppens opst?en    |        1 | 
|      11 | Favoritemne         |        2 | 
|      11 | Indspilningsstudier |        3 | 
|      11 | Antal medlemmer     |        4 | 
+---------+---------------------+----------+
4 rows in set (0.02 sec)

 

Udgivet i Knowledge Base, Old Base | Skriv en kommentar

check if all wordpress installations is updated

This will probably not work, if a non-wordpress webdir contains a directory named ‘wp-includes’.
Those webdevelopers were probably smoking pot anyway 🙂

web01:~# find /var/www/virtual -type d -name wp-includes | xargs -n1 -I{} -i bash -c ‘echo {} | cut -d/ -f5- && grep \$wp_version {}/version.php && echo’ | less

Udgivet i Knowledge Base, Linux, Old Base, Wordpress | Skriv en kommentar

ispcp disable mail for a domain

nano /etc/postfix/ispcp/domains
comment domain
cp /etc/postfix/ispcp/domains /etc/ispcp/postfix/working
cd /etc/postfix/ispcp
postmap domains

!!!!!
New and improved version
***

It works with the gui:

– switch to the user (dom.tld)
– delete all mail accounts
– switch back to the corresponding reseller
– change the domain, set the numer of mail accounts to -1 (disable)
– change the traffic limit
-> ok
– if needed: change the domain, set the traffic limit back to the previus number

this way the domain is removed from the domain hashfile (the mportant thing is the change of the transfer volume).

Note by BT: The traffic limit trick is needed to invoke the ISPCP Engine, which updates the domains.

Udgivet i Knowledge Base, Linux, Old Base | Skriv en kommentar

OpenVZ recipies

#tcpsockets (must set both upper mem limit and numsockets)
VZID=199 SOCKET_MB=5 NUM_SOCKETS=360 \
SOCKET_BAR=$((1024**2*$SOCKET_MB)) \
SOCKET_LIM=$(($SOCKET_BAR+($NUM_SOCKETS*2560))) ; \
vzctl set $VZID \
–numtcpsock $NUM_SOCKETS \
–tcpsndbuf $SOCKET_BAR:$SOCKET_LIM \
–tcprcvbuf $SOCKET_BAR:$SOCKET_LIM \
–save

#othersockets, ie mysql etc. (must set both upper mem limit and numsockets)
VZID=199 SOCKET_MB=5 NUM_SOCKETS=360 \
SOCKET_BAR=$((1024**2*$SOCKET_MB)) \
SOCKET_LIM=$(($SOCKET_BAR+($NUM_SOCKETS*2560))) ; \
vzctl set $VZID \
–numothersock $NUM_SOCKETS \
–othersockbuf $SOCKET_BAR:$SOCKET_LIM \
–save

#kmemsize
VZID=199 KMEM_MB=30 \
MB=$((1024**2)) \
KMEM_LIM=$(($KMEM_MB*$MB)) \
KMEM_BAR=$(($KMEM_LIM-($KMEM_LIM/10))) ; \
vzctl set $VZID \
–kmemsize $KMEM_BAR:$KMEM_LIM \
–save

#privvmpages
VZID=199 MEM_MB=1024 KMEM_MB=20 \
PAGE_MB=$((1024**2/4096)) \
MB=$((1024**2)) \
KMEM_LIM=$(($KMEM_MB*$MB)) \
KMEM_BAR=$(($KMEM_LIM-($KMEM_LIM/10))) \
MEM_BAR=$((($MEM_MB-$KMEM_MB)*$PAGE_MB)) \
MEM_LIM=$(($MEM_BAR+($MEM_BAR/10))); \
vzctl set $VZID \
–privvmpages $MEM_BAR:$MEM_LIM \
–kmemsize $KMEM_BAR:$KMEM_LIM \
–save

#disk
VZID=199 DISKGB=8 \
GB=$((1024**2)) \
DISKSOFT=$(($DISKGB*$GB)) \
DISKHARD=$(($DISKSOFT+($DISKSOFT/10))); \
vzquota setlimit $VZID -b $DISKSOFT -B $DISKHARD

Udgivet i Knowledge Base, Linux, Old Base | Skriv en kommentar

Decrypt SQL and Mail password from ISPCP

#!/usr/bin/perl
#
# This is GPL!
#
# Writen by Mikkel Christensen, Mikjaer Aps
#

chdir(“/var/www/ispcp/engine”);
require ‘/var/www/ispcp/engine/ispcp_common_code.pl’;

my ($rs, $real_password);
my $pass = $ARGV[0];;

($rs,$real_password) = decrypt_db_password($pass);
printf (“%s”,$real_password);

exit(0);
~

Udgivet i Knowledge Base, Linux, Old Base | Skriv en kommentar

USB Serial OSX install

The new unit:
Has no label on the unit.
Vendor-id: 0x0403 (Future Technology Devices International Limited)
Product-id: 0x6001

Download the driver from: http://www.ftdichip.com/Drivers/VCP.htm

The old unit:
Is labeled Belkin on both sides of the unit.
Vendor-id: 0x050d (Belkin Corporation)
Product-id: 0x0109

Havent found the driver yet …

Udgivet i Knowledge Base, Old Base | Skriv en kommentar

SSL SMTP operation

% perl -MMIME::Base64 -e ‘print encode_base64(“\000base\@example.net\0001234abcd”)’
AGJhc2VAZXhhbXBsZS5uZXQAMTIzNGFiY2Q=

% telnet 1.2.3.4 25
220 smtp.example.net NO UCE ESMTP
ehlo testing
250-smtp.example.net NO UCE
250-STARTTLS
250-PIPELINING
250 8BITMIME
quit

% openssl s_client -starttls smtp -crlf -connect 1.2.3.4:25

220 a.mx.jms1.net NO UCE ESMTP
ehlo testing
250-a.mx.jms1.net NO UCE
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-PIPELINING
250 8BITMIME

AUTH PLAIN AGptczFAam1zMS5uZXQAbm90Lm15LnJlYWwucGFzc3dvcmQ=
235 ok, go ahead (#2.0.0)

mail from: <base@example.net>
250 ok
rcpt to: <base@example.net>
250 ok
data
354 go ahead
From: John <base@example.net>
To: Nobody <base@example.net>
Subject: Test from Uni-Fix

Base rules!
.
250 ok 1113954693 qp 29052
quit
221 a.mx.jms1.net NO UCE

Udgivet i Knowledge Base, Linux, Networking, Old Base | Skriv en kommentar

SSL Imap Operation

openssl s_client -connect hostname:993
a login user@example.com password

a1 select inbox
a1 fetch 1 full
a2 fetch 1 body

a3 logout

Udgivet i Knowledge Base, Linux, Old Base | Skriv en kommentar

Skift sprog i Debian (Slip af med sprog)

statscollector2:~# df -h
Filsystem Størr Brugt Tilb Brug% Monteret på
/dev/sda1 227G 704M 215G 1% /
tmpfs 506M 0 506M 0% /lib/init/rw
udev 10M 80K 10M 1% /dev
tmpfs 506M 0 506M 0% /dev/shm

Rediger /etc/locale.gen

Udkommenter det sprog/locale du ikke vil have, hvis alle er udkommenteret snakker den “rigtig” engelsk.

statscollector2:~# locale-gen
Generating locales (this might take a while)…
Generation complete.

statscollector2:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 227G 704M 215G 1% /
tmpfs 506M 0 506M 0% /lib/init/rw
udev 10M 80K 10M 1% /dev
tmpfs 506M 0 506M 0% /dev/shm

Problem solved.

Udgivet i Knowledge Base, Linux, Old Base | Skriv en kommentar