Wysyłanie SMS przez bramkę mBox orange.pl – wykorzystanie php+curl

September 18, 2009 – 03:45

Trochę uporządkowałem skrypty i postanowiłem udostępnić skrypt do wysyłania sms’ów przez bramkę mBox orange.pl.

Jestem ciekawy ewentualnych ulepszeń, więc jak coś to proszę podsyłać nowe wersje ;)

UPDATE:
Skrypt został wzbogacony o możliwość wysyłania dowolnie długich wiadomości. Dzieli wpisaną wiadomość na 640 znaków i wysyła funkcją jako osobne smsy.
Ponadto, końcowy stan smsów jest pobierany przez Xpath.

Plik PHPS

Spamassassin + vpopmail + sa-learn + learning from IMAP folders

May 17, 2009 – 00:37

Below is a quick solution to making spamassassin learn from specific IMAP folders. Script represents a daily cron script and I just used sudo vpopmail (has to be the same as your spamd user) to simplify things. You probably should use user specific crontab…

1
2
3
4
5
#!/bin/bash
for F in `find /home/vpopmail/domains -type d -name '.Junk' -print`;
do sudo -H -u vpopmail /usr/bin/sa-learn --spam $F/cur/* &> /dev/null;
rm -f $F/cur/*;
done;

php strpos array

March 26, 2009 – 07:57

I needed a PHP function to check whether a string contained one of the array values. As we know strpos does’t accept input as an array so I had to tweak it  bit. Below is an example of what I did:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function strpos_array($string, $values) {
    $hits = 0; //will give number of values found in a string
    foreach ($values as $try) {
        $pos = strpos($string, $try);
        if ($pos !== false){
            $hits++; // you can do array_push here to get the values
        }
    }
    if ($hits==0) { //if none value from array was found returns false
        return false;
    }
    else { //I just needed a simple true/false boolean
       return true;
    }
}

FPDF polskie wolne czcionki

January 19, 2009 – 13:13

Postanowiłem wreszcie trochę uporządkować czcionki używane do generowania dokumentów pdf oraz obrazków wykorzystujących czcionki ttf. Załączam zestaw gotowej do zainstalowania czytelnej czcionki z pakietu liberation-fonts. Które są upowszechnione na licencji GPL.

Pobierz

Odmiana imion php mysql

January 12, 2009 – 05:26

Postanowiłem udostępnić uzupełniony zbiór odmian polskich imion dla bazy MySQL.

Plik jest gotowy do importu do bazy MySQL, zawiera imiona,  odmianę, płeć oraz ilość sylab występujących w imieniu. Można go wykorzystać na przykład w skryptach php wysyłających życzenia urodzinowe lub pozdrowienia.

W przypadku braku odmiany, proszę wpisać w komentarzach to uzupełnię.

Suhosin and maximum $_POST variables limit

April 23, 2008 – 23:30

I had a problem of more than 200 $_POST variables in one of my php scripts. Something was limiting the script not to process more than 200 in the $_POST array.

After unsuccessfully trying to find some info about how to change it in php.ini or apache.conf I found a solution using Suhosin:

You simply add the following to your php.ini file after loading the suhosin module:

[suhosin]
suhosin.post.max_vars = 2000
suhosin.request.max_vars = 2000

That’s easy now :)

Update: remember to restart Apache after making these changes.

Suhosin – customize php security

April 9, 2008 – 21:46

I was trying to configure my virtualhosts to have different php options regarding shell access. After some research I came up with Suhosin solution, which solved problems with setting disable_functions per virtualhost. Look it up!

March 10, 2008 – 12:36

Formulate and stamp indelibly on your mind a mental picture of yourself as succeeding. Hold this picture tenaciously. Never permit it to fade. Your mind will seek to develop the picture.”

Norman Vincent Peale, Author

Skiing 2008

February 3, 2008 – 16:18

I just uploaded some fresh pictures from skiing in Hochsoelden, Tirol, Austria. Also you will find some pictures from Schwangau, Hohenschwangau and Neuschwanstein. Yes I was writing these names from memory ;)

Have a look, they are great.

Getting the Spanish N.I.E. – social security number for foreigners

October 7, 2007 – 20:21

Just recently I obtained the Numero de Identidad de Extranjero, which allows me in Spain to get a job, buy a car/house etc. Very important number if you want to live in Spain for a longer time. The number you get is valid forever, you just have to renew the certificate (every 5 years).

For European Union citizens there are 2 steps involved in obtaining it. The first one is to get an appointment. You can try calling the COMISARIA GENERAL DE EXTRANJERIA to get the appointment but in my case it was easier to go to the office at 4am and wait for the registration at 9am. The good thing was that I went there with 3 friends, so we were not that bored as you can see on the pictures. Remember to bring your passport for that meeting. The officer will schedule you for an appointment that will take place after about 8 days. You will get forms needed to be filled out and a form to pay 6.70EUR for the issuance of the number.

Fill out the forms, pay the “tasa” at any bank, bring your passport, 1 photocopy of your passport and to be on the safe side, bring 3 recent photographs of yourself (I didn’t need to give them in but…). You should obtain you N.I.E. number on the same day.