Cheatography
https://cheatography.com
cheat sheet for Moodle Management on ubuntu
This is a draft cheat sheet. It is a work in progress and is not finished yet.
Moodle
location of moodle |
/data/www/customer/public_html |
location of moodledata |
/data/nfs/customer/moodledata |
Context Levels
system |
CONTEXT_SYSTEM |
10 |
user |
CONTEXT_USER |
30 |
course category |
CONTEXT_COURSECAT |
40 |
course |
CONTEXT_COURSE |
50 |
module |
CONTEXT_MODULE |
70 |
block |
CONTEXT_BLOCK |
80 |
Force debug mode in config.php
// Force a debugging mode regardless the settings in the site administration
@error_reporting(E_ALL | E_STRICT);
@ini_set('display_errors', '1');
$CFG->debug = (E_ALL | E_STRICT);
$CFG->debugdisplay = 1;
$CFG->debugusers = '2';
$CFG->cachejs = false;
|
easy get error
echo '<pre>';
print_r($lti);
echo "</pre>\n\n";
die(__FILE__.' ' . 'on line' . ' '.__LINE__);
|
put in PHP file to see contents of variable
|
|
MySQL queries
SELECT COUNT(column_name) FROM table_name WHERE column_name = value;
|
count the number of occurrences of a specific value in a column
update row with value same row
UPDATE table_name SET column1 = column2 WHERE some_column = some_value;
|
You can use the UPDATE statement in MySQL to update a cell in a table with a value from another cell on the same row. Here's an example:
compare a row from a table with another table
SELECT u.username
FROM user u
JOIN other_table o ON u.username LIKE CONCAT(o.username, '%')
|
show all occurencies of a value more than 2x
SELECT column_name, COUNT(column_name) AS count
FROM table_name
GROUP BY column_name
HAVING COUNT(column_name) > 2;
|
i want to show all occurencies of a value in a colum that occur more than 2 times
|
|
Ubuntu
rsync folder without subfolder |
rsync -av --exclude='<subfolder_name>' <source_folder> <destination> |
show files made/modified last 2 hours |
find /path/to/folder -type f -mmin -120 |
write php output to file |
php script.php >> output.txt 2>&1 |
Navigation
j |
cursor up |
k |
cursor down |
h |
cursor left |
l |
cursor right |
e |
end of word |
w |
start of next word |
b |
previous word |
d |
Delete |
dd |
Delete entire line |
gg |
top of file |
G |
bottom of File |
|