Wednesday, January 3, 2018

React-VR


  • download and install node-v9.3.0.pkg

This package has installed:

  • Node.js v9.3.0 to /usr/local/bin/node
  • npm v5.5.1 to /usr/local/bin/npm
Make sure that /usr/local/bin is in your $PATH.

  • cd ~/work/project
  • npm install -g react-vr-cli
  • react-vr init WelcomeToVR
  • cd WelcomeToVR
  • npm start
  • open browser to http://localhost:8081/vr/index.html
  •  

Monday, October 30, 2017

frequently used commands

to clone SD Card
https://devicetests.com/clone-sd-card-dd-command-ubuntu
sudo fdisk -l
sudo umount /dev/mmcblk0
sudo dd if=/dev/mmcblk0 of=~/sd-card-copy.img bs=1M status=progress
sudo dd if=~/sd-card-copy.img of=/dev/mmcblk0 bs=1M status=progress

ffmpeg -i in.jpg -q:v 10 out.jpg
ffmpeg -i in.mov -q:v 10 out.mp4
ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4

netsh wlan show drivers

netsh interface set interface name="Wi-Fi" admin=disabled
netsh wlan set hostednetwork mode=allow ssid=Your_SSID key=Your_Passphrase
netsh wlan start hostednetwork
netsh interface set interface name="Wi-Fi" admin=enabled

to verify all files in a folder
$ cd orig.dir
$ find . -type f -print0 | xargs -0 md5sum > /sums.md5
$ cd copy.dir
$ md5sum -c /sums.md5

$ gpg2 --list-keys
$ gpg2 --delete-key username

to exclude a folder from diff
$ diff -qr --exclude=".svn" ./tools /opt/cada/trunk/tools

to find current folder size
$ du -sh .

to search for a file in DOS
$ dir /B /S LWH420*

to search and replace all in vi
> :%s/mozgroup.com/mozgroup.net/g

to list folders by size
$ du --exclude "mnt" -h --max-depth=1 . | sort -n -r

to find a file by content
$ find . | xargs grep 'toggle_order' -sl
$ find . | xargs grep 'Registering' -sl
or
$ find . -exec grep -l url_host {} \; 2> /dev/null

to find a file by name
$ find . -name *3851*

to list folder by only filename and size
$ ls -l *.jar | awk '{print $9,"\t", $5}' | sort

to search for class in a list of jars
$ find . -name '*.jar' -exec grep -Hls SoftTokenDeviceTypeDTO {} \;

to split large log file
$ split --bytes=1MB /var/www/vhost/data.meters.us/current/log/production.log /home/aleung/log/


Saturday, February 25, 2017

Bitcoin Gift


To give my gift to you, I'd log in to the Bitcoin Core program on my laptop. For security reason, this laptop is kept clean and free, i.e. the hard drive was reformatted to wipe clean, followed by installing a legit copy of Operating System, and finally the open source Bitcoin Core program.


Step 1. Login to Bitcoin Core. A balance of 0.09 BTC is available.



Step 2. I am sending 0.01 BTC to your address. This is the same address that we used to set up your phone app last week. 



Step 3. The final step is to confirm the transaction. Note that there is a fee for each transaction.

Thursday, February 16, 2017

bitcoin

Step 1. Login to https://blockchain.info/wallet/#/login with wallet id and password (see screenshot1)

Step 2. After logging in, select settings on the left, scroll down to Wallet Password on the right, change current password to a new one. (see screenshot2)

Step 3. Next, select Preferences on the left, change Email Address on the right to your own email address. (see screenshot3)

Step 4. Finally, select HOME on the left, and you will see under Balances on the right that there is 0 BTC in your wallet right now. I will send you some bitcoins after i get back to my secure computer in DC. (see screenshot4)

Tuesday, March 8, 2016

ira

Scenario 1. $5,500 contribution in Roth IRA. No income tax deduction advantage.
Scenario 2. $5,500 contribution in Traditional IRA. Resulting in $1,000 income tax deduction.

Contribution Scenario 1.

Roth IRA account 2016 balance = $5,500.

Let's say a 10x growth 20 years from now.
Traditional IRA account 2036 balance = $5,500 x 10 = $55,000
Total accumulated wealth = $55,000

Let's say a 100x growth 20 years from now.
Traditional IRA account 2036 balance = $5,500 x 100 = $550,000
Total accumulated wealth = $550,000

Contribution Scenario 2.

Traditional IRA account 2016 balance = $5,500.
Investment account 2016 balance = $1,000.

Let's say a 10x growth 20 years from now, at a 10% tax rate
Traditional IRA account 2036 balance = $5,500 x 10 = $55,000
Investment account 2036 balance = $1,000 x 10 = $10,000
Total accumulated wealth = ($55,000 + $10,000) x (1 - 10%) = $59,500

Let's say a 100x growth 20 years from now, at a 10% tax rate
Traditional IRA account 2036 balance = $5,500 x 100 = $550,000
Investment account 2036 balance = $1,000 x 100 = $100,000
Total accumulated wealth = ($550,000 + $100,000) x (1 - 10%) = $595,000

Withdrawal Scenario 3.

Standard Deduction = $4,000 + $1,550 (age 65+) = $5,550

Let's say annual IRA withdrawal at age 65+ = $100,000
Taxable Income = $100,000 - $5,550 = $94,450
Income tax = ($9,225 x 10%) + ($37,450 x 15%) + (47,775 x 25%) = $18,483.75

Thus, savings of Traditional IRA vs Roth IRA
= $595,000 - $550,000
= $45,000
> Income tax at age 65+

Withdrawal Scenario 4.

