Friday, March 25, 2016

Bash: Converting Percent-encoded String to Multibyte String

Command:

$ a='%E7%B9%94%E7%94%B0%E4%BF%A1%E9%95%B7'
$ echo -e "${a//%/\\x}"


Output:


織田信長

Python: Converting Percent-encoded String to Multibyte String

Command:

$ python -c "import urllib, sys; print urllib.unquote(sys.argv[1])" %E7%B9%94%E7%94%B0%E4%BF%A1%E9%95%B7

Output:

織田信長

Python: Percent-encode Multibyte String

Percent-encode multibyte string:

$ python -c "import urllib, sys; print urllib.quote(sys.argv[1])" 織田信長

Output:

%E7%B9%94%E7%94%B0%E4%BF%A1%E9%95%B7

URL Encoding (Percent-encoding): Url with Multibyte Characters and Percent-encoded URL

https://ja.wikipedia.org/wiki/織田信長

is same as:

https://ja.wikipedia.org/wiki/%E7%B9%94%E7%94%B0%E4%BF%A1%E9%95%B7

Converting Between Hexadecimal Values and Characters

Command:

$ echo -n "織田信長" | hexdump

Output:

0000000 e7 b9 94 e7 94 b0 e4 bf a1 e9 95 b7          
000000c

Hexadecimal Values to Multibyte Characters:

$ echo -e "\xE7\xB9\x94\xE7\x94\xB0\xE4\xBF\xA1\xE9\x95\xB7"

Output:

織田信長

Apple TV : The Kiss

Miki Nakatani (中谷美紀):砂の果実

Wednesday, March 23, 2016

npm: Using npm Package Manager for Node.js to Install Node Module Lodash

Installation command:
$ npm install lodash

index.js:

var lodash = require('lodash');
var output = lodash.without([1, 2, 3], 1);
console.log(output);

Executing index.js:

[ 2, 3 ]

Alcatraz: Installing Package Manager for XCode

$ curl -fsSL https://raw.githubusercontent.com/supermarin/Alcatraz/deploy/Scripts/install.sh | sh

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   590    0   590    0     0    241      0 --:--:--  0:00:02 --:--:--   241
  0     0    0     0    0     0      0      0 --:--:--  0:00:04 --:--:--     0x ./._Alcatraz.xcplugin
x Alcatraz.xcplugin/
x Alcatraz.xcplugin/._Contents
x Alcatraz.xcplugin/Contents/
x Alcatraz.xcplugin/Contents/._Info.plist
x Alcatraz.xcplugin/Contents/Info.plist
x Alcatraz.xcplugin/Contents/._MacOS
x Alcatraz.xcplugin/Contents/MacOS/
x Alcatraz.xcplugin/Contents/._Resources
x Alcatraz.xcplugin/Contents/Resources/
x Alcatraz.xcplugin/Contents/Resources/._ATZPackageListTableCellView.nib
x Alcatraz.xcplugin/Contents/Resources/ATZPackageListTableCellView.nib
x Alcatraz.xcplugin/Contents/Resources/._ATZPluginWindowController.nib
x Alcatraz.xcplugin/Contents/Resources/ATZPluginWindowController.nib
x Alcatraz.xcplugin/Contents/Resources/._bitbucket_grayscale.tiff
x Alcatraz.xcplugin/Contents/Resources/bitbucket_grayscale.tiff
x Alcatraz.xcplugin/Contents/Resources/._en.lproj
x Alcatraz.xcplugin/Contents/Resources/en.lproj/
x Alcatraz.xcplugin/Contents/Resources/._eye_icon.tiff
x Alcatraz.xcplugin/Contents/Resources/eye_icon.tiff
x Alcatraz.xcplugin/Contents/Resources/._git_grayscale.tiff
x Alcatraz.xcplugin/Contents/Resources/git_grayscale.tiff
x Alcatraz.xcplugin/Contents/Resources/._github_grayscale.tiff
x Alcatraz.xcplugin/Contents/Resources/github_grayscale.tiff
x Alcatraz.xcplugin/Contents/Resources/._link_icon.tiff
x Alcatraz.xcplugin/Contents/Resources/link_icon.tiff
x Alcatraz.xcplugin/Contents/Resources/en.lproj/._InfoPlist.strings
x Alcatraz.xcplugin/Contents/Resources/en.lproj/InfoPlist.strings
x Alcatraz.xcplugin/Contents/Resources/en.lproj/._Localizable.strings
x Alcatraz.xcplugin/Contents/Resources/en.lproj/Localizable.strings
x Alcatraz.xcplugin/Contents/MacOS/._Alcatraz
100  111k  100  111k    0     0  21189      0  0:00:05  0:00:05 --:--:-- 56028


Alcatraz successfully installed!!1!🍻  Please restart your Xcode (7.2.1).

Monday, March 21, 2016

AppleScript: Opening iCloud Documents (Numbers)

set the defaultDestinationFolder to (path to desktop folder)
set filePath to (path to library folder from user domain as text) & "Mobile Documents:com~apple~Numbers:Documents:test.numbers"

tell application "Numbers"
activate
    try
        open file filePath
    end try
end tell

Homebrew: Installing Mercurial (hg) (Distributed Version Control)

Command:

$ brew install mercurial

Homebrew: Installing SDI (Simple DirectMedia Layer)

Command:

$ brew install sdl sdl_image sdl_mixer sdl_ttf portmidi