Skip to content

Instantly share code, notes, and snippets.

@paulbarbu
paulbarbu / q
Created December 29, 2011 17:57
Hello.
I'd like to know what's the explanation behind the math done on line #413 in
ext/session/session.c and why couldn't it be just:
total_bits / hash_bits_per_character
Where total_bits equals 128 if the hash function is md5 or 160 if sha1.
@paulbarbu
paulbarbu / .gitignore
Created December 28, 2011 18:49
Google pt. școală
*.aux
*.log
*.pdf
@paulbarbu
paulbarbu / login_flow.txt
Created December 11, 2011 10:11
Login flow
User enters the app(tralala mode), he logs in, I must save the SESSID and the
expiry date in the DB, next time he visits me I must check if he comes with some
PHPSESSID cookies, if he does then I must check if that SESSID is in the DB, if
it is it mustn't be expired, then the user is logged in again, but if that SESSID
is expired he must relog and you must read from line 1 again :D
On logout I just delete his SESSIDs from the DB and destroy the session.
gcc-debug soundgen.c -lsndfile
soundgen.c:10:5: warning: data definition has no type or storage class [enabled by default]
soundgen.c:10:5: warning: type defaults to ‘int’ in declaration of ‘freq’ [enabled by default]
soundgen.c:10:12: error: ‘frequency’ undeclared here (not in a function)
soundgen.c:11:5: error: expected identifier or ‘(’ before ‘for’
soundgen.c:11:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
soundgen.c:11:34: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘++’ token
soundgen.c:16:5: error: expected identifier or ‘(’ before ‘for’
soundgen.c:16:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
soundgen.c:16:36: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘++’ token
@paulbarbu
paulbarbu / working3d
Created December 2, 2011 18:40
Working 3d
ATI X1600: xf86-video-ati
In grub:
pci=nomsi
or
noapic
Or using driconf and .drirc
vblank_mode=1 glxgears
vblank_mode=0 glxgears
Hi.
I have an ATI X1600 card, I have the video driver installed, but I can't get 3D working.
On the wiki for xf86-video-ati it says: Radeons up to the X1xxx series are fully supported, stable, and full 2D and 3D acceleration are provided.
pacman -Qs xf-86-video - http://paste.xinu.at/agD3/
lspci -v - http://paste.xinu.at/LRkJv/
lsmod - http://paste.xinu.at/lXwg2/
cat /etc/group | grep video - video:x:91:paullik
glxinfo - http://paste.xinu.at/LzL/
glxgears - black window and upon exit it says:
[paullik@localhost ~]$ amixer -c0 contents
numid=20,iface=MIXER,name='Master Playback Switch'
; type=BOOLEAN,access=rw------,values=1
: values=on
numid=6,iface=MIXER,name='Headphone Playback Switch'
; type=BOOLEAN,access=rw------,values=2
: values=on,on
numid=21,iface=MIXER,name='PCM Playback Volume'
; type=INTEGER,access=rw---RW-,values=2,min=0,max=255,step=0
: values=249,249
[paullik@localhost medii]$ time ./a.out
real 16m16.046s
user 13m43.936s
sys 0m12.256s
[paullik@localhost medii]$ time wc medii.out
104195846 1038669292 2327924884 medii.out
Tema:
Un fisier contine media la o materie a unui elev si nota sa la teza. Stiind ca media= (3 * media notelor + nota_teza)/4
, stim de asemenea ca elevul poate avea minim 3 maxim 10 note la disciplina respectiva , sa se afiseze toate modalitatile sale de notare
exp:
medii.in 5.625 3 // media= 5.625 nota teza= 3
medii.out
@paulbarbu
paulbarbu / functionsVSconstruct.txt
Created October 23, 2011 19:11
PHP function vs construct
[18:55] <+flavius> starlays: ca sa afli daca ceva e functie e simplu
[18:55] <+flavius> php -r "var_dump(token_get_all('<?php isset'));"
[18:56] <+flavius> iti va afisa numarul 350 pentru "isset"
[18:56] <+flavius> acela este numarul operatorului, sau pe intelesul lui paullik, 350 este opcode-ul lui isset()
[18:56] <+flavius> si apoi apelezi: php -r "var_dump(token_name(350));"
[18:57] <+flavius> un T_STRING ar însemna un apel de functie, altfel este un construct al limbajului
[18:57] <paullik> oho :) nice things
[18:58] <+flavius> veti avea nevoie de modulul tokens.so