Posts

  • How to synchronize time between Windows and Linux dual systems

  • On Ubuntu: $ sudo apt-get install ntpadate //update time on Ubuntu $ sudo ntpdate time.windows.com $ sudo hwclock --localtime --systohc //update local time to hardware
  • Install Win10 from USB on Thinkpad-8

  • UEFI system cannot boot from an NTFS formatted USB stick. We need to format it using FAT32. Used a new USB disk creation program (https://rufus.akeo.ie) and set it to FAT32 for UEFI and finnaly the tablet booted to the setup. The Windows 10 was formatting the sticks to NTFS. More infomation about Clean Install of Windows 10 on ThinkPad.
  • Calc Eigenvalues and Eigenvectors of Matrix via Matlab or Python

  • Matlab code % Calc eigenvalues and eigenvectors of Hamiltonian syms Omega1 Omega2 H = zeros(4,'sym'); H(2,3) = Omega1; H(3,2) = Omega1; H(3,4) = Omega2; H(4,3) = Omega2; [V,D] = eig(H); disp(D); disp(V); Python code # coding: utf-8 import sympy as sp Omega1 = sp.symbols('Omega1') Omega2 = sp.symbols('Omega2') M = sp.zeros(4,4) M[1,2] = Omega1 M[2,1] = Omega1 M[2,3] = Omega2 M[3,2] = Omega2 print(M.eigenvals()) print(M.eigenvects())
  • Judge whether an integer is odd or not

  • # coding: utf-8 ''' file: test.py create on Tue Mar 26 8:00 2019 @author: Xiao Shang email: me@ishxiao.com note: Judge whether an integer is odd or not ''' # ver 0.1 def isOdd_1(i): if(i%2 == 1): return True else: return False # ver 0.2 def isOdd_2(i): return i%2 == 1 # ver 0.3 def isOdd_3(i): return i%2 == 1 or i%2 == -1 # ver 0.4 def isOdd_4(i): return i%2 != 0 # ver 0.5 def isOdd_5(i): return i>>1 << 1 != i # ver 0.6 def isOdd_6(i): return i&1 != 0
  • How to install package in Pythonista

  • 首先,启动Pythonista,然后左滑屏幕,调出console窗口,在底部>处输入 import requests as r; exec(r.get('https://raw.githubusercontent.com/ywangd/stash/master/getstash.py').text) 然后,点击屏幕左上角的,选择“This iPad”,运行“launch_stash.py”,即打开命令窗口,在此窗口中可运行“pip install 库名”等命令