Cheatography
https://cheatography.com
Miscellaneous things I sometimes use but often forget
This is a draft cheat sheet. It is a work in progress and is not finished yet.
Permissions and Ownership
change a file's permissions
|
change a file's owner / group chown owner[:group] file
|
change a file's group
|
show detailed permissions (ACL)
|
Commandline XSLT
latest java -jar saxon9he.jar -xsl:transform.xsl -s:source.xml -o:output.xml
|
6.5.5 java -jar saxon.jar -o output.xml source.xml transform.xslt
|
PHP
debug_backtrace
/ debug_print_backtrace
|
phpDocumentor
php phpDocumentor.phar -c phpdoc.apibrary.xml
|
XSLT
commandline java -jar /saxon.jar -o /output.html ~/source.xml transform.xslt
|
Rhino JS
Add java class var HashMap = java.util.HashMap;
|
XML: from string var availPubs = new XML(prodXML.get('pubsAvailableToCustomer'));
- note: contains contents of root XML element, cannot access root element
|
XML: access element var pubs = availPubs.pub
- note: if multiple matches, returns XMLList
|
XML: access attribute
|
Misc. Command Line
IP address
|
OS info
|
Host info
|
|
|
Searching
search file contents grep -i "pattern" file.txt
|
search file contents in current directory
|
search file contents recursively in current directory
|
search file contents recursively for unique entries and count grep -rioh "<xyz>.*</xyz>" . | sort | uniq -c
|
find a file find /path -name "file.xml"
|
find a directory find /path -type d -name "whatever"
|
find command source
|
find and replace perl -i.bak -pe 's/find/replace/g'
|
Viewing Files
First N lines
|
Last N lines
|
Last lines + live output of new lines
|
Range of lines in file
|
|
|
Paths
hosts file C:\Windows\system32\drivers\etc\hosts
|
apache error log /var/log/httpd/error_log
(or apache2
)
|
Drush - DB Backup & Restore
drush cc all
drush wd-delete all
drush sql-dump --result-file=~/drupaldb/backup.sql
`drush sql-connect` < ~/drupaldb/backup.sql
|
MediaWiki
add category [[Category:Platform]]
|
link to image [[Media:picture.png|screenshot]]
|
display image [[Image:picture.png|screenshot]]
|
dictionary list
|
category tree <categorytree mode=pages>Interface</categorytree>
|
syntax highlighting <syntaxhighlight lang="php"> // code here </syntaxhighlight>
|
MediaWiki Table
{|
! style="text-align:left;" | Item
! Amount
! Cost
|-
| Orange
| 10
| 7.00
|-
| Bread
| 4
| 3.00
|}
|
|