I use this minimum HTML Template to write simple output with coding sometimes. <!DOCTYPE html> <html lang=”en”> <head> <meta charset=”utf-8″> <title>title</title> <link rel=”stylesheet” href=”style.css”> <script src=”script.js”></script> </head> <body> <!– page content –> </body> </html>
Author Archives: juzhax
Finding all files containing a text string on Linux or Mac
I need to find some string in all folders. grep -rnw ‘./folder/’ -e “search-text” Note: -r is recursive -n is line number -w stands match the whole word
Fastest way to rename filenames with space to dash in linux
I want to mass rename hundred of filenames like filename 001.jpg to filename-001.jpg … … … filename 099.jpg to filename-099.jpg I use this command to rename all in few seconds in my MacBook Pro. I think it is fine to run in any linux. for f in *\ *; do mv “$f” “${f// /-}”; done
Show Image Size in Terminal or Shell
The easiest way to show the file size in Terminal in Mac or Linux. ustins-MacBook-Pro:jpg juzhax$ file 001.jpg 001.jpg: JPEG image data, EXIF standard Justins-MacBook-Pro:jpg juzhax$ identify 001.jpg 001.jpg JPEG 720×468 720×468+0+0 8-bit sRGB 59.8KB 0.000u 0:00.009 Justins-MacBook-Pro:jpg juzhax$
command c expects followed by text error in Mac
You received error from the sed command in Mac, because the argument in mac is different. If you type in Mac terminal, you may receive error like this Justins-MacBook-Pro:2 juzhax$ sed -i ‘s/old_text/new_text/g’ example.txt sed: 1: “config.php”: command c expects \ followed by text The first argument should be the extension of the backup file. Continue reading “command c expects followed by text error in Mac”
Convert Text to Slug URL in PHP
Convert Text to slug URL, example: Brown & Cony’s Secret Date! will become: brown-conys-secret-date Will be nice url. function slug_url($text) { // replace non letter or digits by – $text = preg_replace(‘~[^\\pL\d]+~u’, ‘-‘, $text); // trim $text = trim($text, ‘-‘); // transliterate $text = iconv(‘utf-8’, ‘us-ascii//TRANSLIT’, $text); // lowercase $text = strtolower($text); // remove unwanted Continue reading “Convert Text to Slug URL in PHP”
Country Code in Array with PHP Value
Just copy and paste into your code to use the country code. <?php $countries = array ( ‘AF’ => ‘Afghanistan’, ‘AX’ => ‘Aland Islands’, ‘AL’ => ‘Albania’, ‘DZ’ => ‘Algeria’, ‘AS’ => ‘American Samoa’, ‘AD’ => ‘Andorra’, ‘AO’ => ‘Angola’, ‘AI’ => ‘Anguilla’, ‘AQ’ => ‘Antarctica’, ‘AG’ => ‘Antigua And Barbuda’, ‘AR’ => ‘Argentina’, ‘AM’ Continue reading “Country Code in Array with PHP Value”
Hacker’s Secret 100 Secret Techniques Revealed
One of the nice book that suitable for Hacker, but too bad it is in Japanese version. Wish someone will translate to English version in future. You can find the author from here Satoru Takabayashi, Fumitoshi Ukai, Yusuke Sato, Shinichiro Hamaji, Kazuyuki Shudo Chapter 1. Introduction 1. Introduction to Binary Hacks 2. Terminology of Binary Hacks 3. Using “file” to Continue reading “Hacker’s Secret 100 Secret Techniques Revealed”
Connect to Jetpack using behind varnish and nginx
Normally if you use varnish or other reverse proxy, you may use other port in wordpress. So you are not able to connect to Jetpack, because to connect Jetpack, you must have port 80 to authorize. It may display the error like this from your Jetpack debugger SELF: Array ( [headers] => Array ( [server] Continue reading “Connect to Jetpack using behind varnish and nginx”
How to convert pvr.czz file to PNG ?
Download TexturePacker Install and it does support command line tools. To convert single pvr.czz file to PNG in console, here is the way. TexturePacker filename.pvr.ccz –sheet filename.png –data dummy.plist –algorithm Basic –allow-free-size –no-trim To convert mass pvr.czz file to PNG in console, here is the way. find -name \*.pvr.czz | sed ‘s/\.pvr.czz//g’ | \ xargs Continue reading “How to convert pvr.czz file to PNG ?”
