Thứ Tư, 6 tháng 4, 2016

Sysctl setting - ip conntract

You must login as the root user to use any one of the following command on a Linux operating systems.

Display Linux kernel parameters

The syntax is:
# sysctl variable
####################################
### Display all sysctl variables ###
####################################
# sysctl -a
# sysctl -a | more
# sysctl -a | grep 'something'
# sysctl -a | grep memory

Sample outputs:
vm.memory_failure_early_kill = 0
vm.memory_failure_recovery = 1
vm.overcommit_memory = 0
To see value for kernel variable called kernel.hostname, enter:
# sysctl -n kernel.hostname

How do I set new values?

There are three methods to set new values for given kernel parameters as follows:

Method # 1: Setting value via procfs

You can use standard echo command to write data to variables (this temporary change):
# echo "value" > /proc/sys/location/variable

Method # 2: Temporary on the command line

Use sysctl command with -w option when you want to change a sysctl setting:
sysctl -w variable=value

Method # 3: Configuration file /etc/sysctl.conf

This is recommended way. First open /etc/sysctl.conf file, enter:
# vi /etc/sysctl.conf
Now add value:
variable = value
Close and save the changes. Type the following command to load sysctl settings from the file /etc/sysctl.conf file:
# sysctl -p
OR
# sysctl -p /etc/sysctl.conf
The last method will load settings permanently at boot time from /etc/sysctl.conf file. Read man page of sysctl for information:
$ man sysctl

Chủ Nhật, 27 tháng 3, 2016

Terminal Tips: Enable "path view" in Finder

When you open a Finder window and start browsing to a folder, do you lose track of the path to that folder? If you do, the Terminal command below will enable path view in the Finder -- this means that you will see the directory path to the current folder you are browsing in the title bar, instead of only seeing the name of the current directory.

To make directory paths visible atop Finder windows, open Terminal.app (/Applications/Utilities/) and type the following command:

defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES

Once you run the above command, you will also need to restart the Finder, so you can either type "killall Finder" and hit return, or use the Force Quit option under the Apple menu to relaunch it. The Finder will restart, and you will start seeing the paths to directories in the title bar.
Update: As some have pointed out in the comments below, this Terminal command will only work with Mac OS X Leopard (version 10.5).

Disable certificate verification in PHP SoapClient

$context = stream_context_create(array(
    'ssl' => array(
        // set some SSL/TLS specific options
        'verify_peer' => false,
        'verify_peer_name' => false,
        'allow_self_signed' => true
    )
));

$client  = new SoapClient(null, array( 
    'location' => 'https://...',
    'uri' => '...', 
    'stream_context' => $context
));

Chủ Nhật, 20 tháng 3, 2016

Thứ Sáu, 18 tháng 3, 2016

Make Home & End keys behave like Windows on Mac OS X

If, like me, you want Home to send you to the start of the line and not to the top of the document then create a file called DefaultKeyBinding.dict in your ~/Library/KeyBindings folder (might need to create that folder too) with the following contents:
{
    "\UF729"  = moveToBeginningOfParagraph:; // home
    "\UF72B"  = moveToEndOfParagraph:; // end
    "$\UF729" = moveToBeginningOfParagraphAndModifySelection:; // shift-home
    "$\UF72B" = moveToEndOfParagraphAndModifySelection:; // shift-end
    "^\UF729" = moveToBeginningOfDocument:; // ctrl-home
    "^\UF72B" = moveToEndOfDocument:; // ctrl-end
    "^$\UF729" = moveToBeginningOfDocumentAndModifySelection:; // ctrl-shift-home
    "^$\UF72B" = moveToEndOfDocumentAndModifySelection:; // ctrl-shift-end
}
This remapping does the following in most Mac apps including Chrome (some apps do their own key handling):
  • Home and End will go to start and end of line
  • ShiftHome and ShiftEnd will select to start and end of line
  • CtrlHome and CtrlEnd will go to start and end of document
  • ShiftCtrlHome and ShiftCtrlEnd will select to start and end of document
Note that you will need to reboot after creating this file for it to take effect.

Source: https://damieng.com/blog/2015/04/24/make-home-end-keys-behave-like-windows-on-mac-os-x

Thứ Năm, 3 tháng 3, 2016

Config composer under proxy

set HTTP_PROXY=http://username:password@proxyserver:port && composer install


https://getcomposer.org/doc/00-intro.md

http://www.yiiframework.com/extension/yii2-oauth2-server/#hh1

Thứ Hai, 15 tháng 2, 2016