Network in NAT port forward Host port 2222, guest port 22, name ssh, other left blank
Friday, September 16, 2016
How to SSH to a VirtualBox guest externally through a host?
Thursday, September 15, 2016
VirtualBox Static ip
Virtualbox network in BridgeMode sudo vi /etc/network/interfaces auto eth0 iface eth0 inet static address 192.168.Y.X netmask 255.255.255.0 network 192.168.Y.0 gateway 192.168.Y.1 sudo service networking restart
Thursday, September 08, 2016
Whats is the best way to generate uuidv4 in php?
Whats is the best way to generate uuidv4 in php? Some people use this: https://github.com/ramsey/uuid Others can user a system call like file_get_contents('/proc/sys/kernel/random/uuid'); And others just a simple function. What's the best way? Depending on your needs, of course. I can use all the option, so I decide to make a benchmark, and I was surprised...
<?php require __DIR__.'/../vendor/autoload.php'; function gen_uuidv4(){ return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', // 32 bits for "time_low" mt_rand(0,0xffff),mt_rand(0,0xffff), // 16 bits for "time_mid" mt_rand(0,0xffff), // 16 bits for "time_hi_and_version", // four most significant bits holds version number 4 mt_rand(0,0x0fff)|0x4000, // 16 bits, 8 bits for "clk_seq_hi_res", // 8 bits for "clk_seq_low", // two most significant bits holds zero and one for variant DCE1.1 mt_rand(0,0x3fff)|0x8000, // 48 bits for "node" mt_rand(0,0xffff),mt_rand(0,0xffff),mt_rand(0,0xffff)); } // ##################################### $i=microtime(true); for($a=0;$a<1000000;$a++){ file_get_contents('/proc/sys/kernel/random/uuid'); } $f=microtime(true); $t1=$f-$i; echo $t1; echo '<br>'; // ##################################### $i=microtime(true); for($a=0;$a<1000000;$a++){ gen_uuidv4(true); } $f=microtime(true); $t2=$f-$i; echo $t2; echo '<br>'; // ##################################### $i=microtime(true); for($a=0;$a<1000000;$a++){ \Ramsey\Uuid\Uuid::uuid4(); } $f=microtime(true); $t3=$f-$i; echo $t3; T1: 10.762820005417(s) System Call in Ubuntu 14.04 T2: 6.3450520038605(s) simple function T3: 30.962769985199(s) blotted library Choose wisely :)
Subscribe to:
Posts (Atom)
Git get all remote branches
git branch -r \ | grep -v '\->' \ | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" \ | while read remote; do \ git branc...
-
sh -c 'xfce4-screenshooter --fullscreen --save "$HOME/Pictures/Screenshots/Screenshot_$(date +%Y-%m-%d_%H:%M:%S).png"' s...
-
Known Issues Firefox 3.5 will only support color profiles as specified by ICC v2, later versions will add su...