Unbuntu language switching customize shortcut
System Settings -> Typing -> Switch to Next Source
System Settings -> Typing -> Switch to Previous Source
System Settings -> Typing -> Switch to Next Source
System Settings -> Typing -> Switch to Previous Source
Yii framework has runController method https://www.yiiframework.com/doc/api/1.1/CWebApplication#runController-detail
It is additional feature which classic MVC frameworks dont have
gitk /path/to/file |
$string=' <?xml version="1.0" encoding="UTF-8"?> <products> <product category="software"> <sku>soft32323</sku> <name>Widget Reporting</name> <price>4550</price> </product> <product category="software"> <sku>soft32323</sku> <sub_category>Business Analysis</sub_category> <name>Pro Reporting</name> <price>2350</price> </product> </products>'; $xml = simplexml_load_string($string); // Search by tag name $products = $xml->xpath("/products/product[sku='soft32323']/name"); print_r($products); // Search by tag attribute $products = $xml->xpath("/products/product[@category='software' and price > 2320]"); print_r($products); |
git remote show origin |
git ls-remote --heads | grep 1234 |
$ecbRates = simplexml_load_file("http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml"); $namespaces = $ecbRates->getDocNamespaces(); $ecbRates->registerXPathNamespace("ecb", $namespaces['']); $array = $ecbRates->xpath("//ecb:Cube[@currency='GBP']/@rate"); echo (string) $array[0]['rate']; |
find /path -user www-data -print |
<?php function convert($from,$to,$amount) { $url = "https://www.google.com/search?q=".$from.$to; $request = curl_init(); $timeOut = 0; curl_setopt ($request, CURLOPT_URL, $url); curl_setopt ($request, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($request, CURLOPT_USERAGENT,"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML , like Gecko) Chrome/68.0.3440.106 Safari/537.36"); curl_setopt ($request, CURLOPT_CONNECTTIMEOUT, $timeOut); $response = curl_exec($request); curl_close($request); preg_match('~<span [^>]* id="knowledge-currency__tgt-amount"[^>]*>(.*?)</span>~si', $response, $finalData); return floatval((floatval(preg_replace("/[^-0-9\.]/","", $finalData[1]))/100) * $amount); } echo convert("USD", "GBP", "1"); ?> |
SHOW COLUMNS FROM Tablename WHERE FIELD = "Fieldname"; |
Use all lowercase for technical / system or development related folders:
/srv/machine1/inbox /srv/machine1/scripts |
Use Capitalized names for personal, desktop-facing, or user-interface symlink folders:
/home/username1/Documents /home/username1/Projects |
Find and rename files uppercase to lowercase
find my_folder -depth -exec rename 's/(.*)\/([^\/]*)/$1\/\L$2/' {} \; |
Find my pattern and rename
find ./ -type f -name '*_en-gb.json' -exec sh -c 'mv "$0" "${0%_en-gb.json}_en-uk.json"' {} \; |