Standard Deduction = $4,000 + $1,550 (age 65+) = $5,550

Let's say annual IRA withdrawal at age 65+ = $38,550
Taxable Income = $38,550 - $5,550 = $33,000
Income tax = ($9,225 x 10%) + ($23,775 x 15%) = $4,493

Thus, savings of Traditional IRA vs Roth IRA
= $59,500 - $55,000
= $4,500
= Income tax at age 65+

Self Employed Scenario

Let's say annual Health Insurance Premium = $1,000
Let's say annual out-of-pocket medical expenses = $100, and > 10% of adjusted gross income
Let's say federal tax rate at 15%, state tax rate at 5%, FICA at 7.65%

Federal Tax Deduction based on Premium = $1,000 x 15% = $150
State Tax Deduction based on Premium = $1,000 x 5% = $50
Federal Tax Deduction based on Expenses = $100 x 15% = $15
State Tax Deduction based on Expenses = $100 x 5% = $5

Thus, total deduction = $150 + $50 + $15 + $5 = $220

Self Employed Health Reimbursement Scenario

Let's say annual Health Insurance Premium = $1,000
Let's say annual out-of-pocket medical expenses = $100
Let's say federal tax rate at 15%, state tax rate at 5%, FICA at 7.65%

Federal Tax Deduction based on Premium = $1,000 x 15% = $150
State Tax Deduction based on Premium = $1,000 x 5% = $50
FICA Deduction based on Premium = $1,000 x 7.65% = $76.50
Federal Tax Deduction based on Expenses = $100 x 15% = $15
State Tax Deduction based on Expenses = $100 x 5% = $5
FICA Deduction based on Expenses = $100 x 7.65% = $7.65

Thus, total deduction = $150 + $50 + $76.50 + $15 + $5 + $7.65 = $304.15

Wednesday, May 14, 2014

Signed Ruby Gems

Steps to Create a Signed Amortization Gem

Step 1. To Create Self-Signed Gem Cert
gem cert --build andrew@email.com
Expected Result: 
Public Cert: gem-public_cert.pem
Private Key: gem-private_key.pem

Step 2. To Put Gem Certs in Proper Locations
mv gem-private_key.pem /my_private_keys
mv gem-public_cert.pem /my_public_keys

Step 3. To Create Folder Structure
touch amortization.gemspec
mkdir lib
touch lib/amortization.rb

Step 4. To Create lib/amortization.rb
class Amortization
  def self.value
    '123456789'
  end
end

Step 5. To Create amortization.gemspec
Gem::Specification.new do |s|
  s.name        = 'amortization'
  s.version     = '1.0.0'
  s.date        = '2014-05-13'
  s.summary     = 'To provide insurance of integrity of my application'
  s.description = 'This is an application to calculate mortgage amortization'
  s.authors     = ['Andrew Leung']
  s.email       = 'andrew@email.com'
  s.files       = ['lib/amortization.rb']
  s.license     = 'MIT'
  s.cert_chain  = ['certs/gem-public_cert.pem']
  s.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') if $0 =~ /gem\z/
end

Step 6. To Build Signed Gem
gem build amortization.gemspec
Expected Result:
Successfully built RubyGem
Name: encode
Version: 1.0.0
File: amortization-1.0.0.gem

Steps to Install a Signed Amortization Gem

Step 1. To Obtain Public Gem Cert on Target Platform

Step 2. To Add Public Gem Cert to Approved List
gem cert --add gem-public_cert.pem
Expected Result:
Added '/CN=andrew/DC=email/DC=com'

Step 3. To Install Signed Gem
gem install amortization-1.0.0.gem
Expected Result:
Successfully installed amortization-1.0.0
1 gem installed
Installing ri documentation for amortization-1.0.0...
Installing RDoc documentation for amortization-1.0.0...

Thursday, April 3, 2014

Pension & Social Security Benefits

https://www.ssa.gov/pubs/EN-05-10045.pdf
For example, for a worker who turns 62 in 2017, the first $885 of average
monthly earnings is multiplied by 90 percent; earnings between $885 and $5,336 by 32 percent; and the balance by 15 percent. The sum of the three amounts equals the PIA which is then decreased or increased depending on whether the worker starts benefits before or after full retirement age (FRA). This formula produces the monthly payment amount.

For example, workers age 62 in 2017, with average earnings of $3,000 per month could receive a benefit at FRA of $1,473 (49 percent) of their pre-retirement earnings increased by applicable cost of living adjustments (COLAs). For a worker with average earnings of $8,000 per month, the benefit starting at FRA could be $2,620 (32 percent) plus COLAs. However, if either of these workers start benefits earlier, we’ll reduce their monthly benefit.

https://cardinalpointwealth.com/2014/05/02/are-cross-border-social-security-benefits-taxable/
U.S. Social Security Benefits for Americans Living in Canada
U.S. Social Security benefits. These benefits will be subject to tax only in Canada, meaning Robert will be taxed the same way as other Canadian residents even though he’s a U.S. citizen. Here’s the math. In his Canadian taxable income, Robert will include 85% of his Social Security benefits and the remaining 15% will be exempt from Canadian taxes.

CPP/OAS Benefits for Canadians Living in the U.S.
if Robert was a Canadian living in the U.S., his benefits would only be taxable in the U.S. When it comes to taxes, the Internal Revenue Service sees CPP/OAS benefits as equivalent to U.S. Social Security benefits. This means that Robert should report this income on his 1040 form, and it will be taxed at the 85% inclusion rate. Another upside of the U.S./Canada totalization agreement: CPP and OAS income aren’t taxable in Canada and aren’t subject to Canada Revenue Agency withholding for non-residents.