This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"SELECT b.id, b.title | |
FROM books AS b | |
JOIN | |
(SELECT (RAND() * | |
(SELECT MAX(id) | |
FROM books)) AS rid) | |
AS rid2 | |
JOIN books_genres | |
ON books_genres.book_id = b.id | |
WHERE b.id >= rid2.rid AND b.id <> $bookId |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$parts = parse_url('http://example.com/user/22?r=4'); | |
// $parts return: | |
// Array | |
// ( | |
// [scheme] => http | |
// [host] => example.com | |
// [path] => /user/22 | |
// [query] => r=4&e=key | |
// ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find /dir -type f -exec chmod 0644 {} \; | |
find /dir -type d -exec chmod 0755 {} \; | |
sudo groupadd wb | |
sudo usermod -a -G wb www-data | |
sudo usermod -a -G wb batchat | |
sudo chgrp -R wb /dir | |
sudo chmod -R g+rwx /dir |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER IGNORE TABLE table_name ADD UNIQUE INDEX unique_index_name(col_1, col_2) | |
DROP INDEX unique_index_name ON table_name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl 'http://rest/v1/posts/2' -X DELETE -H 'Access-Control-Request-Method: DELETE' -H 'Origin: http://site' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36' -H 'Accept: */*' -H 'Referer: http://site/client/' -H 'Connection: keep-alive' -H 'Access-Control-Request-Headers: accept' --compressed | |
curl http://rest/create -H "Content-Type: application/json" -X POST -d '{"username":"xyz","password":"xyz"}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// show all processes (queries) | |
$result = mysql_query("show full processlist"); | |
while($row = mysql_fetch_array($result, MYSQL_NUM)) { | |
print_r($row); | |
} | |
// stop process (query) by id | |
mysql_query("kill 1724864106"); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dir = new DirectoryIterator('/directoryPath/'); | |
$count = 0; | |
foreach($dir as $file) { | |
$count += ($file->isFile()) ? 1 : 0; | |
} | |
print_r($count); |
NewerOlder